IEC 62056 - 21 Meter Binding / ISKRA MT 174

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:

Hi Daniel
I think i have another problem:
The Openhab.log file says:
2016-10-27 17:55:06.857 [ERROR] [iec6205621meter.internal.Meter] - Failed
to open serial port /dev/ttyUSB0: Serial port with given name does not exist

How can i adjust this ?
Thanks

Stefan Moser stefan1.moser@gmail.com schrieb am Do., 27. Okt. 2016 um
17:22 Uhr:

Well, try to do this on Linux shell:

stty 300 -F /dev/ttyUSB0 1:4:da7:a30:3:1c:7f:15:4:10:0: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

Whats the output?

I’m not sure if this is right. If i enter your command direct in the
command line - nothing happens

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

I’m not able to check, if the existing connection “ttyUSB0” works.
According the logFile “Failed to open serial port /dev/ttyUSB0: Serial port
with given name does not exist” it doesn’t work.
Does it make sense to test USB1, …USB2, … and so on, because i have
plugged off the port a few times
…Thanks for the help

Stefan

Stefan Moser stefan1.moser@gmail.com schrieb am Do., 27. Okt. 2016 um
18:44 Uhr:

Well, you can check easily by hitting the folder /dev and look how it looks like. Then you plugin your reader and check again…

Hi Daniel
WhatsApp Do You mean with hitting the folder?

Daniel bot@community.openhab.org schrieb am Do., 27. Okt. 2016 20:22:

Daniel https://community.openhab.org/users/daniel
October 27

Well, you can check easily by hitting the folder /dev and look how it looks
like. Then you plugin your reader and check again…

Visit Topic
https://community.openhab.org/t/iec-62056-21-meter-binding-iskra-mt-174/9059/25
or reply to this email to respond.
In Reply To
atmosest https://community.openhab.org/users/atmosest Stefan
https://community.openhab.org/users/atmosest
October 27
I’m not able to check, if the existing connection “ttyUSB0” works.
According the logFile “Failed to open serial port /dev/ttyUSB0: Serial port
with given name does not exist” it doesn’t work. Does it make sense to test
USB1, …USB2, … and so on, because i have plugged off the port a few
times ……

Visit Topic
https://community.openhab.org/t/iec-62056-21-meter-binding-iskra-mt-174/9059/25
or reply to this email to respond.

To unsubscribe from these emails, click here
https://community.openhab.org/email/unsubscribe/66023af9b3f922c854c275c461f07f12bf74e064538dc603f1a965d16673f475
.

Just do:

cd /dev
ls -artl
=> look how it looks like
=> plugin the reader
ls -artl
=> look how it looks now -> there must be a change on one port

Hi
I have plugged of and and after plugin again two entries appeared:
crw-rw—T 1 root dialout 188, 0 Okt 27 21:06 ttyUSB0
drwxr-xr-x 4 root root 80 Okt 27 21:06 serial
That means it should work.
But why do i get the error message ?
2016-10-27 21:15:36.440 [ERROR] [iec6205621meter.internal.Meter] - Failed
to open serial port /dev/ttyUSB0: Serial port with given name does not exist

Thanks

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

Hi

I have changed the user authority. Now i use the user “Root”. The error
essages have changed now.
2016-10-28 18:18:42.622 [ERROR] [.service.AbstractActiveService] - Error
while executing background thread iec6205621meter Refresh Service
java.lang.ArrayIndexOutOfBoundsException: 65933
at org.openmuc.j62056.Connection.bytesToHex(Connection.java:602) ~[na:na]
at org.openmuc.j62056.Connection.read(Connection.java:426) ~[na:na]
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]
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]

Do you have an idea ?
Thanks
Stefan

Stefan Moser stefan1.moser@gmail.com schrieb am Do., 27. Okt. 2016 um
21:17 Uhr:

On what exactly you´ve changed the permission? There is actually no need to do so. You need to set the openhab user to the dialout group

sudo usermod -a -G dialout "openhabuser"

Hi, i had changed it in etc/default/openhab. But i set the standard again.
I also tried to execute your command with user pi
sudo usermod -a -G dialout pi
Is this right, or is there any other usergroup ?
Nevertheless i get the same message after reboot.
2016-10-29 08:46:14.400 [ERROR] [.service.AbstractActiveService] - Error
while executing background thread iec6205621meter Refresh Service
java.lang.ArrayIndexOutOfBoundsException: 65901
at org.openmuc.j62056.Connection.bytesToHex(Connection.java:606) ~[na:na]
at org.openmuc.j62056.Connection.read(Connection.java:426) ~[na:na]
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]
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]
2016-10-29 08:46:14.589 [WARN ] [.httpclient.HttpMethodDirector] - Unable
to respond to any of these challenges: {oauth=OAuth
oauth_problem=“OST_OAUTH_PARAMETER_ABSENT_ERROR”, realm=“yahooapis.com”}
2016-10-29 08:46:14.591 [WARN ] [g.openhab.io.net.http.HttpUtil] - Method
failed: HTTP/1.1 401 Unauthorized
2016-10-29 08:46:24.064 [WARN ] [.httpclient.HttpMethodDirector] - Unable
to respond to any of these challenges: {oauth=OAuth
oauth_problem=“OST_OAUTH_PARAMETER_ABSENT_ERROR”, realm=“yahooapis.com”}
2016-10-29 08:46:24.066 [WARN ] [g.openhab.io.net.http.HttpUtil] - Method
failed: HTTP/1.1 401 Unauthorized

Daniel bot@community.openhab.org schrieb am Fr., 28. Okt. 2016 um
19:40 Uhr:

Hi @kreutzer_peter and @Daniel - you somehow managed to get it working. Could you please help me too? I added the binding in openhab2 /PaperUi . I could not configure a Thing (empty Screen) and I did not add a thing manually. I am a beginner with openhab2 and an absolute programmer / Raspberry / newb I so please be kind with me :slight_smile:

  • My Meter is a smartmeter ISKRA MT174-D1A52 (Baud 300 7E1)
  • My IR Reader is a Weidmann Elektronik IR Schreib/Lesekopf USB (Optokopf)

I tried

Item:
Number Strom_Haupt “Strom” (GC_Office) {iec6205621meter=“meter1;1.8.1” } as well as Strom_Haupt “Strom” (GC_Office) {iec6205621meter=“meter1;1.8.1255" } or Strom_Haupt “Strom” (GC_Office) {iec6205621meter="meter1;1-0:1.8.1255” } and other variations

Service-Config of iec6205621meter.cfg:

  • iec6205621meter:meter1.serialPort=/dev/ttyUSB0
  • iec6205621meter:meter1.baudRateChangeDelay=0
  • iec6205621meter:meter1.echoHandling=false
  • iec6205621meter:refresh=6000

After adding the Item there is an error regularely occuring in my logfile:

[ERROR] [nding.iec6205621meter.internal.Meter] - IOException while trying to read: Serial Port does not support -1bd 7E1

following Errors sometimes occur in combination with the first one:

often: [ERROR] [b.core.service.AbstractActiveService] - Error while executing background thread iec6205621meter Refresh Service
java.lang.ArrayIndexOutOfBoundsException: 4

at org.openmuc.j62056.Connection.read(Connection.java:301) ~[?:?]
at org.openhab.binding.iec6205621meter.internal.Meter.read(Meter.java:81) ~[?:?]
at org.openhab.binding.iec6205621meter.internal.Iec6205621MeterBinding.execute(Iec6205621MeterBinding.java:121) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) ~[208:org.openhab.core.compat1x:2.4.0]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [208:org.openhab.core.compat1x:2.4.0]

rarely: [ERROR] [nding.iec6205621meter.internal.Meter] - IOException while trying to read: Timeout while listening for Identification Message

thank you for your help,
Armin

Hello @Armin1

I just recently updated to OH 2 (2.4) and do not have set up the IEC Meter Binding so far, so its a bit hard to help here from my side.
When I look into the history of this thread, I can see that I´ve had once the same issue as you do right now. Maybe something is wrong in my answer, but I wrote:

I have left the settings all on default, like:

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

But as I see, the default for echoHandling is “true”. So maybe you try to set this one to true and try again (after restarting!?). So just

iec6205621meter:meter1.echoHandling=true

regards
Daniel

Thanks a lot! I figured out an alternative. It problably will help others with similar problems.

  1. I run a second Pi with raspian and node-red (comes pre-installed)
  2. On Nodered (Link: your-raspberry-ip:1880) Install Smartmeter node via menu - manage palette
  3. Parameters which worked for me: /dev/ttyUSB0:300-7E1 (Source Type Serial; Serial Port /dev/ttyUSB0; Baud 300, Bits 7, Parity Even, Stop Bits 1)
  4. Protokoll DO, Transport SerialRequestResponseTransport, Request Interval 0. → Deploy
  5. Connect a Function to the Smartmeter-node to format the output:

return [
{payload: parseFloat(msg.payload[„6-0:1.8.1″].rawValue.replace(/[^\d.-]/,“))},
];

  1. Install Openhab Connect via menu - manage palette
  2. Connect Openhab-Out to the Function and define your openhab-parameters within the node