ESPHome Smart Meter OBIS D0 Component

Hi, I am a new user of home assistant and I’d like to get the results of my eBZ DD3 Drehstromzähler too. My setup differs, I do use an ir sensor connected via USB to my computer. I can access the results of the smart meter. A simple ‘cat /dev/ttyUSB0’ shows the results, like “1-0:1.8.0255(000229kWh)”. Of course, my smart meter does not yet show all data, I am still waiting for the pin.
Can you please help me what do I have to change in your code to get the results from the serial port without using ESPHome?

I tried the setup at Reading data from a smart meter speaking D0, but do only get errors, yaml check already complains.

As I said, I am new to home assistant and will probably need some more help than an experienced user.

Hi Frank,

No offense and don’t get me wrong, but don’t you think it would be easier to just spend 30 bucks on an UART sensor and an ESP8266 to have a working template instead of asking for detailed help on a kinda different subject in apparently the wrong thread?

Just my 2 cents…

I agree, this sounds like a completely different project. What you can do is to try to reuse the code from SmartMeterD0.h/.cpp.

Sorry for asking here, but for me it looked like it’s an “easy” task to adapt the configuration.yaml to use a serial port instead of the esp8266 stuff.
On the other hand, I#d like to learn about home assistant and saw that this project uses a complete other configuration.yaml syntax than the one mentioned. My hope was to understand the project as good as necessary to adopt the configuration.yaml to use a serial port instead of ESP8266.
And reusing available resources is imho better than buying new ones.

Thanks for the component!
Works perfectly!
Any chance to get this included in esphome?

Hi, do you mean as an official component of esphome (instead of an external component)?

Well, I have some experience with that and it always caused me a lot of extra work, with less flexiblity. As I do this in my rare spare time I don’t want to spend more time at the moment. Sorry.

1 Like

Quick note for anyone trying this on an esp8266:
The regex checking is very slow, when using it for all sensors (in my case 9 sensors, 2 for energy, 4 for current power (total + 1 for each phase), 3 for voltage on each phase), the esphome device (esp8266) loses Wifi from time to time and will fail to show logs in esphome and also fail to update via OTA.

Easiest solution is just to use the regex checking on the “important” sensors (e.g. the energy sensors) and not use it on the instantaneous sensors (power, voltage) as those don’t tend to cause issues if they might show a wrong value once in a while (although so far it seems to be rock-solid)
(or of course you could use an esp32 to get the required horse power :smiley: )

Hi there,

nice component, worked directly out of the box - thank you.

But I have a problem,
the entity for “power” does not provide a value.
yes, i unlocked it with the PIN and the actual power value
is shown on die Display of the smart meter.
The software runs on an d1 mini (az delivery).

Any suggestions?

@JWSK This could have several reasons:

  • Does your meter provide 1-0:16:7.0? Which meter do you use?
  • Is the value_regex matching? You can (temporarily) remove the value_regex to check whether this causes the problem.

Do you have access to the esphome logs? If yes you can check the available OBIS codes and the format in the log output.


So this is the Smartmeter.
for testing I deactivated the regex parameter

those are the sensors:

sensor:

  • platform: obis_d0
    name: “Consumed Energy”
    obis_d0_id: my_sm
    obis_code: “1-0:1.8.0*255”
    unit_of_measurement: kWh
    accuracy_decimals: 0
    state_class: total_increasing
    device_class: energy
    value_regex: “\d{6}\.\d{4}\*kWh”

  • platform: obis_d0
    name: “Provided Energy”
    obis_d0_id: my_sm
    obis_code: “1-0:2.8.0*255”
    unit_of_measurement: kWh
    accuracy_decimals: 0
    state_class: total_increasing
    device_class: energy
    value_regex: “\d{6}\.\d{4}\*kWh”

  • platform: obis_d0
    name: “Power”
    obis_d0_id: my_sm
    obis_code: “1-0:16.7.0*255”
    unit_of_measurement: W
    accuracy_decimals: 0
    state_class: measurement
    device_class: power
    #value_regex: “-?\d{6}\*W”`

and this is one logfile segment:

[14:39:59][D][obis_d0:157]: Identification: LOG5XXxXXXXXXXXXXXXXXXXXXXX
[14:39:59][D][obis_d0:201]: OBIS info: 1-0:96.1.0255 → 001LOGXXXXXXXXXXX
[14:39:59][D][obis_d0:201]: OBIS info: 1-0:1.8.0
255 → 034914.9953kWh
[14:39:59][D][sensor:093]: ‘Consumed Energy’: Sending state 34914.99609 kWh with 0 decimals of accuracy
[14:39:59][D][obis_d0:201]: OBIS info: 1-0:2.8.0
255 → 006139.1373kWh
[14:39:59][D][sensor:093]: ‘Provided Energy’: Sending state 6139.13721 kWh with 0 decimals of accuracy
[14:39:59][D][obis_d0:201]: OBIS info: 1-0:0.2.0
255 → ver.03,432F,20170504
[14:39:59][D][obis_d0:201]: OBIS info: 1-0:96.90.2255 → 0F66
[14:39:59][D][obis_d0:201]: OBIS info: 1-0:97.97.0
255 → 00000000
[14:39:59][W][component:204]: Component obis_d0 took a long time for an operation (0.22 s).
[14:39:59][W][component:205]: Components should block for at most 20-30ms.

so there is no 1-0:16:7.0, how could I fix it? I am sure the energy supplier won’t install a new smartmeter.

Thanks for your help


Maybe thats is the problem.
INF on has to be activated after pin input.

I will try when I visit the smart meter next Time :slight_smile:

Yes, that’s the problem.

FYI: My smart meter (different vendor) has the following problem: It forgets the INF configuration when there is a power outage. So I always have to reconfigure…

Hello mampfes,

thanks for your help.

i will check about the blackouts there.
I already know the the entered pin stays active after blackout.

Give me some days and I will be safe to say what is possible and what not

We were right, it was the inf on parameter!
Thank you!

Dear all,
thx for this nice component - unfortunately it does not work for me :frowning:
Hope you could help me: No matter what I do, I always get
"[22:30:00][D][obis_d0:152]: abort"
in the logger. I tried different things, but apparently the data is not comming through. Using NodeMCUv2 (ESP 8266) with the exact example as given by judges.
Any idea where I should be looking at?

Update: Found that my meter uses SML and code 1_8D_0P_N_1S for serial coms.
Meter name: ebz dd3 2r06 dta smz1
How do I activate that in the above example? Thx!

Update 2: The link provided by mampfes in the post below was helpful (THX!) - now the IR readout works without problems.
Further reference: https://www.mittelstedt.net/?tag=esphome (german website)

Thx!

@Ole_North This component only supports D0 based meters. For SML, please use this component: SML (Smart Message Language) — ESPHome

1 Like

Has anyone tried to use this on a tasmota based device like the Hichi IR or ESPLesekopf?

@M92718 There are people out there which use this component with ESP01 based devices:

Scary, is there something pre build that you can just flash over tasmota?

ESPHome is using a different approach than Tasmota: ESPHome doesn’t a provide pre-build binary, but let you build your own application based on your needs. Therefore, please get familiar with ESPHome.