SML Reader - how to integrate

@msteigenberger
I’ve upgrade from my last installation of ”SML Reader Binding“ to the new one “Meter Reader Binding”.
With this step I’ve recognize a different for the same use.

I run openhab 2.x in a docker container.
To get access to my USB SML Reader I’ve setup an symlink (udev rule) to ttyUSB1.

In the past (with the SML Reader Binding) it was enough to link the device to the container with the argument

--device=/dev/<symlink>

But now with the new “Meter Reader Binding” this only works if I link directly to ttyUSB like

--device=/dev/ttyUSB1

If I still want to use my symlink within the container I need the additional argument

-e EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/<symlink>"

But this is only documantated for symlinks in openhab 1.x here.
And in my old configuration the “SML Reader Bindiung” works the symlink without the additional JAVA Argument…
I’m not good enough to understand why … But maby someone need the knowledge for his own configuration.
Or, maby, it is a bug in the “Meter Reader Binding” :confused:

@portboy: Formerly the binding just set this property by itself. But this caused problems when using more than one serial port, so I simply removed it to check whether the problem was fixed (yes).

I changed it to support multiple ports now (at least I hope).
@mic.jaeger, @Marcello87: You faced that problem. Can you please try with the latest version?

Another note for the latest version:
The binding is now supporting Units Of Measurements that was introduced some days ago, hence you need to update your openhab to the latest version.
Also if you use the items in a rule you have to make sure to use QuantityTypes instead of DecimalTypes now!

I trying to set up a new system :stuck_out_tongue_winking_eye:
I’ve installed openmediavault and tried to run openhab in a docker container.
With this setup I get the following error when I try to install/run MeterReader Binding:

[ERROR] [org.openhab.binding.meterreader ] - FrameworkEvent ERROR - org.openhab.binding.meterreader org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.meterreader [232] Unresolved requirement: Import-Package: javax.measure; version="1.0.0"

Maybe the reason is in the Serial Binding? :thinking:

Update:

  • with debian 9 and docker and openhab 2.2 image --> same error.

@portboy: New version will only run with latest snapshots of openhab 2.3

@msteigenberger
Ok, where can I find those info’s? This could save time on testing :stuck_out_tongue_winking_eye:
But thanks for your work :+1::+1:

Question:
How could I load the old version for openhab 2.2?

@portboy: I mentioned that info in my last post (and it is targeted for 2.3 as stated in the version).

As there is no official version available yet, you’d have to build from source and put it to addons folder (delete the market version).

@msteigenberger
u r my friend :slight_smile:
I only know this url:


To build the old version, what must I do (sry if this question is too dumb)?

I saw that I first did the changes for UoM (which requires newer version) and then the serial changes.
I did a cherry pick of that commit and build a new version that you can try:
https://drive.google.com/file/d/14SL-suq9rxVo2-yvHY2v2QtS9OIkzuNR/view?usp=sharing

@msteigenberger
THX

but with this Version I get the following error:
2018-04-03 23:35:54.158 [ERROR] [erreader.internal.MeterValueListener] - java.lang.NullPointerException: null at java.util.Hashtable.put(Hashtable.java:459) ~[?:?] at java.util.Properties.setProperty(Properties.java:166) ~[?:?] at java.lang.System.setProperty(System.java:796) ~[?:?] at gnu.io.factory.SerialPortUtil.appendSerialPortProperty(SerialPortUtil.java:34) ~[?:?] at gnu.io.factory.RxTxPortCreator.createPort(RxTxPortCreator.java:45) ~[?:?] at gnu.io.factory.RxTxPortCreator.createPort(RxTxPortCreator.java:1) ~[?:?] at gnu.io.factory.DefaultSerialPortFactory.createSerialPort(DefaultSerialPortFactory.java:53) ~[?:?] at org.openhab.binding.meterreader.internal.sml.SmlSerialConnector.openConnection(SmlSerialConnector.java:102) ~[?:?] at org.openhab.binding.meterreader.connectors.ConnectorBase.getMeterValues(ConnectorBase.java:54) ~[?:?] at org.openhab.binding.meterreader.internal.MeterDevice.lambda$1(MeterDevice.java:136) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?] at java.lang.Thread.run(Thread.java:748) [?:?]

With this version it works :muscle:

But :flushed: now I have the same issue like @Halloween
A full log with [WARN ] [org.openmuc.jsml.EObis ] - Unknown OBIS Code: 01 00 01 08 02 FF

Maby you could serve the old version from September 2017 :laughing:

@portboy: sorry, bad mistake. I fixed it and changed the link in the post:

1 Like

Hi, I’m trying to get this working, unfortunately without luck. Sorry for maybe dumb questions

The type of my meter device is “EasyMeter Q3MB3220”, it is connected via USB to a raspi. On that raspi I tested with “vzlogger” and get response from the meter device:

[Apr 04 17:32:07][mtr0] Got 10 new readings from meter:
[Apr 04 17:32:07][mtr0] Reading: id=1-0:1.8.0255/ObisIdentifier:1-0:1.8.0255 value=319796.60 ts=1522855927503
[Apr 04 17:32:07][mtr0] Reading: id=1-0:2.8.0255/ObisIdentifier:1-0:2.8.0255 value=352291.17 ts=1522855927503
[Apr 04 17:32:07][mtr0] Reading: id=1-0:1.8.1255/ObisIdentifier:1-0:1.8.1255 value=412.30 ts=1522855927504
[Apr 04 17:32:07][mtr0] Reading: id=1-0:2.8.1255/ObisIdentifier:1-0:2.8.1255 value=194.83 ts=1522855927504
[Apr 04 17:32:07][mtr0] Reading: id=1-0:1.8.2255/ObisIdentifier:1-0:1.8.2255 value=319384.31 ts=1522855927504
[Apr 04 17:32:07][mtr0] Reading: id=1-0:2.8.2255/ObisIdentifier:1-0:2.8.2255 value=352096.34 ts=1522855927504
[Apr 04 17:32:07][mtr0] Reading: id=1-0:16.7.0255/ObisIdentifier:1-0:16.7.0255 value=-2466.82 ts=1522855927504
[Apr 04 17:32:07][mtr0] Reading: id=1-0:36.7.0255/ObisIdentifier:1-0:36.7.0255 value=-458.96 ts=1522855927504
[Apr 04 17:32:07][mtr0] Reading: id=1-0:56.7.0255/ObisIdentifier:1-0:56.7.0255 value=-1061.96 ts=1522855927504
[Apr 04 17:32:07][mtr0] Reading: id=1-0:76.7.0255/ObisIdentifier:1-0:76.7.0255 value=-945.89 ts=1522855927504

openhab (2.3 Build 1248) is installed on another raspi. So I installed ser2net on the one with the meter device with this configuration:
2000:raw:60:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT

In the thing configuration I entered the port as rfc2217://192.168.19.63:2000. After saving the configuration I get Status: OFFLINE - COMMUNICATION_ERROR wrong crc

In the openhab.log

    > 2018-04-04 19:40:20.759 [ERROR] [ader.internal.sml.SmlSerialConnector] - Error at SerialConnector.getMeterValuesInternal: wrong crc
    > 2018-04-04 19:40:20.761 [ERROR] [erreader.internal.MeterValueListener] -
    > java.io.IOException: wrong crc
    >         at org.openmuc.jsml.transport.MessageExtractor.waitForStopSequence(MessageExtractor.java:113) ~[?:?]
    >         at org.openmuc.jsml.transport.MessageExtractor.getSmlMessage(MessageExtractor.java:42) ~[?:?]
    >         at org.openmuc.jsml.transport.Transport.getSMLFile(Transport.java:101) ~[?:?]
    >         at org.openhab.binding.meterreader.internal.sml.SmlSerialConnector.getMeterValuesInternal(SmlSerialConnector.java:86) ~[?:?]
    >         at org.openhab.binding.meterreader.internal.sml.SmlSerialConnector.getMeterValuesInternal(SmlSerialConnector.java:1) ~[?:?]
    >         at org.openhab.binding.meterreader.connectors.ConnectorBase.getMeterValues(ConnectorBase.java:55) ~[?:?]
    >         at org.openhab.binding.meterreader.internal.MeterDevice.lambda$1(MeterDevice.java:139) ~[?:?]
    >         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
    >         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
    >         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
    >         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
    >         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
    >         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
    >         at java.lang.Thread.run(Thread.java:748) [?:?]

Should this meter device work, maybe only a communication problem? Thanks for any help

Regards
Thomas

Can you try using protocol 62056-21?

For mode A/B/C I get

2018-04-05 13:53:32.626 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at ‘things/meterreader:meter:4550ac1a/config’
java.lang.IllegalArgumentException: No enum constant org.openhab.binding.meterreader.internal.helper.ProtocolMode.C
at java.lang.Enum.valueOf(Enum.java:238) [?:?]
at org.openhab.binding.meterreader.internal.helper.ProtocolMode.valueOf(ProtocolMode.java:1) [216:org.openhab.binding.meterreader:2.3.0.201804040438]
at org.openhab.binding.meterreader.internal.MeterDeviceFactory.getDevice(MeterDeviceFactory.java:25) [216:org.openhab.binding.meterreader:2.3.0.201804040438]
at

When I choose Mode D I get an endless list of errors in the log (the start byte changes in every line)

2018-04-05 13:54:29.654 [ERROR] [.iec62056.Iec62056_21SerialConnector] - Exception while listening for mode D data message
java.io.IOException: Received unexpected identification message start byte: 01
at org.openmuc.j62056.internal.IdentificationMessage.(IdentificationMessage.java:49) [216:org.openhab.binding.meterreader:2.3.0.201804040438]
at org.openmuc.j62056.Iec21Port$ModeDReceiver.run(Iec21Port.java:70) [216:org.openhab.binding.meterreader:2.3.0.201804040438]
2018-04-05 13:54:30.149 [ERROR] [.iec62056.Iec62056_21SerialConnector] - Exception while listening for mode D data message
java.io.IOException: Received unexpected identification message start byte: 1B
at org.openmuc.j62056.internal.IdentificationMessage.(IdentificationMessage.java:49) [216:org.openhab.binding.meterreader:2.3.0.201804040438]
at org.openmuc.j62056.Iec21Port$ModeDReceiver.run(Iec21Port.java:70) [216:org.openhab.binding.meterreader:2.3.0.201804040438]
2018-04-05 13:54:30.189 [ERROR] [.iec62056.Iec62056_21SerialConnector] - Exception while listening for mode D data message
java.io.IOException: Received unexpected identification message start byte: 53
at org.openmuc.j62056.internal.IdentificationMessage.(IdentificationMessage.java:49) [216:org.openhab.binding.meterreader:2.3.0.201804040438]
at org.openmuc.j62056.Iec21Port$ModeDReceiver.run(Iec21Port.java:70) [216:org.openhab.binding.meterreader:2.3.0.201804040438]

The constant to use for protocol mode C is “ABC” NOT “C”, as this mode is negotiated with the meter.

Ok, sorry, just saw that I can select from the drop down list. If I select ABC,

java.io.IOException: Received unexpected identification message start byte: 1B (B5, F4 …)

is logged.

As mentioned, when I try “vzlogger” on the raspi with the usb reader connected, I get data. vzlogger protocol type is configured as “sml” (protocol type for 62056-21 would be “d0” there). So I guess in the meter binding it should also be type SML and not some of the 62056-21 types.

I will try to do a test installation of openhab on the raspi with the usb device, to find out if it is a communication problem, maybe I missed something with the ser2net config / rfc2217

@msteigenberger

IT WORKS :grinning:
u r my hero :muscle::fist_right:

thanks

@msteigenberger
Hey, I get the following error when trying to install your 2.3 snapshot version with my freshly update 2.3 OpenHab.

Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.meterreader-2.3.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.meterreader [246]
Unresolved requirement: Import-Package: gnu.io

I’ve read it has something to do with nrjavaserial? What’s the status on that?

//edit:

nrjavaserial doesn’t seem to have been packed with the meterreader bundle, so I tried installing zwave binding because it ships with it it. Now it works. At least a workaround :smiley:

Problem is, that it’s not yet part of the distribution hence dependencies gets not installed. Installing the serialbinding would have also helped.

@msteigenberger

I thought it would work now and it looked like it, but the readings are not right. When starting the binding it’s reading the right values but from there on it’s only changing the read values by a few W even if I turn on a large consumer. When I restart the socat service to shut down the connection or restart the whole binding the real measurements are read again.
Trust me when I say the numbers are wrong. I know how much electricity all my devices draw, because I use your binding since a year now I believe. I will put some screenshots in this post.

I hope you can help me :slight_smile:

Keep in mind this next screenshot shows the total energy counter of my house.