Based on esphome-p1reader, which is an ESPHome custom component for reading P1 data from electricity meters. Designed for Swedish meters that implements the specification defined in the Swedish Energy Industry Recommendation For Customer Interfaces version 1.3 and above.
Notable differences from esphome-p1reader are:
- More frequent update of sensors with configurable update period.
- No additional components needed. RJ12 cable connects directly to ESP module. (A resistor may be needed in some cases)
- More configurable sensor parameters and text sensors makes it easier to adapt this project to other markets than Sweden without having to change the C++ code.
The current version is tested with ESPHome version 2025.7.3 and the yaml will not work with versions earlier than 2024.6.0.
- Sagemcom T211 / Ellevio, Skånska Energi
- Aidon 6534 with RJ12/P1-port module (not RJ45/NVE module) / SEVAB
- Landis+Gyr E360 / E.ON - But read this
- S34U18 (Sanxing SX631) / Vattenfall - But read this
- Kamstrup OMNIPOWER
- KAIFA MA304H4E (and MA304T4E) / Nacka Energi - But read this
- SWEMET / Shenzhen Star - STZ351 - Some meters are working fine while other seems to have an incorrectly formatted message and incorrectly calculated checksum. If you are having problems, look at this discussion for a possible workaround.
- Itron A300 / Borås Elnät
- KAIFA CL109 / Öresundskraft
This project is named after the Wemos D1 mini board, which is based on the ESP8266 processor. D1 mini boards (or clones) are very cheap and still work well.
The build instructions for the D1 mini match the p1mini.yaml configuration.
However, the ESP8266 is now over 10 years old and no longer recommended for ESPHome projects. As a result I have moved to using a Waveshare ESP32-C3-Zero board, with a more powerfull processor that does not require more power than the ESP8266.
The build instructions for the C3-Zero match the p1mini32.yaml configuration.
It is also fairly easy to take any board that ESPHome supports and modifying one of the configurations to work with that. It is mostly a question of figuring out what pins to use for what. If you have pre built hardware which does not connect the RTS signal to a GPIO, read this. Also, if your pre built hardware inverts the signal in hardware, make sure to remove the inversion in the configration!
Note that ESP32 based boards other than the ESP32-C3 draw more power, which may cause a problem with the supply from the meter and generally offer no advantage. The P1 port on the meter provides 5V up to 250mA.
The component can be used by itself from any config file, or with one of the included config files, which are kept up to date with any updates and matches one of the hardware configurations.
The component can be used by itself from any config file which may make sense if you are making substantial changes to the config file.
Clone the repository and create a companion secrets.yaml file with the following fields:
wifi_ssid: <your wifi SSID>
wifi_password: <your wifi password>
p1mini_password: <Your p1mini password (for OTA, etc)>
p1mini_api_key: <Home Assistant API key>
The p1mini_password field can be set to any password before doing the initial upload of the firmware. A new API key can be generated on this page.
The file structure should include these files:
|- p1mini.yaml (or p1mini32.yaml)
|- secrets.yaml
|- components
|- p1_mini
|- __init__.py
|- p1_mini.cpp
|- p1_mini.h
|- sensor
|- __init__.py
|- p1_mini_sensor.cpp
|- p1_mini_sensor.h
|- text_sensor
|- __init__.py
|- p1_mini_text_sensor.cpp
|- p1_mini_text_sensor.h
Flash ESPHome as usual, with the relevant files in place. Don't connect USB and the P1 port at the same time!
If everything works, Home Assistant will autodetect the new integration after you plug it into the P1 port:
Things to try if you are having problems. (Ideally before opening a GitHub Issue)

