Read Out Smart Meter over Serial Port?

1,460 views
Skip to first unread message

n.schn...@googlemail.com

unread,
Apr 4, 2013, 1:33:29 AM4/4/13
to ope...@googlegroups.com
Good morning,

i wanted to ask, whether someone has tried to connect a optical head for a Smart Meter to the Serial port of a raspberry pi and parse the actual power consumption and the counter value? I made some changes and be able get an input string with a minicon connection, but openhab tells me, that it can't open the port. Has someone done this successfully already, or has an idea to parse the binary string to useful values? As additional information, i use the IR Head os Volkszaehler.org with an EHZ SmartMeter (http://wiki.volkszaehler.org/hardware/controllers/ir-schreib-lesekopf).

thanks in advance

Norbert 

Kristian

unread,
Apr 9, 2013, 4:22:53 AM4/9/13
to ope...@googlegroups.com
Seems interesting, tell me if you make any progress. 
I'll at some point try to read the power meter using CurrentCost EnviR with an optical reader. 

Hopefully this is possible using the openhab serial binding.. 

Kristian

n.schn...@gmail.com

unread,
Jun 13, 2013, 4:37:07 PM6/13/13
to ope...@googlegroups.com
Hi,

you can have a look here:
there were two working examples with a different base.

regards
Norbert

kristian....@gmail.com

unread,
Jun 18, 2013, 8:32:38 AM6/18/13
to ope...@googlegroups.com
Thanks Norbert!

I have solved it using a bash script reading my CurrentCost (from /dev/ttyUSB0) and pushing the values to openhab over REST api. 

It works very well. I should however at some point tweak the script and count an average for several samples, since at the moment it pushes the power values at about 6 sec intervals. It causes unnecessary load for openHAB.

Best regards,
Kristian

Yannick Hein

unread,
Aug 10, 2014, 8:06:09 PM8/10/14
to ope...@googlegroups.com, n.schn...@googlemail.com
Hey all,

it's been a while with no news on this topic. Well, Good news everyone! I made a very simple sml binding which reads power values in the SML format from a serial port (this may be an optical reader for USB or RS232 for example, see www.volkszaehler.org for more information). No need to use scripting anymore.

Unfortunately I am not sure how much more time I can spend into development. I would be very happy to hand my work over to someone who wants to test and maybe evolve and release the binding. If you are interested, take a look into the attached sources (contains a compiled binding addon jar under target). The binding is based on the serial binding and adds some SML parsing.

The corresponding items look like this:

Number Power_EnergyToPlant      "EnergyToPlant: [%s]" {sml="/dev/ttyUSB0:ENERGYTOPLANT"}
Number Power_EnergyFromPlant    "EnergyFromPlant: [%s]" {sml="/dev/ttyUSB0:ENERGYFROMPLANT"}
Number Power_CurrentUsage       "CurrentUsage: [%s]" {sml="/dev/ttyUSB0:CURRENTPOWER"}


TODO: does not unload correctly on config refresh.
More TODOs in the code...

Enjoy!

PS: don't forget to add something like "-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0 " to your OpenHAB startup script, see Serial Binding!
org.openhab.binding.sml.zip

Yannick Hein

unread,
Aug 12, 2014, 6:11:16 AM8/12/14
to ope...@googlegroups.com, n.schn...@googlemail.com
Hi,

I did some further testing and encountered two difficulties:

1. I have a two-direction power meter and a photovoltaic generator. The current power reading can be sort of positive or negative (to the plant or from the plant), but the transmitted value (like the value visible on the power meter) are always positive. I'd like to know how others with a two-direction power meter can distinguish between the two current flows.

2. The sml binding works fine when starting OpenHAB from the shell, but I use the Synology Package to run it on my DS213j. When I start it using the Synology Package (using the start_runtime.sh script), the serial port is not recognized. I assume some access right problems with the OpenHAB user? In the shell, I am root. If this is the problem, how do I fix it?

Thx for any help!


Am Donnerstag, 4. April 2013 07:33:29 UTC+2 schrieb n.schn...@googlemail.com:

karsten.k...@gmail.com

unread,
Aug 12, 2014, 7:11:27 AM8/12/14
to ope...@googlegroups.com, n.schn...@googlemail.com
check the serial binding description - the connection to the serial port has to be included in the SH as well.

Cheers
Karsten

Yannick Hein

unread,
Aug 12, 2014, 11:28:24 AM8/12/14
to ope...@googlegroups.com, n.schn...@googlemail.com
I did that "-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0". I even added the openHab user to the Administrator group, does not work. When I launch the start_runtime.sh from shell as root, it is working, so I assume a problem with the user rights. How do I check or grant access to a serial port to a user in Linux? For Linux beginners, please...

Peter Kreutzer

unread,
Sep 6, 2014, 2:03:22 AM9/6/14
to ope...@googlegroups.com
Hi Norbert,

Have you tried this binding?
It also uses the volkszaehler optical reader

https://github.com/openhab/openhab/wiki/IEC-62056---21-Meter-Binding

I have connected it to my Landis & Gyr meter ZMD120AR connected with IR-Reader RS232


/peter

Reply all
Reply to author
Forward
0 new messages