Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SML sensor for reading smartmeters #1041

Closed
Syntoxr opened this issue Dec 16, 2020 · 139 comments · Fixed by esphome/esphome#2396
Closed

SML sensor for reading smartmeters #1041

Syntoxr opened this issue Dec 16, 2020 · 139 comments · Fixed by esphome/esphome#2396

Comments

@Syntoxr
Copy link

Syntoxr commented Dec 16, 2020

Describe the problem you have/What new integration you would like

Hi,
I would love to see SML (smart message language) support for ESPHome as (I think) many smart meters use the SML language in combination with the D0 or other reading heads. I use a phototransistor like described in the repo linked below of @mruettgers.

Please describe your use case for this integration and alternatives you've tried:

My use case, as described, is to read smart meters without having to buy overpriced hardware from the manufacturer of smart meters. The Alternative I'm currently using is this one:
https://github.com/mruettgers/SMLReader
I have multiple smart meters and it supports only one input.
Also ESPHome integrates better into HomeAssistant and it's obviously easier to manage everything from one place.

Additional context

This site is written in German but I think most of it is translatable and it describes the structure of this protocol well:
https://www.msxfaq.de/sonst/bastelbude/smartmeter_d0_sml_protokoll.htm

Thank you for your work 👍

@mruettgers
Copy link

Hey Syntoxr,

just to clarify, SMLReader does support more than one input.
Because it makes use of software based serial access, you can use almost any GPIO pin to attach further meters.

And at least one has confirmed that it is working :-).
strandaster/SMLReader@be11239#commitcomment-42372498

@Syntoxr
Copy link
Author

Syntoxr commented Dec 16, 2020

Hi,
My fault, I'll try this out but I think it would still be a useful addition for ESP home.
Thanks for pointing to this.

@farbefreak
Copy link

I am in for it.
My supply company will switch to smart meters next year and i would love to interface with it properly.

@Hoelli4C
Copy link

Hoelli4C commented Feb 3, 2021

SML Support in ESPHome would be awesome. +1 from me ;)

@PKM85
Copy link

PKM85 commented Mar 11, 2021

Same here! Would very much appreciate SML support...

@autox86
Copy link

autox86 commented Jul 2, 2021

This would really very nice to have it in ESPHome.
@mruettgers
Your project is awesome already, would it be able for you to add the native home assistant api?
This is the main advantage of esohome for me

@Hoelli4C
Copy link

Hoelli4C commented Aug 5, 2021

Since Home Assistant 2021.8 just added the Energy Dashboard, I wanted to bump this. I hope this is ok.

@tazginpax-ho
Copy link

I would also like to see this integrated in Esphome rather than my current solution via tasmota ;)

@Styx85
Copy link

Styx85 commented Aug 9, 2021

There exists a library in C. Maybe ist is of use.

@jarny0815
Copy link

SML Integration in ESPHome would be very cool. Many smartmeters use SML records to send their values. Very cheap sensors (only a phototransistor + pullup resistor + 2 neodym magnets) could easily build (cost less than 1 Euro).

@BMOD89
Copy link

BMOD89 commented Sep 1, 2021

I have played a bit around with esphome and the existing dsmr component.
I changed the package so that I succeeded in reading SML packages in. It was relatively easy...

Now I am thinking how the parsing should be done. One option would be to adapt the dsmr parser. I didn't look into it in detail yet if it makes sense.

@mruettgers is using the libSML package from here https://github.com/volkszaehler/libsml
In the contribution guide is written "The number of external libraries should be kept to a minimum".

So my question is if this is an option for esphome or not. I am also not clear how the integration into esphome would be possible.
What is the recommendation of the esphome maintainers?
@OttoWinter could you please help?

@BMOD89
Copy link

BMOD89 commented Sep 2, 2021

I just saw that DSMR is also using a external library in the final implementation in esphome. So it should be fine here as well.

@Diddlik
Copy link

Diddlik commented Sep 2, 2021

I just saw that DSMR is also using a external library in the final implementation in esphome. So it should be fine here as well.

Maybe it would be possible to implemewnt an custom component for parsing?
Till now I tried Tasmota, ESPEasy, SMLReader - all of them a very unflexible and not so easy to integrate...

@BMOD89
Copy link

BMOD89 commented Sep 3, 2021

I successfully integrated libsml into my custom component via plattform.io.
Parsing the message is working. I can see the values in the logger.
Atm I'm trying to understand how the values need to be defined and how to publish the values. Let's see :)

@Diddlik
Copy link

Diddlik commented Sep 3, 2021

Nice job! I hope it works out for you! Because it would be the best solution so far!

@alengwenus
Copy link

I was also playing around with a custom component which reads out the total energy and active power from my smart meter using SML. „Parsing“ is done by just specifying the bytes (position and length) in the SML file.
Works fine for me. Although I didn’t put much effort into it, the crc16 check and some logging to display the SML file is implemented.
The repo is here. Maybe it helps someone…

@Diddlik
Copy link

Diddlik commented Sep 6, 2021

I was also playing around with a custom component which reads out the total energy and active power from my smart meter using SML. „Parsing“ is done by just specifying the bytes (position and length) in the SML file.
Works fine for me. Although I didn’t put much effort into it, the crc16 check and some logging to display the SML file is implemented.
The repo is here. Maybe it helps someone…

I looked at your solution, you do not use the sml lib, but only the parser for your counter, ie for another would be necessary to adjust the parser?

@alengwenus
Copy link

I looked at your solution, you do not use the sml lib, but only the parser for your counter, ie for another would be necessary to adjust the parser?

Yes, as I said: You have to identify the corresponding byte positions by yourself. I guess a more mature solution would parse for the specified OBIS numbers and then derive the values. I don't know if libsml helps here or how complicated it is to write a minimal solution for parsing.

@Diddlik
Copy link

Diddlik commented Sep 6, 2021

I looked at your solution, you do not use the sml lib, but only the parser for your counter, ie for another would be necessary to adjust the parser?

Yes, as I said: You have to identify the corresponding byte positions by yourself. I guess a more mature solution would parse for the specified OBIS numbers and then derive the values. I don't know if libsml helps here or how complicated it is to write a minimal solution for parsing.

Can you maybe explain how I can do it for my counter. That would be current quick and durty but working solution.
I have Iskra 681.

https://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/iskraemeco_mt681

@BMOD89
Copy link

BMOD89 commented Sep 6, 2021

I have uploaded my test to https://github.com/BMOD89/sml. Basically I adapted dsmr so I can read the values.

I have created a "mapping" table which maps the OBIS ID to a name, so I can configure it in a similar way as dsmr. But this solution is not really universal. It seems to me that some meters use different codes for the same type of value. For example @Diddlik's meter uses 1-0:15.7.0 for the power while mine uses 1-0:16.7.0. But for now the current "solution" is working.
I agree with @alengwenus make a mapping between the OBIS ID and the name in the yaml file would be much better. I was thinking about that when I started, but I am not sure yet how to realize that. I need to check other components, how this could be done.

Currently I see the follwoing open points:

  • Debugging comments included to print the SML messages
  • text sensor is not working (still the code from dsmr)
  • No documentation
  • best would be to implement it natively in esphome :)

@Diddlik, you should be able to test it with your meter. I have added a second mapping for the power which is called power_delivered_2. If the table in the volkszaehler wiki is correct, this should work for your device.

@Diddlik
Copy link

Diddlik commented Sep 6, 2021

not bad. I am currently working on the alengwenus' solution, next will test your!
But it looks very good!

@1individuum
Copy link

I have uploaded my test to https://github.com/BMOD89/sml. Basically I adapted dsmr so I can read the values.

Thank you very mutch. Works fine with my smart meter "Norax3d"

@Hedda
Copy link

Hedda commented Sep 8, 2021

Do you guys think SML is also being using by Kamstrup smart water meters which feature a similar bidirectional optical IR eye head?

If so please see request #1402

@klaus1956
Copy link

May be it is woth to add my Gas-Meter Idea here too:
klaasnicolaas/home-assistant-glow#42

My plan is to work on this in Oct. 21

@altacoon
Copy link

@syssi Does the custom component has any effect on the IR reader I use? I suppose not, does it?

@r100gs
Copy link

r100gs commented Apr 13, 2022

Hello,

i´ll try to get my Easymeter Q3CA into Homeassistant.
I think my IR-Reader is working. At least I get some cryptic values from the reader. I tried the ir on the upper side.
Maybe somebody can help me to get readable values.
I tried the sml and the d0 integration with different parameters in the serial config

This is my log:

[07:27:03][C][sml_sensor:033]: SML 'Bezug Tarif T1 kWh'
[07:27:04][C][sml_sensor:033]:   Device Class: 'energy'
[07:27:04][C][sml_sensor:033]:   State Class: 'total_increasing'
[07:27:04][C][sml_sensor:033]:   Unit of Measurement: 'kWh'
[07:27:04][C][sml_sensor:033]:   Accuracy Decimals: 2
[07:27:04][C][sml_sensor:037]:   OBIS Code: 1-0:1.8.1
[07:27:04][D][uart_debug:158]: <<< "\e\e\e\e\x01\x01\x01\x01v\x05\x00Yh b\x00b\x00re\x00\x00\x01\x01v\x01\x01\aESYQ3C\v\x06ESY\x01\a\e76v\x01\x01co\x19\x00v\x05\x00Yh!b\x00b\x00re\x00\x00\a\x01w\x01\v\x06ESY\x01\a\e76v\x01rb\x01e\x10\x0F\"\x04q\x00w\a\x01\x01G\x02\x03�\x01\x01\x01\x01\x04ESY\x01w\a\x01\x01\x01\b\x00�cA\x10rb\x01"
[07:27:04][V][component:199]: Component uart took a long time for an operation (0.36 s).
[07:27:04][V][component:200]: Components should block for at most 20-30ms.
[07:27:05][D][uart_debug:158]: <<< "\x01e\x00\x00\x00n\x01w\a\x01\x01\x01\b\x05�cA\x10rb\x01e\x10\x0F\"\x04b\x1ER\x01e\x00\x00\x00o\x01w\a\x01\x01\x01\b\x06�cA\x10rb\x01e\x10\x0F\"\x04b\x1ER\x01e\x00\x00\x00y\x01w\a\x01\x02\x02\b\a�cA\x10rb\x01e\x10\x0F\"\x04b\x1ER\x01e\x00%Ro\x01w\a\x01\x02\x02\b\b�cA\x10rb\x01e\x10\x0F\"\x04b\x1ER\x01e\x00\x00\x00q\x01w\a\x01\x00\x01\a\x00�\x01\x01b\eR~U\x00\x00\x1Da\x01w\a\x01\x00\x15\a\x00"
[07:27:05][W][sml:063]: Checksum error in received SML data.
[07:27:05][V][component:199]: Component sml took a long time for an operation (0.52 s).
[07:27:05][V][component:200]: Components should block for at most 20-30ms.
[07:27:05][C][sml_sensor:033]: SML 'Einspeisung T7 kWh'
[07:27:05][C][sml_sensor:033]:   Device Class: 'energy'
[07:27:05][C][sml_sensor:033]:   State Class: 'total_increasing'
[07:27:05][C][sml_sensor:033]:   Unit of Measurement: 'kWh'
[07:27:05][C][sml_sensor:033]:   Accuracy Decimals: 2
[07:27:05][C][sml_sensor:037]:   OBIS Code: 1-0:1.8.7
[07:27:06][D][uart_debug:158]: <<< "�\x01\x01b\eR~U\x00\x00\x00P\x01w\a\x01\x00)\a\x00�\x01\x01b\eR~U\x00\x00g0\x01w\a\x01\x00=\a\x00�\x01\x01b\eR~U\x00\x005a\x01w\a\x01\x00`\x05\x05�\x01\x01\x01\x01cA\x10\x01\x01\x01cK@\x00v\x05\x00Yh\"b\x00b\x00re\x00\x00\x02\x01q\x01ceP\x00\x00\x00\e\e\e\e\x1A\x02\x10r"
[07:27:06][V][component:199]: Component uart took a long time for an operation (0.33 s).
[07:27:06][V][component:200]: Components should block for at most 20-30ms.
[07:27:06][D][uart_debug:158]: <<< "b\x01e\x10\x0F\"\x06b\x1ER\x01e\x00\x00\x00n\x01w\a\x01\x01\x01\b\x05�cA\x10rb\x01e\x10\x0F\"\x06b\x1ER\x01e\x00\x00\x00o\x01w\a\x01\x01\x01\b\x06�cA\x10rb\x01e\x10\x0F\"\x06b\x1ER\x01e\x00\x00\x00y\x01w\a\x01\x02\x02\b\a�cA\x10rb\x01e\x10\x0F\"\x06b\x1ER\x01e\x00%Ro\x01w\a\x01\x02\x02\b\b�cA\x10rb\x01e\x10\x0F\"\x06b\x1ER\x01e\x00\x00\x00q\x01w\a\x01\x00\x01\a\x00�\x01\x01b\eR~U\x00\x00"
[07:27:06][V][component:199]: Component sml took a long time for an operation (0.46 s).
[07:27:06][V][component:200]: Components should block for at most 20-30ms.
[07:27:07][C][version.text_sensor:021]: Version Text Sensor 'Stromzaehler - ESPHome Version'
[07:27:07][C][version.text_sensor:021]:   Icon: 'mdi:new-box'
[07:27:07][V][version.text_sensor:021]:   Unique ID: '84cca8a97952-version'
[07:27:07][D][uart_debug:158]: <<< "\x1E+\x01w\a\x01\x00\x15\a\x00�\x01\x01b\eR~U\x00\x00\x00W\x01w\a\x01\x00)\a\x00�\x01\x01b\eR~U\x00\x00ge\x01w\a\x01\x00=\a\x00�\x01\x01b\eR~U\x00\x005o\x01w\a\x01\x00`\x05\x05�\x01\x01\x01\x01cA\x10\x01\x01\x01c2@\x00v\x05\x00Yh%b\x00b\x00re\x00\x00\x02\x01q\x01c&H\x00\x00\x00\e\e\e\e\x1A\x02\aH"
[07:27:07][V][component:199]: Component uart took a long time for an operation (0.36 s).
[07:27:07][V][component:200]: Components should block for at most 20-30ms.```

The yaml:

@syssi
Copy link

syssi commented Apr 13, 2022

@r100gs Could you edit your post and use three backticks (`) to enclose your code blocks?

@syssi
Copy link

syssi commented Apr 13, 2022

@r100gs Please start with:

substitutions:
  device_name: gesamtstrom
  device_description: "Gesamtstrom"
  friendly_name: Stromzaehler

esphome:
  name: "${device_name}"
  comment: "${device_description}"
  platform: ESP8266
  board: d1_mini

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

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pswd
  ap:
    ssid: "${device_name} fallback"
    password: !secret esp_ap_fb

api:
ota:
logger:
  baud_rate: 0
  level: DEBUG

uart:
  - id: uart0
    baud_rate: 9600
    rx_pin: GPIO3
    debug:
      direction: BOTH

sml:
  - id: sml0
    uart_id: uart0

sensor:
  - platform: sml
    sml_id: sml0
    name: "${friendly_name} Zaehlerstand"
    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

And provide some logs again. I'm looking for this block:

[15:49:48][D][sml:076]: OBIS info:
[15:49:48][D][sml:082]:   (XXXXXXXXXXXX) 1-0:96.50.1 [0x******]
[15:49:48][D][sml:082]:   (XXXXXXXXXXXX) 1-0:96.1.0 [0x******]
[15:49:48][D][sml:082]:   (XXXXXXXXXXXX) 1-0:1.8.0 [0x******]
[15:49:48][D][sml:082]:   (XXXXXXXXXXXX) 1-0:16.7.0 [0x******]

It describes all available keys (obis codes) and values. If we know the supported obis codes of your device it's easy to extend the configuration. On page 15 of the manual you can see the UART settings:

https://www.easymeter.com/downloads/products/zaehler/Q3C/q3c_betriebsanleitung_rev_04.pdf

The byte format is (8, N, 1). The uart configuration if your config yaml isn't correct at the moment. 8,N,1 is the default of the uart component. So there are no special settings required.

@syssi
Copy link

syssi commented Apr 13, 2022

@altacoon I tried to understand the different parsers:

https://github.com/BMOD89/esphome_compontens/blob/main/components/d0/d0_parser.cpp
https://github.com/alengwenus/esphome_components/blob/main/components/sml/sml_parser.cpp

And it looks like the d0 component is able to decode ASCII messages (mostly 9600/7E1) vs. the sml component is able to decode binary OBIS messages (mostly 9600/8N1).

See https://wiki.volkszaehler.org/software/sml#sonstige_erkenntnisse

@r100gs
Copy link

r100gs commented Apr 13, 2022

@syssi
ok, I tried to edit my post, but even with three ``` it looks bad
I will try your proposal later.

THX for your help!

@syssi
Copy link

syssi commented Apr 13, 2022

@r100gs The code block must start and end with 3 backticks. Let's assume "*" are backticks it must look like this:

***
my code
***

@r100gs
Copy link

r100gs commented Apr 13, 2022

@r100gs Please start with:

substitutions:
  device_name: gesamtstrom
  device_description: "Gesamtstrom"
  friendly_name: Stromzaehler

esphome:
  name: "${device_name}"
  comment: "${device_description}"
  platform: ESP8266
  board: d1_mini

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

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pswd
  ap:
    ssid: "${device_name} fallback"
    password: !secret esp_ap_fb

api:
ota:
logger:
  baud_rate: 0
  level: DEBUG

uart:
  - id: uart0
    baud_rate: 9600
    rx_pin: GPIO3
    debug:
      direction: BOTH

sml:
  - id: sml0
    uart_id: uart0

sensor:
  - platform: sml
    sml_id: sml0
    name: "${friendly_name} Zaehlerstand"
    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

And provide some logs again. I'm looking for this block:

[15:49:48][D][sml:076]: OBIS info:
[15:49:48][D][sml:082]:   (XXXXXXXXXXXX) 1-0:96.50.1 [0x******]
[15:49:48][D][sml:082]:   (XXXXXXXXXXXX) 1-0:96.1.0 [0x******]
[15:49:48][D][sml:082]:   (XXXXXXXXXXXX) 1-0:1.8.0 [0x******]
[15:49:48][D][sml:082]:   (XXXXXXXXXXXX) 1-0:16.7.0 [0x******]

It describes all available keys (obis codes) and values. If we know the supported obis codes of your device it's easy to extend the configuration. On page 15 of the manual you can see the UART settings:

https://www.easymeter.com/downloads/products/zaehler/Q3C/q3c_betriebsanleitung_rev_04.pdf

The byte format is (8, N, 1). The uart configuration if your config yaml isn't correct at the moment. 8,N,1 is the default of the uart component. So there are no special settings required.

@syssi

This is what I get in log with 8N1:

[10:31:41][W][sml:063]: Checksum error in received SML data.
[10:31:42][D][uart_debug:114]: <<< FF:01:01:62:1B:52:FE:55:FF:FC:B7:1A:01:77:07:01:00:15:07:00:FF:01:01:62:1B:52:FE:55:FF:FE:9F:27:01:77:07:01:00:29:07:00:FF:01:01:62:1B:52:FE:55:FF:FE:FC:44:01:77:07:01:00:3D:07:00:FF:01:01:62:1B:52:FE:55:FF:FF:1B:AF:01:77:07:01:00:60:05:05:FF:01:01:01:01:63:41:B0:01:01:01:63:4D:FF:00:76:05:00:D9:A9:79:62:00:62:00:72:65:00:00:02:01:71:01:63:02:37:00:00:00:1B:1B:1B:1B:1A:02:7C:EA
[10:31:43][D][uart_debug:114]: <<< 1B:1B:1B:1B:01:01:01:01:76:05:00:D9:A9:7A:62:00:62:00:72:65:00:00:01:01:76:01:01:07:45:53:59:51:33:43:0B:06:45:53:59:01:07:1B:37:36:76:01:01:63:9B:94:00:76:05:00:D9:A9:7B:62:00:62:00:72:65:00:00:07:01:77:01:0B:06:45:53:59:01:07:1B:37:36:76:01:72:62:01:65:10:0F:CD:C0:F1:00:77:07:81:81:C7:82:03:FF:01:01:01:01:04:45:53:59:01:77:07:01:01:01:08:00:FF:63:41:B0:72:62:01:65:10:0F:CD:C0:62:1E:52:FC:69:00:00:00:5D:41:D9:AD:E9:01:77:07:01:02:02:08:00:FF:63
[10:31:43][D][uart_debug:114]: <<< B0:72:62:01:65:10:0F:CD:C0:62:1E:52:01:65:00:00:00:6E:01:77:07:01:01:01:08:05:FF:63:41:B0:72:62:01:65:10:0F:CD:C0:62:1E:52:01:65:00:00:00:6F:01:77:07:01:01:01:08:06:FF:63:41:B0:72:62:01:65:10:0F:CD:C0:62:1E:52:01:65:00:00:00:79:01:77:07:01:02:02:08:07:FF:63:41:B0:72:62:01:65:10:0F:CD:C0:62:1E:52:01:65:00:25:D3:09:01:77:07:01:02:02:08:08:FF:63:41:B0:72:62:01:65:10:0F:CD:C0:62:1E:52:01:65:00:00:00:71:01:77:07:01:00:01:07:00:FF:01:01:62:1B:52:FE:55
[10:31:43][W][sml:063]: Checksum error in received SML data.
[10:31:44][D][uart_debug:114]: <<< FF:FC:B8:61:01:77:07:01:00:15:07:00:FF:01:01:62:1B:52:FE:55:FF:FE:9F:D2:01:77:07:01:00:29:07:00:FF:01:01:62:1B:52:FE:55:FF:FE:FC:6C:01:77:07:01:00:3D:07:00:FF:01:01:62:1B:52:FE:55:FF:FF:1C:23:01:77:07:01:00:60:05:05:FF:01:01:01:01:63:41:B0:01:01:01:63:10:05:00:76:05:00:D9:A9:7C:62:00:62:00:72:65:00:00:02:01:71:01:63:1B:24:00:00:00:1B:1B:1B:1B:1A:02:6B:0E
[10:31:45][D][uart_debug:114]: <<< 1B:1B:1B:1B:01:01:01:01:76:05:00:D9:A9:7D:62:00:62:00:72:65:00:00:01:01:76:01:01:07:45:53:59:51:33:43:0B:06:45:53:59:01:07:1B:37:36:76:01:01:63:99:29:00:76:05:00:D9:A9:7E:62:00:62:00:72:65:00:00:07:01:77:01:0B:06:45:53:59:01:07:1B:37:36:76:01:72:62:01:65:10:0F:CD:C2:F1:00:77:07:81:81:C7:82:03:FF:01:01:01:01:04:45:53:59:01:77:07:01:01:01:08:00:FF:63:41:B0:72:62:01:65:10:0F:CD:C2:62:1E:52:FC:69:00:00:00:5D:41:D9:AD:E9:01:77:07:01:02:02:08:00:FF:63
[10:31:45][D][uart_debug:114]: <<< C2:62:1E:52:01:65:00:00:00:6E:01:77:07:01:01:01:08:05:FF:63:41:B0:72:62:01:65:10:0F:CD:C2:62:1E:52:01:65:00:00:00:6F:01:77:07:01:01:01:08:06:FF:63:41:B0:72:62:01:65:10:0F:CD:C2:62:1E:52:01:65:00:00:00:79:01:77:07:01:02:02:08:07:FF:63:41:B0:72:62:01:65:10:0F:CD:C2:62:1E:52:01:65:00:25:D3:0A:01:77:07:01:02:02:08:08:FF:63:41:B0:72:62:01:65:10:0F:CD:C2:62:1E:52:01:65:00:00:00:71:01:77:07:01:00:01:07:00:FF:01:01:62:1B:52:FE:55:FF:FC:B7:85:01:77:07:01
[10:31:45][W][sml:063]: Checksum error in received SML data.
[10:31:46][D][uart_debug:114]: <<< 00:15:07:00:FF:01:01:62:1B:52:FE:55:FF:FE:9E:ED:01:77:07:01:00:29:07:00:FF:01:01:62:1B:52:FE:55:FF:FE:FD:3C:01:77:07:01:00:3D:07:00:FF:01:01:62:1B:52:FE:55:FF:FF:1B:5C:01:77:07:01:00:60:05:05:FF:01:01:01:01:63:41:B0:01:01:01:63:26:E3:00:76:05:00:D9:A9:7F:62:00:62:00:72:65:00:00:02:01:71:01:63:EC:2A:00:00:00:1B:1B:1B:1B:1A:02:C0:8E
[10:31:47][D][uart_debug:114]: <<< 1B:1B:1B:1B:01:01:01:01:76:05:00:D9:A9:80:62:00:62:00:72:65:00:00:01:01:76:01:01:07:45:53:59:51:33:43:0B:06:45:53:59:01:07:1B:37:36:76:01:01:63:49:85:00:76:05:00:D9:A9:81:62:00:62:00:72:65:00:00:07:01:77:01:0B:06:45:53:59:01:07:1B:37:36:76:01:72:62:01:65:10:0F:CD:C4:F1:00:77:07:81:81:C7:82:03:FF:01:01:01:01:04:45:53:59:01:77:07:01:01:01:08:00:FF:63:41:B0:72:62:01:65:10:0F:CD:C4:62:1E:52:FC:69:00:00:00:5D:41:D9:AD:E9:01:77:07:01:02:02:08:00:FF:63
[10:31:47][D][uart_debug:114]: <<< 08:04:FF:63:41:B0:72:62:01:65:10:0F:CD:C4:62:1E:52:01:65:00:00:00:6E:01:77:07:01:01:01:08:05:FF:63:41:B0:72:62:01:65:10:0F:CD:C4:62:1E:52:01:65:00:00:00:6F:01:77:07:01:01:01:08:06:FF:63:41:B0:72:62:01:65:10:0F:CD:C4:62:1E:52:01:65:00:00:00:79:01:77:07:01:02:02:08:07:FF:63:41:B0:72:62:01:65:10:0F:CD:C4:62:1E:52:01:65:00:25:D3:0A:01:77:07:01:02:02:08:08:FF:63:41:B0:72:62:01:65:10:0F:CD:C4:62:1E:52:01:65:00:00:00:71:01:77:07:01:00:01:07:00:FF:01:01
[10:31:47][W][sml:063]: Checksum error in received SML data.
[10:31:48][D][uart_debug:114]: <<< 62:1B:52:FE:55:FF:FC:B3:B4:01:77:07:01:00:15:07:00:FF:01:01:62:1B:52:FE:55:FF:FE:9E:0D:01:77:07:01:00:29:07:00:FF:01:01:62:1B:52:FE:55:FF:FE:FB:1D:01:77:07:01:00:3D:07:00:FF:01:01:62:1B:52:FE:55:FF:FF:1A:8A:01:77:07:01:00:60:05:05:FF:01:01:01:01:63:41:B0:01:01:01:63:87:48:00:76:05:00:D9:A9:82:62:00:62:00:72:65:00:00:02:01:71:01:63:1E:5E:00:00:00:1B:1B:1B:1B:1A:02:CE:BC
[10:31:49][D][uart_debug:114]: <<< 1B:1B:1B:1B:01:01:01:01:76:05:00:D9:A9:83:62:00:62:00:72:65:00:00:01:01:76:01:01:07:45:53:59:51:33:43:0B:06:45:53:59:01:07:1B:37:36:76:01:01:63:2E:77:00:76:05:00:D9:A9:84:62:00:62:00:72:65:00:00:07:01:77:01:0B:06:45:53:59:01:07:1B:37:36:76:01:72:62:01:65:10:0F:CD:C6:F1:00:77:07:81:81:C7:82:03:FF:01:01:01:01:04:45:53:59:01:77:07:01:01:01:08:00:FF:63:41:B0:72:62:01:65:10:0F:CD:C6:62:1E:52:FC:69:00:00:00:5D:41:D9:AD:E9:01:77:07:01:02:02:08:00:FF:63
[10:31:49][D][uart_debug:114]: <<< C6:62:1E:52:01:65:00:00:00:6E:01:77:07:01:01:01:08:05:FF:63:41:B0:72:62:01:65:10:0F:CD:C6:62:1E:52:01:65:00:00:00:6F:01:77:07:01:01:01:08:06:FF:63:41:B0:72:62:01:65:10:0F:CD:C6:62:1E:52:01:65:00:00:00:79:01:77:07:01:02:02:08:07:FF:63:41:B0:72:62:01:65:10:0F:CD:C6:62:1E:52:01:65:00:25:D3:0A:01:77:07:01:02:02:08:08:FF:63:41:B0:72:62:01:65:10:0F:CD:C6:62:1E:52:01:65:00:00:00:71:01:77:07:01:00:01:07:00:FF:01:01:62:1B:52:FE:55:FF:FC:B1:96:01:77:07:01
[10:31:49][W][sml:063]: Checksum error in received SML data.

@syssi
Copy link

syssi commented Apr 13, 2022

@r100gs It looks like your IR receiver works fine. The 1B:1B:1B:1B:01:01:01:01 is the preamble of a binary obis message: https://wiki.volkszaehler.org/software/sml#beispiel_2easymeter_q3b

It looks like the sml component is unable to decode the message. Let's try to increase the rx_buffer_size because the message of your smartmeter is pretty big:

uart:
  - id: uart0
    baud_rate: 9600
    rx_pin: GPIO3
    rx_buffer_size: 512
    debug:
      direction: BOTH

@r100gs
Copy link

r100gs commented Apr 13, 2022

@syssi
ok, I tried it, now I cannot access the log via esphome anymore.
This evening I will try to turn the device off and see if it will work again.
A strage thing is: the device is marked online in my esphome

INFO Starting log output from gesamtstrom.local using esphome API WARNING Can't connect to ESPHome API for gesamtstrom.local: Error resolving IP address: [Errno -2] Name or service not known INFO Trying to reconnect to gesamtstrom.local in the background

@altacoon
Copy link

@altacoon I tried to understand the different parsers:

https://github.com/BMOD89/esphome_compontens/blob/main/components/d0/d0_parser.cpp https://github.com/alengwenus/esphome_components/blob/main/components/sml/sml_parser.cpp

And it looks like the d0 component is able to decode ASCII messages (mostly 9600/7E1) vs. the sml component is able to decode binary OBIS messages (mostly 9600/8N1).

See https://wiki.volkszaehler.org/software/sml#sonstige_erkenntnisse

@syssi Thanks for this help. Today the IR reader (Hichi IR) was delivered. Tomorrow I will try it together with the sml component from BMOD89. I will come back and report.

@BMOD89
Copy link

BMOD89 commented Apr 13, 2022

@syssi Thanks for this help. Today the IR reader (Hichi IR) was delivered. Tomorrow I will try it together with the sml component from BMOD89. I will come back and report.

@altacoon from your picture here #1041 (comment), I would guess that you have this meter: https://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/emh-ehz-k

If I understand the manual (https://emh-metering.com/wp-content/uploads/2020/08/eHZ-K-BIA-D-1-20.pdf), you will need the sml component from here: https://github.com/alengwenus/esphome_components.git

@r100gs
Copy link

r100gs commented Apr 14, 2022

@syssi
I turned of my esp and nothing,
If I use the parameter "rx_buffer_size: 512" I cannot get a log via esphome frontend.
If I remove "rx_buffer_size: 512" everything works again.

@syssi
Copy link

syssi commented Apr 14, 2022

@r100gs If you increase the RX buffer just a bit does it boot this time? It's possible 512 was too much. I counted the bytes of a message yesterday. It was around 480 bytes. My idea was to increase the buffer size to the message size to be sure the message does fit into the buffer completely. I will try to check the custom component (sml) in more detail to get a better understanding how big messages are handled.

@r100gs
Copy link

r100gs commented Apr 14, 2022

@syssi
I tried with 380 but nothing. It seems only 256 standard is working

@syssi
Copy link

syssi commented Apr 14, 2022

@r100gs Please ignore my rx_buffer_size suggestion. I've tested the sml component: The implementation is able to append multiple RX buffers to a complete sml_data_ message. Could you create an issue here, provide the payload / log from above and ask for device support? It looks like the sml_parser is unable to handle the Q3C messages.

@altacoon
Copy link

I come back with the Hichi-IR-reader installed. And thanks to you all @syssi, @BMOD89, @alengwenus - it works!
emh_K_mit hichi_ir_lesekopf
I have attached a picture from the ESPHome-logger. The energy "Zaehler_Bezug" is correct, the active power "Momentanleistung" I still have to check, may be I have to adjust the multiply factor in my yaml.
Auszug vom logger

Please find the corresponding yaml (without the introducing lines showing my credentials). The yaml reads two differnt electricity meters. The bidirectional meter (EMH) by reading the sml protocol of its D0 interface. And a second meter which measures the generated energy of my solar panels by using ESPHome's pulse meter sensor.

external_components:
  source:
    type: git
    url: https://github.com/alengwenus/esphome_components.git
    ref: main
  components: [sml]

captive_portal:

uart:
  id: uart_bus
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600
  rx_buffer_size: 2048
  data_bits: 8
  stop_bits: 1
  parity: NONE

sml:
  id: mysml
  uart_id: uart_bus
  
sensor:
  - platform: sml
    name: "Zaehler_Bezug"
    sml_id: mysml
    obis_code: "1-0:1.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 1
    filters:
     - multiply: 0.0001
      
  - platform: sml
    name: "Momentanleistung"
    sml_id: mysml
    obis_code: "1-0:16.7.0"
    unit_of_measurement: W
    accuracy_decimals: 1
    device_class: "power"

  - platform: pulse_meter
    pin: D2
    unit_of_measurement: W
    name: "Einspeisung_Leistung (Aktuell)"
    accuracy_decimals: 0
    device_class: "power"
    filters:
     - multiply: 6
     - heartbeat: 10s
    icon: 'mdi:flash'
    # Die id ist hier nicht zwingend erforderlich. Nur dann, wenn kein Name angegeben wurde.
    id: einspeisung_w
    
  - platform: total_daily_energy
    name: "Einspeisung_Energie (Tag)"
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh
    # Die power_id muss bei diesem Sensor angegeben werden, damit er richtig integrieren kann.
    power_id: einspeisung_w  

#  - platform: template
#    name: saldo
#    lambda: |-
#     return '{{(states.sensor.bezug_leistung_aktuell.state | float ) + (states.sensor.einspeisung_leistung_aktuell.state | float)}}'
#    unit_of_measurement: W
    
  
# diese Zeile ist erforderlich, damit der Sensor total_daily_energy täglich zurückgesetzt wird    
time:
  - platform: homeassistant
    id: homeassistant_time    

Thanks to the advice of @BMOD89 I swapped to the external sml-component from @alengwenus. Thank you for this! And many thanks to @alengwenus for your excellent work!

@andreas-bulling
Copy link

This has also worked like a charm for me - thanks a lot, in particular to @altacoon, who's esphome configuration worked out of the box with only little adaptations to my setup.

For those of you interested: I have used a Sonoff SV, which conveniently provides 3,3V onboard for the IR sensor head, has three GPIOs (two of which I used for UART), Wifi, and can be powered by up to 24V DC. In my case 23,3V come from our Siedle mains rectifier. I put the Sonoff into a small plastic case that I attached to the smart meter. This makes for a small, clean, and self-sufficient setup - no power supply, Raspberry Pi or similar required.

@evlo
Copy link

evlo commented Aug 8, 2022

@altacoon hmmm, i have hichi too, i bough wervison with esp01 with tasmota in it, in tasmota head reads things, i can even read the garbage if i point head on the white paper or mirror etc. But with esphome it does never read anything.

I think this

logger:
  baud_rate: 0
  level: DEBUG

uart:
  id: uart_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 300
  debug:
    direction: BOTH
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);
  data_bits: 8
  parity: NONE

should log all the traffic, right?

rest of it (does not work for me)

sml:
  id: smlZpaZe312
  uart_id: uart_bus

sensor:
  - platform: sml
    name: "Total energy"
    sml_id: smlZpaZe312
    obis_code: "1-0:1.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 3
    device_class: energy
    state_class: total_increasing

interval:
  - interval: 10sec
    then:
      - uart.write: [0x2F, 0x3F, 0x21, 0x0D, 0x0A]

@syssi
Copy link

syssi commented Aug 9, 2022

@evlo Some ideas:

  1. Are you sure about the baudrate? Do you use the same baudrate as tasmota here?
  2. Are you sure about the rx_pin and tx_pin? Could you provide a link to the tasmota template of your device? So we could have a look at the list of the used/assigned GPIOs.
  3. Are you sure the traffic contains linebreaks? If it's binary data you shouldn't use the delimiter: "\n". Please remove these lines:
    after:
      delimiter: "\n"
    sequence:
      - lambda: UARTDebug::log_string(direction, bytes);

ESPHome will use the default behavior afterwards: Print raw data (bytes in hex).

@evlo
Copy link

evlo commented Aug 9, 2022

  1. Baud Rate is what I used with tasmota, 9600 should work too, I tried that, and no luck.
  2. No
    {"NAME":"Generic","GPIO":[1,1,1,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":18} - it is configured as sonoff basic (i guess default device for tasmota)
    image

you are right that first step is to read anything with the esphome and then i can focus on why I can't read the meter.
unfortunately i only have binary tasmota firmware for the device, i thought it is because of the inclusion of scripting (https://tasmota.github.io/docs/Smart-Meter-Interface/#meter-definition), but might be some gpio stuff too

  1. Not sure about line breaks and definitely not the right call for testing just to read anything

I think this is also better to try to read some bogus data at least from the mirror reflection of sent data

interval:
  - interval: 1sec
    then:
      - uart.write: [0x2F, 0x3F, 0x21, 0x0D, 0x0A]

With this script in tasmota i do receive response from the meter.

>D
>B
->sensor53 r
>M 1
+1,3,o,0,300,ZE312,1,100,2F3F210D0A

(yes, that format is rather crazy and imo not really what is described n tasmota docs, but seems 300 baud rate, rx=gpio3, tx=gpio1)

@evlo
Copy link

evlo commented Aug 9, 2022

So I do get gibberish traffic in esphome when trying to just capture something

[10:31:25][D][uart_debug:158]: >>> "/?!\r\n"
[10:31:25][D][uart_debug:158]: <<< "\xFA\x8Fj\n"
[10:31:26][D][uart_debug:158]: >>> "/?!\r\n"
[10:31:26][D][uart_debug:158]: >>> "/?!\r\n"
[10:31:26][D][uart_debug:158]: <<< "\xFF\x8F\x8F"
[10:31:27][D][uart_debug:158]: >>> "/?!\r\n"
[10:31:27][D][uart_debug:158]: <<< "\xFE\xFF"
[10:31:27][D][uart_debug:158]: >>> "/?!\r\n"
[10:31:28][D][uart_debug:158]: >>> "/?!\r\n"
[10:31:28][D][uart_debug:158]: >>> "/?!\r\n"
[10:31:29][D][uart_debug:158]: >>> "/?!\r\n"
[10:31:29][D][uart_debug:158]: <<< "\xFA\x8Fj\n"
[10:31:29][D][uart_debug:158]: >>> "/?!\r\n"

(yes i forgot to remove the string thing),
but clearly uart interface data are "seen" in esphome and esphome also can use the interface to send data

@cubertt
Copy link

cubertt commented Sep 7, 2022

Thanks to all the info and work of you all, i got it to work:

Esphome installed on hass.io on Raspberry 4:

using two ir reading devices (HICHI) attached to 3,3 v, Ground and ports/GPIOs 23 and 15 (only rx, tx is not connected) of a
ESP32 Lan WT32-ETH01 (ESP32 with lan instead of wlan, flashing: [https://community.home-assistant.io/t/how-i-installed-esphome-on-the-wt32-eth01/359027]

Hardware TWO easymeter q3a:
This is my espdevice.yaml:

esphome:
  name: esp32lan-stromzaehler
  platform: ESP32
  board: esp-wrover-kit
# Enable Home Assistant API
api:
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_IN
  phy_addr: 1
  power_pin: GPIO16
  
mqtt:
  broker: 192.168.1.122
  username: mptt
  password: mptt
  discovery: False
  discovery_retain: False
  birth_message:
    topic: $devicename/status
    payload: online
  will_message:
    topic: $devicename/status
    payload: offline
  on_message:
    - topic: $devicename/ota_mode
      payload: 'ON'
      then:
        - mqtt.publish:
            topic: $devicename/ota_mode_status
            payload: "active"
    - topic: $devicename/sleep_mode
      payload: 'ON'
      then:
        - mqtt.publish:
            topic: $devicename/ota_mode_status
            payload: "disabled"


logger:

ota:
  password: password

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

web_server:
  port: 80
  # Enable fallback hotspot (captive portal) in case wifi connection fails

uart:
  - id: uart_bus1
#    tx_pin: GPIO14
    rx_pin: GPIO36
    baud_rate: 9600
    rx_buffer_size: 2048
    data_bits: 8
    stop_bits: 1
    parity: NONE
  - id: uart_bus2
#    tx_pin: GPIO16
    rx_pin: GPIO15
    baud_rate: 9600
    rx_buffer_size: 2048
    data_bits: 8
    stop_bits: 1
    parity: NONE
sml:
 - id: mysml
   uart_id: uart_bus1
 - id: mysml2
   uart_id: uart_bus2
  
sensor:
  - platform: sml
    name: "StromBezug"
    sml_id: mysml2
    obis_code: "1-0:1.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 1
  - platform: sml
    name: "Stromlieferung"
    sml_id: mysml2
    obis_code: "1-0:2.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 1
  - platform: sml
    name: "Produktion_PV"
    sml_id: mysml
    obis_code: "1-0:2.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 2
    filters:
     - multiply: 0.0000001
  - platform: sml
    name: "leistungPVL2"
    sml_id: mysml
    obis_code: "1-0:36.7.0"
    unit_of_measurement: W
    accuracy_decimals: 1
    device_class: "power"
  - platform: sml
    name: "leistungPVL3"
    sml_id: mysml
    obis_code: "1-0:56.7.0"
    unit_of_measurement: W
    accuracy_decimals: 1
    device_class: "power"
  - platform: sml
    name: "leistungPV1"
    sml_id: mysml
    obis_code: "1-0:76.7.0"
    unit_of_measurement: W
    accuracy_decimals: 1
    device_class: "power"

# diese Zeile ist erforderlich, damit der Sensor total_daily_energy täglich zurückgesetzt wird    
time:
  - platform: homeassistant
    id: homeassistant_time

i get more info from the meter on port GPIO15, because i have placed the IR reader on a different place (D0), the other one is attached only to the INFO LED instead of D0.

Now i need to define the right sensors in homeassistant!

@itsieber
Copy link

I get Answer, but no interpretation of the the values. Any ideas?

`esphome:
name: landisgyr

esp8266:
board: esp01_1m

Enable logging

logger:
level: VERBOSE
baud_rate: 0

Enable Home Assistant API

api:
encryption:
key: !secret encryption

ota:
password: "7dac34a37708cdba14e7dc977b2fdf1a"

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
use_address: 192.168.113.150

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: "Zaehlersensor Fallback Hotspot"
password: "6AJ4XMUvYrsH"

captive_portal:

Example configuration entry

uart:

  • id: uart_bus
    rx_pin: GPIO3
    tx_pin: GPIO1
    baud_rate: 300
    data_bits: 8
    parity: NONE
    stop_bits: 1
    rx_buffer_size: 2048
    debug:
    direction: BOTH
    dummy_receiver: false
    after:
    delimiter: "\n"
    sequence:
    - lambda: UARTDebug::log_string(direction, bytes);
    sml:
    id: mysml
    uart_id: uart_bus

interval:

  • interval: 30sec
    then:

    Trigger with /?!\r\n.

    • uart.write:
      id: uart_bus
      data: [0x2F, 0x3F, 0x21, 0x0D, 0x0A]

- delay: 1s

- uart.write:

id: uart_bus

data: [0x06, 0x30, 0x35, 0x30, 0x0D, 0x0A]

sensor:

  • platform: sml
    name: "Total energy"
    obis_code: "1-0:1.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 1
    device_class: energy
    state_class: total_increasing
    filters:
    • multiply: 0.0001
  • platform: sml
    name: "Total energy T1"
    obis_code: "1-0:1.8.1"
    unit_of_measurement: kWh
    accuracy_decimals: 1
    device_class: energy
    state_class: total_increasing
    filters:
    • multiply: 0.0001
  • platform: sml
    name: "Total energy T2"
    obis_code: "1-0:1.8.2"
    unit_of_measurement: kWh
    accuracy_decimals: 1
    device_class: energy
    state_class: total_increasing
    filters:
    • multiply: 0.0001
  • platform: sml
    name: "Total energy Lieferung"
    obis_code: "1-0:2.8.0"
    unit_of_measurement: kWh
    accuracy_decimals: 1
    device_class: energy
    state_class: total_increasing
    filters:
    • multiply: 0.0001
  • platform: sml
    name: "Total energy Lieferung T1"
    obis_code: "1-0:2.8.1"
    unit_of_measurement: kWh
    accuracy_decimals: 1
    device_class: energy
    state_class: total_increasing
    filters:
    • multiply: 0.0001
  • platform: sml
    name: "Total energy Lieferung T2"
    obis_code: "1-0:2.8.2"
    unit_of_measurement: kWh
    accuracy_decimals: 1
    device_class: energy
    state_class: total_increasing
    filters:
    • multiply: 0.0001

text_sensor:

  • platform: sml
    name: "Manufacturer"
    obis_code: "129-129:199.130.3"
    format: text`

Serial Console:

[21:12:46][D][uart_debug:158]: >>> "/?!\r\n" [21:12:47][D][uart_debug:158]: <<< "\xAF\xCCGZ\xB4\\\xB2ZMD\xB1\xB20APt.G03\x8D\n" [21:12:49][D][uart_debug:158]: <<< "\x82\xC6.\xC6(00000000\xA9\x8D\n" [21:12:50][D][uart_debug:158]: <<< "0.0(93\xB2\xB1\xB8909\xA9\x8D\n" [21:12:51][D][uart_debug:158]: <<< "\xB1.\xB8.\xB1(003\xB1695\xAA\xEB\xD7\xE8\xA9\x8D\n" [21:12:51][D][uart_debug:158]: <<< "\xB1.\xB8.\xB2(00\xB7\xB8\xB856\xAA\xEB\xD7\xE8\xA9\x8D\n" [21:12:52][D][uart_debug:158]: <<< "\xB2.\xB8.\xB1(00\xB73\xB1\xB1\xB2\xAA\xEB\xD7\xE8\xA9\x8D\n" [21:12:53][D][uart_debug:158]: <<< "\xB2.\xB8.\xB2(00\xB2\xB13\xB1\xB2\xAA\xEB\xD7\xE8\xA9\x8D\n" [21:12:54][D][uart_debug:158]: <<< "\xB1.\xB8.0(0\xB1\xB1055\xB1\xAA\xEB\xD7\xE8\xA9\x8D\n" [21:12:54][D][uart_debug:158]: <<< "\xB2.\xB8.0(009\xB4\xB4\xB2\xB4\xAA\xEB\xD7\xE8\xA9\x8D\n" [21:12:55][D][uart_debug:158]: <<< "\xC3.\xB2.\xB1(\xB10-0\xB8-\xB2\xB7\xA0\xB10:\xB10\xA9\x8D\n" [21:12:55][D][uart_debug:158]: <<< "!\x8D\n" [21:12:56][D][uart_debug:158]: <<< "\x03\xF0"

@mscifm
Copy link

mscifm commented Nov 29, 2022

Hi guys, i had setup your examples on a NodeMCU8266 with TCRT5000 IR Sensor (just the receiver, the sender is removed). The SmartMeter is an ISKRA MT691 with INFO enabled. Running esphome 2022.11.3 with the following code

`external_components:

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

web_server:
port: 80

Enable fallback hotspot (captive portal) in case wifi connection fails

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: "Smartmeter Fallback Hotspot"
password: "secretkey"

captive_portal:

uart:

  • id: uart0
    baud_rate: 9600
    rx_buffer_size: 2048
    rx_pin: GPIO3
    debug:
    direction: BOTH

    #after:
    #delimiter: "\n"

    sequence:

    - lambda: UARTDebug::log_string(direction, bytes);

sml:

  • id: sml0
    uart_id: uart0

sensor:

  • platform: sml
    sml_id: sml0
    name: "${friendly_name} Zaehlerstand"
    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`

Upload is OK, but I can get any useful information

Logging shows:

[D][uart_debug:114]: <<< FE:FE:1E:01:01:01:FE:D0:FE:4F:4A:80:E2:80:F2:FE:01:FE:C0:40:41:41:4A:24:EC:28:49:F3:4F:00:04:54:FF:FC:FB:F3:40:79:41:4A:49:FC:FE:E3:C7:7E:FE:D0:FE:EF:6F:80:E2:80:F2:FE:28:FF:E0:EC:28:49:D3:CF:00:04:54:1D:28:00:E2:8F:FF:F3:C0:79:50:A9:8A:FF:28:00:E0:BB:01:01:01:01:01:01:04:C9:53:CF:01:FF:28:00:E0:40:FF:F0:01:01:0F:0A:01:E9:53:CF:00:04:F4:EF:FC:E0:28:00:01:08:00:FF:0F:3C:40:50:E2:BF:F3:FF:AF:FF:86:40:28:00:10:0F:00:FF:F0:E2:B6:05:53:C0:FE:E0:40:40 [21:05:12][V][component:200]: Component sml took a long time for an operation (0.05 s). [21:05:12][V][component:201]: Components should block for at most 20-30ms.

The IR is mounted on the optical Interface in the upper right corner of the Smartmeter.

Did someone has similar issues?

@r100gs
Copy link

r100gs commented Dec 8, 2022

Yes, here its the same

@Hohenloherin
Copy link

@r100gs
Did you get it running finally? I would like to learn how you managed it.

@r100gs
Copy link

r100gs commented Jan 12, 2023 via email

@github-actions github-actions bot locked and limited conversation to collaborators May 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.