I include an example code that extracts the momentary power of an electrical smart meter. It targets boards with at least two serial ports. The example code expects an optical head of a meter connected to Serial 1 and computer to Serial (adjust when necessary).
Download and install the libSML.zip below in Arduino IDE via Sketch -> Include Library -> Add .ZIP Library
Then have a look at Examples -> libSML -> SML_GetInstantaneousPowerValue libSML.zip (68.3 KB)
Ich glaub wir können Deutsch schreiben!
mein Zähler ist ein EMH typ eHZ-K....
da hast du ja auch schon erfahrung damit!
bin beim Programieren keine grosse leuchte
und such nach einer stabileren möglichkeit.
Dachte deine Lib macht es mir einfacher und ich kann einfach
bestimmte Parameter abfragen.
bisher verwende ich 2 ESP32 um 2 zähler auszuwerten.
die Daten werden auf Thingspeak hochgeladen.
Einer schreibt auch per UDP auf einen anderen ESP der mit ĂĽberschuss
einen Akku lädt. nur ist die übertragung nicht gerade stabil.
Let's keep in English, so that other readers of this thread can follow as well.
The lib is not mine, it is from https://github.com/volkszaehler/libsml
I just adapted it to work with Arduino environment and simplified the output to print out only the momentary power.
What you could try first would be to test what your meter outputs at all - for this, use any terminal program, e.g. hTerm to look at the raw packets.
Alternatively, especially if you are on Linux, build yourself a sml_server from GitHub - volkszaehler/libsml: Implementation in C of the Smart Message Language (SML) protocol and let it run and parse all SML messages for you. You would start it, assuming you are using USB-serial adapter at /dev/ttyACM0, with:
ok i checked it, there are no datas like
L1,2,3 Power from my EMH typ eHZ-K....
„Vollständiger Datensatz“ give only 1.8.x
and 2.8.x datas out and the momentary power
thanks for help
That is what I thought - you can only get the data out of your meter that the meter is "voluntarily" outputting via SML.
If you wish, you could try to contact your electricity company and query if it would be possible for them to enable transmitting further messages for you.