I am trying to integrate/read the data from my two power meters into openhab. One of the power meters is used for measuring the produced electritiy in the PV system. The other meter is measuring the connection to the public grid in bith directions. It counts with two separate counter the energy consumed from the grid and the energy sold to the grid. The first meter is a Hager EHZ361LA which is sending data every 1-4 seconds in D0 format without the need to request the data by sending a command to the meter. The second meter is an EMH eHZ FW8… modell which is also sending in intervals without the need to request that output but this meter is sending in SML format.
Last weekend I dot two optical interfaces for the connection to the meters from volkszaehler.org and connected them to the meters and the Raspberry Pi2 which is also running openhab. Both interfaces work and with minicom I can see the D0 ASCII or SML binary data that is being received. First I tried the IEC 62056-21 Binding in openhab but could not get it to initialize any items. I found IEC 62056-21 timeout thread on knx-user-forum which exactly describes the messages i see in openhab log but I think my meter is simple using the discussed Mode D instead of the implemented Mode C while the TO in the thread was using an SML meter.
In minicom with an 9600 8N1 connection I can see the data repeat every few seconds in the same format:
/HAG5eHZ010C_EHZ1NA12
… etc. (there are more OBIS-values in the 1-0:96:50.0*-range, in which i can not find any purpose/meaning)
Because I could not get the binding (with different combination of cfg-settings) to work I reverted back to read the data from the interface and interpret it with a bash script in a 1-minute cronjob. The found values (total consumed kwh, current power produced W) are being send to openhab via curl POST to the item-state. But of course I would prefer to use a proper openhab binding with direct update in openhab.
For the second meter I found SMLReader Binding which has been moved to New Openhab Pull Request but I could not find a Build (JAR-File) anywhere to download and test it. So I also read the meter with a bash script and simple parse the found hex data on 3 different byte-offset positions into decimal numbers and send those to openhab also via curl POST.
Does anyone have further ideas on how to use the IEC 62056-21 binding or where to find a version of SMLReader to test (my openhab installation is running on 1.7.1)?
I’ve also tested the Binding on Beaglebone Black, Ubuntu 14.04 LTS, volkszaehler IR TTL Reader on ttyO1 and an ISKRA MT681 SML Power Meter. I’ve got the following Stacktrace:
[ERROR] [.service.AbstractActiveService] - Error
while executing background thread SmlReader Refresh Service java.lang.ClassCastException:
org.openmuc.jsml.structures.Unsigned32 cannot be cast to org.openmuc.jsml.structures.Integer32
at org.openhab.binding.smlreader.internal.SmlValue.getValue(SmlValue.java:145)~[na:na]
at org.openhab.binding.smlreader.internal.SmlValue.toString(SmlValue.java:114)~[na:na]
at org.openhab.binding.smlreader.internal.SmlDevice.printInfo(SmlDevice.java:104) ~[na:na]
at org.openhab.binding.smlreader.internal.SmlDevice.populateValueCache(SmlDevice.java:210) ~[na:na]
at org.openhab.binding.smlreader.internal.SmlDevice.readValues(SmlDevice.java:267) ~[na:na]
at org.openhab.binding.smlreader.internal.SmlReaderBinding.execute(SmlReaderBinding.java:98) ~[na:na]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156)~[na:na]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) ~[na:na]
I’m not a Programmer, so can you provide a solution/fix for this, please.
My 2. comment: The param “smlreader:refresh=60” in openhab.cfg means seconds, but in the code, it means milliseconds! Can you also check this, please!
Thanks in advance!
Sorry for the delay, but from private and professional reasons i’ve currently no time to have a look at the plugin. I’ll fix the issues as soon as posssible and provide a new version…
Hi,
if I am wrong, pls excuse, but what I did with my external power meter was similar. I used the exec binding to execute a bash script every minute.
The returned value (Number item) was stored via mysql persistence in a database.
Same I did for gas- and water consumption.
Cheers
Björn
I merged your plugin against my local source checkout of OH 1.8.2 and compiled it, which worked quite well. I have problems though to see any output in the logs for this plugin, even though i have gnu.io.rxtx.SerialPorts=/dev/ttyUSB0 set.
I also tried to build from source by myself and found out that there was some configuration stuff missing. The bundle was not executing anything!
I created a PR for this
If someone is interrested, please Install it from the Market (install market Extensions and Filter addons for “market”, since 2.1.0 Snapshot).
Amy Feedback is appreciated!