IEC 62056 - 21 Meter Binding / ISKRA MT 174

Hello,

I´m using an Raspi 2 with openhab 1.8.1. I just got the IR USB Dongle from volkszaehler.org and now trying to read the data from my energy meter ISKRA MT 174.
I can read the data from within a terminal session. I set up the serial port with

stty -F /dev/ttyUSB0 1:0:9a7:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

after that, I send the following signal to the meter

echo -n -e ‘\x2F\x3F\x21\x0D\x0A’ > /dev/ttyUSB0

and watch with

cat /dev/ttyUSB0

in a second session all the data coming from the meter. This is working perfectly. When I now try to use the IEC 62056 - 21 Meter Binding with the following parameters:

######################### IEC 620562-21 Meter Binding ####################
# the serial port to use for connecting to the metering device e.g. COM1 for Windows and /dev/ttyS0 or
# /dev/ttyUSB0 for Linux
iec6205621meter:meter1.serialPort=/dev/ttyUSB0

# Delay of baud rate change in ms. Default is 0. USB to serial converters often require a delay of up to 250ms
# default is 0ms
iec6205621meter:meter1.baudRateChangeDelay=0

# Enable handling of echos caused by some optical tranceivers
# default is true
iec6205621meter:meter1.echoHandling=false

# Perform a module status query every x seconds (optional, defaults to 600 (10 minutes)).
iec6205621meter:refresh=120

I´m getting just errors in the openhab log, saying the following:

2016-03-26 14:06:07.270 [ERROR] [iec6205621meter.internal.Meter] - IOException while trying to read: Timeout while listening for Identification Message
2016-03-26 14:06:08.213 [ERROR] [iec6205621meter.internal.Meter] - IOException while trying to read: Serial Port does not support -1bd 7E1

It actually doesnt matter what I configure in openhab.cfg, I tried with echo handling true and false, with different timeouts. But never got it to work.
I also tried different versions of this binding, starting from 1.8.1, 1.8.2 and now using the version from the latest 1.9.0 nightly build.

Has someone an idea what to do? Am I doing something wrong or did I missed something?

Thanks for help!!!

regards

Daniel

OK, now I´m a bit further…

I have left the settings all on default, like:

iec6205621meter:meter1.echoHandling=false
iec6205621meter:meter1.baudRateChangeDelay=0

After a restart of OH, I did a cat /dev/ttyUSB0 and saw that some data is comming in (the meter will only sends data when its getting a signal). So this means the binding can sucessfully communicate with the meter. After that, I started OH in debug mode to see whats coming in.It gave me the following:

22:51:14.685 [DEBUG] [o.b.i.i.Iec6205621MeterBinding:120 ] - Read meter: meter1; /dev/ttyUSB0
22:51:18.812 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: MT174-0001;;
22:51:18.813 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 0-0:F.F.0*255;0000000;
22:51:18.813 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.0.1*255; 1ISK00;
22:51:18.814 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.0.0*255;64153041;
22:51:18.815 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.0.2;4M012531;
22:51:18.840 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.9.1*255;225039;
22:51:18.841 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.9.2*255;0160326;
22:51:18.842 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.0*255;8;
22:51:18.843 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*01;1603010000;
22:51:18.845 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*02;1602010000;
22:51:18.846 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*03;1601010000;
22:51:18.847 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*04;1512010000;
22:51:18.849 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*05;1511010000;
22:51:18.849 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*06;1510010000;
22:51:18.851 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*07;1509230825;
22:51:18.852 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*08;1509230823;
22:51:18.853 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*09;;
22:51:18.854 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*10;;
22:51:18.855 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*11;;
22:51:18.856 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*12;;
22:51:18.857 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*13;;
22:51:18.858 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*14;;
22:51:18.859 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:0.1.2*15;;
22:51:18.860 [DEBUG] [iec6205621meter.internal.Meter:85 ] - DataSet: 1-0:1.8.0*255;0001906.435;kWh

So now I can be sure its basicly working! But unfourtunatly I dont get any data shown on my OH page. I created the item

Number gesamt “Zählerstand [%d kwh]” (gVerbrauch) { iec6205621meter=“meter1:1-0:1.8.0*255” }

but its not showing anything. Do I have to use an other OBIS code? Any suggestions?

Only if someone is interested: https://github.com/openhab/openhab/issues/4239

sorry not regularly read in the forum issue is solve and pull request submitted
/kreutpet

Hi guys, just struggling with VZ USB Optolink and my MT681 via iec6205621meter binding. My config looks that way:

iec6205621meter:meter1.serialPort=/dev/ttyUSB0
iec6205621meter:meter1.baudRateChangeDelay=250
iec6205621meter:meter1.echoHandling=rteu 
iec6205621meter:refresh=60

Even in Debug-Mode there is no output but that:

[DEBUG] [b.i.i.Iec6205621MeterActivator:34   ] - iec6205621meter binding has been started.                                                                     x
[INFO ] [o.b.i.i.Iec6205621MeterBinding:208  ] - Created reader meter1 with  IEC 62056-21MeterDeviceConfig [serialPort=/dev/ttyUSB0, initMessage=null, baudRateChangeDelay=250, echoHandling=false]!                                                                                                                                      x
[INFO ] [.service.AbstractActiveService:169  ] - iec6205621meter Refresh Service has been started 

The openhab user is part of the dialout group on my debian system (jessie on Pi3)

Any hints how to solve that problem?

Thanks in advance! =)

Typo in your config :wink:

iec6205621meter:meter1.echoHandling=TRUE

-> look how it looks in your config…

Hi Daniel, thank you for the fast response. But also without the typo, there is no change.

If I query the ttyUSB0 Port via command line, there seems to be data:

# sudo cat /dev/ttyUSB0 | od -tx1
0000000 01 77 07 01 00 00 00 09 ff 01 01 01 01 0b 06 49
0000020 53 4b 01 0e 1f 52 d7 99 01 77 07 01 00 01 08 00
0000040 ff 65 00 00 01 82 01 62 1e 52 ff 59 00 00 00 00
0000060 00 67 68 da 01 77 07 01 00 01 08 01 ff 01 01 62
0000100 1e 52 ff 59 00 00 00 00 00 67 68 da 01 77 07 01
0000120 00 01 08 02 ff 01 01 62 1e 52 ff 59 00 00 00 00
0000140 00 00 00 00 01 77 07 01 00 10 07 00 ff 01 01 62
0000160 1b 52 00 55 00 00 00 f9 01 77 07 81 81 c7 82 05
...

Whats the IR Receiver you have? Have you tried it without the delay time (=0)? And how does you item File looks like? You need to create an item and ‘connect’ it to the binding in order to see something.

Btw: I had ‘trouble’ with the refresh time, because as far as I know its meant to be in milliseconds. I´ve set it to 60000.

I have Udos USB IR Receiver from Volkszaehler project.

I also tried your values of …

iec6205621meter:meter1.echoHandling=false
iec6205621meter:meter1.baudRateChangeDelay=0

… but without success.

My items look like, but I am not quiet sure about the OBIS values:

Number Tarif1 "High price tarif [%d kwh]"  { iec6205621meter="meter1;1-0:1.8.1*255" }
Number Tarif2 "Low price tarif [%d kwh]"   { iec6205621meter="meter1;1-0:1.8.2*255" }
Number ActualEnergyConsumption "Actual energy consumption [%.2f KW]" () { iec6205621meter="meter1;1-0:16.7*255" }

I realized the following error while reading data manually from the command line, when openhab is still running. So openhab seems to do something with the interface.

08:24:47.734 [ERROR] [.service.AbstractActiveService:175  ] - Error while executing background thread iec6205621meter Refresh Service                                       
        at org.openhab.binding.iec6205621meter.internal.Meter.read(Meter.java:83) ~[na:na]                                                                                  
        at org.openhab.binding.iec6205621meter.internal.Iec6205621MeterBinding.execute(Iec6205621MeterBinding.java:121) ~[na:na] 

[EDIT] just for your information: I configured the ttyUSB0 Device with the following command line. Is there another way I have to configure my debian jessie (on Pi3)?

sudo stty -F /dev/ttyUSB0 1:0:8bd:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

At the moment, I got these errors …

14:13:54.147 [DEBUG] [o.b.i.i.Iec6205621MeterBinding:120  ] - Read meter: meter1; /dev/ttyUSB0                                                                              
14:16:26.755 [ERROR] [.service.AbstractActiveService:175  ] - Error while executing background thread iec6205621meter Refresh Service                                       
       at org.openhab.binding.iec6205621meter.internal.Meter.read(Meter.java:83) ~[na:na]                                                                                  
       at org.openhab.binding.iec6205621meter.internal.Iec6205621MeterBinding.execute(Iec6205621MeterBinding.java:121) ~[na:na] 

… with this kind of configuration (items not changed):

iec6205621meter:meter1.serialPort=/dev/ttyUSB0
iec6205621meter:meter1.baudRateChangeDelay=250
iec6205621meter:meter1.echoHandling=true
iec6205621meter:refresh=60000

No one an idea how to get it working? :disappointed_relieved:

Can you tell us what meter you have? Are you using the ISRKA MT 174? And (maybe a dumb question) what version of binding are you using?

My config seems almost the same (I´ve noticed that echoHandling=true not working for me):

iec6205621meter:strom.serialPort=/dev/ttyUSB2
iec6205621meter:strom.baudRateChangeDelay=0
iec6205621meter:strom.echoHandling=false
iec6205621meter:refresh=6000

Number Strom_Zaehlerstand “Zählerstand [%.2f kwh]” (gVerbrauch, Strom) { iec6205621meter=“strom;1-0:1.8.0*255” }

EDIT:

[EDIT] just for your information: I configured the ttyUSB0 Device with the following command line. Is there another way I have to configure my debian jessie (on Pi3)?

I think you dont even need to do this, because thats the job of the binding. This command actually just tells the IR device with which parameters it got to listen to the meter. So you only need to configure the USB0 device when reading data without the binding from command line.

I have ISKRA MT681 and use the following version:

openhab-addon-binding-iec6205621meter 1.8.3                          all          openHAB IEC 62056-21 Meter Binding
openhab-runtime                       1.8.3                          all          openHAB Distribution

Well, the problem from my point of view is that you do not have an iec 62056-21 meter. All I could find is that your MT681 meter is using the SML protocol, which wont work with this binding. I dont know which language you are speaking, but if you speak german you can have a look at this: http://datenblatt.stark-elektronik.de/iskraemeco/MT681_Technische%20Beschreibung.pdf

I know there were a ‘alpha’ binding out there for the SML meters (it called SmlReaderBinding -> https://github.com/openhab/openhab/wiki/SmlReaderBinding-Samples). But as far as I can see its currently not an official openHAB binding. Only thing you could do, besides an openHAB binding, would be reading out the data from within a batch script (I guess you´ll find some advice on volkszaehler pages) and push this values into openHAB.

Even though these arent good news, hope that helpded you a bit!?

regards
Daniel

Hi Daniel, that news was the right hint for solving my problem. Actually my MT681 uses SML, so I wrote a simple python script for reading data from ttyUSB, until the start and end sequence was received. After some bit counting and text conversion I finally got my value 1.8.0 and passed it to OH by exec.

Thank you for your support.
:thumbsup:

Cool, nice to here you´ve found a way around! :thumbsup:

Hi Daniel

Can you please explain to me, which steps i have to do, to get data out of the IR reader.
I have already installed the IEC binding, but i don’t know how to check, if there is something coming out .
As i have read before, the binding needs a signal to read the data of the IR reader.
Do you know how to set the right paramters in openhab ?
Thanks
Stefan

Hi Stefan,

can you first tell something about your environment!?

  • what meter do you have?
  • what IR reader?
  • how does your openhab.cfg and your item file look like (regarding the meter)?
  • when you have everything configured, whats the output when starting OH in debug mode?

You can actually see my configuration just above inwith this threat:

openhab.cfg

iec6205621meter:strom.serialPort=/dev/ttyUSB2
iec6205621meter:strom.baudRateChangeDelay=0
iec6205621meter:strom.echoHandling=false
iec6205621meter:refresh=6000

item File

Number Strom_Zaehlerstand "Zählerstand [%.2f kwh]" (gVerbrauch, Strom) { iec6205621meter="strom;1-0:1.8.0*255" }

regards
Daniel

Hi Daniel

First, sorry for the delay and many thanks for your quick reply.

  1. my meter is Landys&Gyr E650
  2. my IR reader is from Volkszähler - like this with USB
    http://wiki.volkszaehler.org/hardware/controllers/ir-schreib-lesekopf-usb-ausgang
  3. Openhab.cfg;
    ############################# IEC 620562-21 Meter Binding

the serial port to use for connecting to the metering device e.g. COM1

for Windows

and /dev/ttyS0 or /dev/ttyUSB0 for Linux

#iec6205621meter:.serialPort=/dev/ttyS0
iec6205621meter:housemeter.serialPort=/dev/ttyUSB0

Delay of baud rate change in ms. Default is 0. USB to serial converters

often

require a delay of up to 250ms default is 0ms

#iec6205621meter:.baudRateChangeDelay=
iec6205621meter:housemeter.baudRateChangeDelay=0

Enable handling of echos caused by some optical tranceivers

default is true

#iec6205621meter:.echoHandling=true
iec6205621meter:housemeter.echoHandling=true

Perform a module status query every x miliseconds (optional, defaults to

iec6205621meter:refresh=60000

  1. Items - deleted, to ensure that all other items work as designed.
    Otherwise i have got problems to see the other ones…

  2. I have tried to activate the debug Modus. Just for a few minutes. IN
    this tine i have not found an entry in the LOG file.

I’m not sure if CFG-file and items file are enough for this task ??

many thanks
Stefan

Daniel bot@community.openhab.org schrieb am Mi., 26. Okt. 2016 um
16:08 Uhr:

Hi Stefan,

well, that sounds actually good so far…
Your time should look like the following:

Number Energy "Total amount [%.2f kwh]" (gEnergy) { iec6205621meter="housemeter;1-0:1.8.0" }

This should actually work, correct entry in oenhab.cfg and items file + the binding in the folder should be enough.
Maybe you have to check the correct OBIS code for the E650 - dont know if its exactly the same as mine…
You should see something in the log by then (try debug mode). What you can try is setting

iec6205621meter:strom.echoHandling=

to

false

This is were its getting trouble sometimes. Another question would be, have you tried reading from the meter without OH, from Linux command line? Is this working? The meter should be readable in the same way as this one here: http://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/zmd120ap

regards
Daniel

Hi Daniel
Sorry, but for that by Linux Knowlegde is a little bit too small :slight_smile:
Can you tell me step by step how to test this ?

Thanks
Stefan

Daniel bot@community.openhab.org schrieb am Do., 27. Okt. 2016 um
09:47 Uhr: