Closed Qhilm closed 8 months ago
i am aware that libsml should be usable on esp32, but afaik nobody here does that, and even less using "ESPhome" or "Home Assistant".
they seem to have their own sml implementation: https://github.com/esphome/esphome/blob/dev/esphome/components/sml/sml.cpp
so some more work would be needed to include libsml there.
i suggest you ask at "ESPhome" instead, asking if they can include libsml, or rather you can just look at their code yourself and see if you can adapt it to use libsml internally.
a web search says that somebody adapted libsml for arduino, which should then build for esp, you could start with that: https://forum.arduino.cc/t/libsml-parsing-smart-meter-language-protocol/1149684
I ended up implementing a simplified version of the workaround for the WS7412 power meter that works for me: I'm taking the absolute value of each measurement, without consideration for any serial numbers. A bit raw, but it works for me.
Adapting libsml for ESP32 seems very much overkill considering there is a working sml implementation. I had hopes it was simple, but that was naive from my part I think.
Even though ESPhome now has [SML support](# https://github.com/esphome/esphome-docs/blob/current/components/sml.rst), it does not have a specific workaround I need for my WS7412.1.
Hence my question: can I replace this ESPhome yaml (for the ESPHome built-in SML support):
with
as a drop in replacement? Or is it more complex than this?
I intend to test this, but I wanted to hear if someone can say I am completely on the wrong track here and it will not work at all like that, I can try to reproduce the workaround either in ESPhome or Home Assistant yaml while using the built-in SML support from ESPHome.
This would be with ESPhome 2023.12.9 and Home Assistant 2024.01.1.