ESP01S IR reading head for german electricity meter / smart meter (Itron) with ESPHome

Hi guys, I wanted to report my experiences with an ESP01S IR reader head in interaction with German electricity meters / smart meters (Itron from Netze-BW) and ESPHome.

Since I didn’t have time to tinker and wanted a device that was as compact as possible, I bought the reader head here on Ebay: Tasmota Wifi ESP01S Lesekopf für Stromzähler / Smart Meter | eBay
The nice thing about this reading head is that the esp-01s is located directly in the housing. So you don’t have any unnecessary devices or cables and only have to power the read head itself via micro usb.

The reader head comes with Tasmota pre-installed. This works flawlessly if you enter the appropriate SML script and configure MQTT. This could actually be the end of the story here. :smiley:

But since I run all my other ESP devices with ESPHome, I also wanted to flash the read head with it to have a system landscape as uniform as possible. Unfortunately, I could not find a really good tutorial anywhere, which is why I now share my approach with you.

First of all the minimal image of Tasmota should be flashed as a manual upgrade on the read head to be able to flash ESPHome afterwards. The Tasmota .bin binary files for flashing can be found here: Tasmota ESP8266 Binaries
After the successful flash process of the minimal image you will be redirected to the main page of the Tasmota device.

After that, the configuration file for the read head should be created in the ESPHome dashboard. In my case, in connection with the Itron electricity meter, it looks like this:

substitutions:
  devicename: "esp-01s-stromzaehler"

esphome:
  name: ${devicename}
  platform: ESP8266
  board: esp01_1m
  comment: "Stromzähler"

logger:

api:
  password: !secret api_password

ota:
  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: HIGH
  ap:
    ssid: "${devicename}"
    password: !secret fallback_password

web_server:
  port: 80
  auth:
    username: admin
    password: !secret web_server_password

time:
  - platform: homeassistant
    id: homeassistant_time

captive_portal:

external_components:
  - source: github://alengwenus/esphome_components@main
    refresh: 0s
    components: [sml]

uart:
  - id: uart0
    tx_pin: GPIO1
    rx_pin: GPIO3
    baud_rate: 9600
    data_bits: 8
    parity: NONE
    stop_bits: 1

sml:
  - id: sml0
    uart_id: uart0

sensor:
  - platform: wifi_signal
    name: "${devicename} WiFi Signal"
    device_class: signal_strength
    update_interval: 60s
  - platform: sml
    sml_id: sml0
    name: "${devicename} Total energy in"
    obis_code: "1-0:1.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 4
    device_class: energy
    state_class: total_increasing
    filters:
      - multiply: 0.0001
  - platform: sml
    sml_id: sml0
    name: "${devicename} Total energy out"
    obis_code: "1-0:2.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 4
    device_class: energy
    state_class: total_increasing
    filters:
      - multiply: 0.0001
  - platform: sml
    name: "${devicename} Active power"
    sml_id: sml0
    obis_code: "1-0:16.7.0"
    unit_of_measurement: W
    accuracy_decimals: 2
    device_class: power
    state_class: measurement
    filters:
      - multiply: 1

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "${devicename} IP Address"
    ssid:
      name: "${devicename} SSID"
    bssid:
      name: "${devicename} BSSID"
    mac_address:
      name: "${devicename} Mac Address"
    scan_results:
      name: "${devicename} Latest Scan Results"
  - platform: sml
    name: "${devicename} ID"
    sml_id: sml0
    obis_code: "1-0:96.1.0"
    format: hex

For more information on how to get the obis_codes for your electricity meter, click here:

After creating the ESPHome configuration file you can download the binary file for the installation in the dashboard via Install --> Manual download --> Legacy format.
The downloaded ESPHome binary can now be manualy flashed via the tasmota webinterface like the Tasmota minimal image before.

That’s it :slight_smile: After a short reboot the device should now have been flashed with ESPHome and can be set up as ESPHome devices in Home Assistant.


I’m super happy with it for now. :slight_smile: Maybe this description here also help the one or other of you out there.

Many greetings

5 Likes

As far as I understand it, SML (Smart Message Language) which is used by the ESP01S IR and pulse counting are two different things. Even if both use diodes to read out the information, the script will probably not be able to be exchanged 1:1.

Hi,

I’m writing from Wurzburg Germany where we (currently) get ZPA GH305 Stromzaehler from our supplier. At least this is what I have and cannot get to be read out.
I’m happy to post whatever required … I’d like to start with describing the symptoms I see. I also use the above described hardware and flashed a yaml almost identical to the above onto the ESP.
As soon as a boot it up it responds properly to the local WiFi and I can access it via the web_server.
When I now pop it on the energy meter the meter itself turns on the background light of the display and starts changing values being displayed. The “Volkzaehler” ESP thingy instead can no longer be accessed via the web_server interface and starts posting weird messages via the logs:

[15:54:35][D][uart_debug:114]: <<< 69:00:00:00:00:00:00:2C:98:01:77:07:01:00:51:07:01:FF:01:01:62:08:52:FF:59:00:00:00:00:00:00:04:AD:01:77:07:01:00:51:07:02:FF:01:01:62:08:52:FF:59:00:00:00:00:00:00:09:5F:01:77:07:01:00:51:07:04:FF:01:01:62:08:52:FF:59:00:00:00:00:00:00:09:A6:01:77:07:01:00:51:07:0F:FF:01:01:62:08:52:FF:59:00:00:00:00:00:00:07:54:01:77:07:01:00:51:07:1A:FF:01:01:62:08:52:FF:59:00:00:00:00:00:00:07:28:01:01:01:63:DE:CC:00:76:05:01:02:03:04:62:00:62:00:72:65:00:00
[15:54:35][W][sml:112]: Checksum error in received SML data.
WARNING ueding_meter_02.local: Connection error occurred: [Errno 104] Connection reset by peer
INFO Processing unexpected disconnect from ESPHome API for ueding_meter_02.local
WARNING Disconnected from API

After a short while it also stops doing that and turns completely silent. It still replies to pings from the console, though and can still be reflashed wirelessly …

Any Idea what I’m doing wrong?
Any help is very much appreciated!

Hi,

same problem after update ESPHome to version 2023.8.0
“Checksum error in received SML data”
Update was the only change.

Gretings from NRW/Germany

There is already a bug report on this on github: SML checksum error since merge of #5250 · Issue #4803 · esphome/issues (github.com)

Thank you for your replies guys. Since I started tinkering with the Volkszaehler being already on 2023.08 I never saw it working and thought I did sth incorrectly.

Should bei fixed now with esphome Version 2023.8.1 :relaxed:

@CM000n I think you are using the native API of ESPhome now instead of MQTT. Can you please tell me how often HA gets the IR reading over the API; can the time be configured? Usually the energy meter is sending the reading every couple seconds.

Yes, I receive the information promptly, every few seconds, but at no fixed interval. I think as soon as new information is available, it is sent immediately. I don’t know if there is anything else that can be configured for this.

You are right, you get every reading. This will bring a lot of data to the database. A possible solution to reduce the amount of readings might be a Delta filter.

1 Like

Space and computing power is not a problem for me. I use a Postgres database with 1TB of space available. My Home Assistant runs on a computer with Intel J5040, which has no problem with the amount of data.
But thanks for the tip.

Hello together, first of all, thank you very much for your great work. i have also converted my smart meter DWS 7612.2 to ESPHome using a Tasmota IR read/write head. I can also read the values. Unfortunately, I have a problem with changing the extended data set from the meter. I only get the extended data set for about 24 hours, after that the simple data set is active again. Does anyone have an idea what this could be?

Here at our meter (Netze-BW), you also have to deactivate the re-entry of the PIN after you have entered it. Otherwise it resets itself again and again and requires the PIN to be entered again.

Hello Simon, I have set the extended data set to ON and the PIN to OFF. After approx. one day, the PIN is ON again and the extended data record is OFF. I have already changed it 3 times and the smart meter keeps resetting itself. Any idea what i am doing wrong?

No. These are the same settings that I have. There are not many other configuration options (at least with our meter).
You may be able to ask your network operator whether this is a special “feature” of your meter. Good luck.

Thanks for the quick replay. I will report again when I get it solved.

Hello,
I think I have solved it. I have been able to read in the data successfully for a few days now. I deleted the Tx from the uart configuration and also covered the Rx diode of the smart meter. Maybe it will help others who have a similar problem.