OpenHab 3 Smartmeter issues

Hi all,

I’m about to update my OH env from 2.5.x to 3.x. Under OH 2.5.x i used the binding “IEC 620562-21 Meter” and a USB IR-Reader from volkszaehler connected to a Landis+Gyr E350 series2 with the following config:

meter1.serialPort=/dev/ttyUSB1
meter1.baudRateChangeDelay=0
meter1.echoHandling=true
refresh=60000

and it worked ok so far. Sure, there were some issues with “IOException while trying to read: CR (0x0D) character is expected but not received after data block of data message” from time to time, but nothing critical.
After updating to OH 3.x i realised at first, that there’s no “IEC 620562-21 Meter” binding anymore, instead i found the “Smartmeter” one. I suppose it’s the same just with another name. So i took that one. To my surprise, the config has changed as well. Now it expects a “protocol mode”. From the example on the documentation i think i need mode “C”. But with that and other modes i was not able to connect to the meter. I always get the following error:

An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.smartmeter.internal.SmartMeterHandler@4ed6c74a': No enum constant org.openhab.binding.smartmeter.internal.helper.ProtocolMode.C

Does anybody know, what the default config was under the old “IEC 620562-21 Meter” binding? Or is there anything wrong on the new one? Did i miss something?

Thanks,

That was an OH v1 binding. As stated many places, v1 bindings are not supported in OH3.

This binding may work if properly configured.

thank you, i know. But the question is, which mode do i need respectively what’s wrong with my config. Smartmeter asks for that mode but i don’t know which one i have to use. As i wrote, i tested all of them but without success …

What you posted mentioned the meter1 binding which will not work with OH3. If you install it on OH2 you can have the OH2 Items controlled in OH3 by using the remoteopenhab binding.

yes that is the config unter OH 2.5.x. Now i use OH 3.x with the Smartmeter binding. The question is, which mode i need to use that my meter is working again under OH 3.x and the Smartmeter binding. I already tested all the modes SML, A, B, C and D but i wasn’t successful with either of them. What i’m doing wrong?

I think you need ABC as configuration value.

thank you, that’s it. The description below the field was a little bit misleading. Now i don’t get the mentioned error anymore, but i still can’t connect to the meter. The log says:

2020-12-27 00:58:06.351 [INFO ] [ding.smartmeter.internal.MeterDevice] - Opening connection to smartmeter:meter:dc2c1e0d08
2020-12-27 00:58:17.383 [WARN ] [.iec62056.Iec62056_21SerialConnector] - 1. reading attempt failed: Expected carriage return character not received. Retrying /dev/ttyUSB1…
2020-12-27 00:58:17.384 [WARN ] [.iec62056.Iec62056_21SerialConnector] - Delaying retry by PT10S
2020-12-27 00:58:38.347 [WARN ] [.iec62056.Iec62056_21SerialConnector] - 2. reading attempt failed: Expected carriage return character not received. Retrying /dev/ttyUSB1…
2020-12-27 00:58:38.348 [WARN ] [.iec62056.Iec62056_21SerialConnector] - Delaying retry by PT10S
2020-12-27 00:58:46.365 [WARN ] [ding.smartmeter.internal.MeterDevice] - Timeout occured for smartmeter:meter:dc2c1e0d08; The source did not signal an event for 40000 milliseconds and has been terminated.

same here Landis&Gyr E550
Also using ABC with 9600 baud (or with 300) same (non) results.
Following commands on the linux console gets the data from the meter:
stty -F /dev/ttyUSB4 300 -parodd cs7 -cstopb parenb -ixoff -crtscts -hupcl -ixon -opost -onlcr -isig -icanon -iexten -echo -echoe -echoctl -echoke
echo -n -e ‘\x2F\x3F\x21\x0D\x0A’ > /dev/ttyUSB4
echo -n -e ‘\x06\x30\x30\x30\x0D\x0A’ > /dev/ttyUSB4

I have tried ABC, D and SML modes with no success in reading the meter using the binding.
The logs shows this and then nothing.
2021-01-05 11:20:45.280 [DEBUG] [martmeter.internal.SmartMeterHandler] - Initializing Smartmeter handler.
2021-01-05 11:20:45.281 [DEBUG] [martmeter.internal.SmartMeterHandler] - config port = /dev/ttyUSB5

just as info: I got it to work (with mode ABC)

@robd: How did you get it to work exactly? Which parameters did you use?

I have a similar problem: I want to migrate from the old IEC 620562-21 Meter Binding to the new Smartmeter Binding in preparation to update to OH3 (still on 2.5.10).
The old IEC Binding reads my meter (Logarex) flawlessly, but I cannot get it to work with the new Smartmeter Binding, I have tried all settings.

This is how my log looks:

2021-03-22 23:59:42.481 [INFO ] [ding.smartmeter.internal.MeterDevice] - Opening connection to smartmeter:meter:hauptzaehler
2021-03-22 23:59:53.777 [WARN ] [.iec62056.Iec62056_21SerialConnector] - 1. reading attempt failed: Expected carriage return character not received. Retrying /dev/ttyUSB1...
2021-03-22 23:59:53.778 [WARN ] [.iec62056.Iec62056_21SerialConnector] - Delaying retry by PT10S
2021-03-23 00:00:15.016 [WARN ] [.iec62056.Iec62056_21SerialConnector] - 2. reading attempt failed: Expected carriage return character not received. Retrying /dev/ttyUSB1...
2021-03-23 00:00:15.017 [WARN ] [.iec62056.Iec62056_21SerialConnector] - Delaying retry by PT10S
2021-03-23 00:00:22.491 [WARN ] [ding.smartmeter.internal.MeterDevice] - Timeout occured for smartmeter:meter:hauptzaehler; The source did not signal an event for 40000 milliseconds and has been terminated.

Any suggestions?

Just the regular settings mit mode=ABC, baud=300 (AUTO also worked)
The problems I had were hardware (too long USB cables, not properly mounted IR sensor).

I first tried to test the connection via the command line (without OH):
CONSOLE 1:

stty -a -F /dev/ttyUSB1
stty -F /dev/ttyUSB1 300 -parodd cs7 -cstopb parenb -ixoff -crtscts -hupcl -ixon -opost -onlcr -isig -icanon -iexten -echo -echoe -echoctl -echoke
cat /dev/ttyUSB1

CONSOLE 2:

echo -n -e '\x2F\x3F\x21\x0D\x0A' > /dev/ttyUSB1
echo -n -e '\x06\x30\x30\x30\x0D\x0A' > /dev/ttyUSB1
1 Like

Thanks a lot, @robd, that helped me to learn much about Linux, once again.
I now get a valid reply from my meter with the commands you provided:

cat /dev/ttyUSB2
/?!
/LOG7LK45BD125698
000
C.1.0(00001234)
0.0.0(001LOG0000001234)
F.F(0000)
1.8.0(000630.130*kWh)
2.8.0(000720.781*kWh)
C.7.1(00000000)
C.7.2(00000000)
C.7.3(00000000)
0.2.1(ver.02, 150228, 671A)
C.2.1(1604281011)
C.2.9(1604281011)
!

However, I still get the exactly same openHAB log entries as listed before, the smartmeter binding does not want to talk with my meter.
As the reply I got with cat seems valid to me, I don’t know what else to try.