# Migrated openhab2 IEC 62056 21 Meter Binding

**URL:** <https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322>\
**Category:** Bindings\
**Created:** [May 13, 2017, 5:35pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322 "2017-05-13T17:35:07Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![GreenUkr](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@GreenUkr](https://community.openhab.org/u/GreenUkr)\
**Post date:** [November 9, 2017, 12:10pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/41 "2017-11-09T12:10:23Z")

</div>

It looks like jar for stiebelheatpump inside ☹

---

<div class="post-metadata">

**Author:** ![kreutzer\_peter](https://community.openhab.org/user_avatar/community.openhab.org/kreutzer_peter/32/19202_2.png) [@kreutzer\_peter](https://community.openhab.org/u/kreutzer_peter)\
**Post date:** [November 9, 2017, 2:25pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/42 "2017-11-09T14:25:40Z")

</div>

upps wrong construction area 🙂  
try this one

> **[j62056-2.1.0.jar](https://drive.google.com/file/d/1H6GKOpIc281RAH58ylqjPONdihfOAoKT/view?usp=drive_open)**
>
> Google Drive file.

---

<div class="post-metadata">

**Author:** ![GreenUkr](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@GreenUkr](https://community.openhab.org/u/GreenUkr)\
**Post date:** [November 13, 2017, 10:15pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/43 "2017-11-13T22:15:56Z")

</div>

Ok. Could you tell me step by step how can I check it

---

<div class="post-metadata">

**Author:** ![kreutzer\_peter](https://community.openhab.org/user_avatar/community.openhab.org/kreutzer_peter/32/19202_2.png) [@kreutzer\_peter](https://community.openhab.org/u/kreutzer_peter)\
**Post date:** [November 14, 2017, 6:14am UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/44 "2017-11-14T06:14:39Z")

</div>

sure,  
just replace the jar file in your /j62056/build/libs-all with the new jar file in link i shared with you.  
then do  
sudo ./j62056-reader -p /dev/ttyUSB0 -b 9600 -d 100 -t 5000 -v  
as you did before and see if you still get data from the meter

i changed some code for the initial hand shake and changing the baud rate from the response message coming from the meter.  
My meter creates some strange bytes. In the new code i addes some line to deal with these bytes.

If you get a responds as before these changes did not affect you meter

---

<div class="post-metadata">

**Author:** ![GreenUkr](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@GreenUkr](https://community.openhab.org/u/GreenUkr)\
**Post date:** [November 14, 2017, 6:02pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/45 "2017-11-14T18:02:49Z")

</div>

> [@kreutzer\_peter](#):
>
> sudo ./j62056-reader -p /dev/ttyUSB0 -b 9600 -d 100 -t 5000 -v

i have an identical output using origin and modified lib

new +++++++  
DEBUG: Sending {“request message”: {“device address”: “”}}  
DEBUG: Received {“identification message”: {“manufacturer ID”: “ISk”, “protocol mode”: “C”, “baud rate”: 9600, “meter ID”: “MT174-0001”, “enhanced ID/capability”: “”}}  
DEBUG: Sending {“acknowledge message”: {“protocol control character”: “NORMAL”, “baud rate”: 9600, “acknowledge mode”: “DATA\_READOUT”}}  
DEBUG: Sleeping for : 100ms before changing the baud rate  
DEBUG: Changing baud rate from 9600 to 9600  
DEBUG: Received data message.  
Received  
{  
“data message”: {  
“manufacturer ID”: “ISk”,  
“meter ID”: “MT174-0001”,  
“enhanced ID/capability”: “”,  
“data block”: {  
“data set”: {“address”: “1-0:0.9.1_255", “value”: “195723”, “unit”: “”},  
“data set”: {“address”: "1-0:0.9.2_255”, “value”: “0171114”, “unit”: “”},  
“data set”: {“address”: “1-0:0.9.4_255", “value”: “0171114195723”, “unit”: “”},  
“data set”: {“address”: "1-0:0.0.0_255”, “value”: “67638426”, “unit”: “”},  
“data set”: {“address”: “1-0:0.1.0_255", “value”: “2”, “unit”: “”},  
“data set”: {“address”: "1-0:0.2.0_255”, “value”: “1.04”, “unit”: “”},  
“data set”: {“address”: “1-0:0.2.2_255", “value”: “”, “unit”: “”},  
“data set”: {“address”: "0-0:C.1.0_255”, “value”: “67638426”, “unit”: “”},  
“data set”: {“address”: “0-0:C.2.0_255", “value”: “2”, “unit”: “”},  
“data set”: {“address”: "0-0:C.2.1_255”, “value”: “1160926111417”, “unit”: “”},

old +++++++++++++++++  
DEBUG: Sending {“request message”: {“device address”: “”}}  
DEBUG: Received {“identification message”: {“manufacturer ID”: “ISk”, “protocol mode”: “C”, “baud rate”: 9600, “meter ID”: “MT174-0001”, “enhanced ID/capability”: “”}}  
DEBUG: Sending {“acknowledge message”: {“protocol control character”: “NORMAL”, “baud rate”: 9600, “acknowledge mode”: “DATA\_READOUT”}}  
DEBUG: Sleeping for : 100ms before changing the baud rate  
DEBUG: Changing baud rate from 9600 to 9600  
DEBUG: Received data message.  
Received  
{  
“data message”: {  
“manufacturer ID”: “ISk”,  
“meter ID”: “MT174-0001”,  
“enhanced ID/capability”: “”,  
“data block”: {  
“data set”: {“address”: “1-0:0.9.1_255", “value”: “195613”, “unit”: “”},  
“data set”: {“address”: "1-0:0.9.2_255”, “value”: “0171114”, “unit”: “”},  
“data set”: {“address”: “1-0:0.9.4_255", “value”: “0171114195613”, “unit”: “”},  
“data set”: {“address”: "1-0:0.0.0_255”, “value”: “67638426”, “unit”: “”},  
“data set”: {“address”: “1-0:0.1.0_255", “value”: “2”, “unit”: “”},  
“data set”: {“address”: "1-0:0.2.0_255”, “value”: “1.04”, “unit”: “”},  
“data set”: {“address”: “1-0:0.2.2_255", “value”: “”, “unit”: “”},  
“data set”: {“address”: "0-0:C.1.0_255”, “value”: “67638426”, “unit”: “”},  
“data set”: {“address”: “0-0:C.2.0_255", “value”: “2”, “unit”: “”},  
“data set”: {“address”: "0-0:C.2.1_255”, “value”: “1160926111417”, “unit”: “”},

---

<div class="post-metadata">

**Author:** ![kreutzer\_peter](https://community.openhab.org/user_avatar/community.openhab.org/kreutzer_peter/32/19202_2.png) [@kreutzer\_peter](https://community.openhab.org/u/kreutzer_peter)\
**Post date:** [November 14, 2017, 6:31pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/46 "2017-11-14T18:31:13Z")

</div>

great news and many thanks for testing.  
next step is to update the binding to the new library.  
Hope to get some time on weekend

---

<div class="post-metadata">

**Author:** ![kreutzer\_peter](https://community.openhab.org/user_avatar/community.openhab.org/kreutzer_peter/32/19202_2.png) [@kreutzer\_peter](https://community.openhab.org/u/kreutzer_peter)\
**Post date:** [November 19, 2017, 1:16pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/47 "2017-11-19T13:16:46Z")

</div>

HI all,

i am actually working on to update to the new library.  
Unfortunatly is facing issues with the rxtx library and can not open the serial port.  
On command line everything works but not inside openhab

```
`Caused by: java.lang.NoSuchMethodError: gnu.io.CommPortIdentifier.open(Ljava/lang/String;I)Lgnu/io/CommPort;
    at org.openmuc.jrxtx.JRxTxPort.openSerialPort(JRxTxPort.java:54)
    at org.openmuc.jrxtx.SerialPortBuilder.build(SerialPortBuilder.java:166)
    at org.openmuc.j62056.Iec21Port.<init>(Iec21Port.java:270)
    at org.openmuc.j62056.Iec21Port.<init>(Iec21Port.java:47)
    at org.openmuc.j62056.Iec21Port$Builder.buildAndOpen(Iec21Port.java:243)
    at org.openhab.binding.iec6205621meter.handler.Iec6205621MeterHandler.read(Iec6205621MeterHandler.java:218)
    at org.openhab.binding.iec6205621meter.handler.Iec6205621MeterHandler.updateMeterData(Iec6205621MeterHandler.java:195)
    at `

```

I guess it could be a incompatibility of the nrjavaserial and the jrxtx wrapper

Any hints from somebody to get this resolved.

BR  
peter

---

<div class="post-metadata">

**Author:** ![kreutzer\_peter](https://community.openhab.org/user_avatar/community.openhab.org/kreutzer_peter/32/19202_2.png) [@kreutzer\_peter](https://community.openhab.org/u/kreutzer_peter)\
**Post date:** [November 19, 2017, 6:20pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/48 "2017-11-19T18:20:40Z")

</div>

made some progress by moving the source from jrxtx and j62056 and compiled against nrjavaserial.  
can now read but not stable in my case.  
do not get stable condition in reading the periodically from the meter.  
After first read the secondread ends in a timeout.  
Not sure if this is a issure with my meter only

---

<div class="post-metadata">

**Author:** ![GreenUkr](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@GreenUkr](https://community.openhab.org/u/GreenUkr)\
**Post date:** [December 22, 2017, 5:13pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/49 "2017-12-22T17:13:15Z")

</div>

Hello, Peter  
Any improovement?  
I’am open for the tests.

---

<div class="post-metadata">

**Author:** ![GreenUkr](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@GreenUkr](https://community.openhab.org/u/GreenUkr)\
**Post date:** [December 22, 2017, 6:32pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/50 "2017-12-22T18:32:16Z")

</div>

It looks [GitHub - Gurux/gurux.serial.java: Gurux Serial port component for Java](https://github.com/Gurux/gurux.serial.java) very intresting

---

<div class="post-metadata">

**Author:** ![GreenUkr](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@GreenUkr](https://community.openhab.org/u/GreenUkr)\
**Post date:** [December 22, 2017, 9:25pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/51 "2017-12-22T21:25:21Z")

</div>

Is it possible to make a fork with a fixed rate?  
May be change  
public class Connection  
…  
private static int baudRates = new int **{ 9600 }** ;  
… and  
try {  
serialPort.setSerialPortParams( **9600** , SerialPort.DATABITS\_7, SerialPort.STOPBITS\_1, SerialPort.PARITY\_EVEN);

would be enough for that?  
Just for rs485 meters 🙂  
Thank you

---

<div class="post-metadata">

**Author:** ![kreutzer\_peter](https://community.openhab.org/user_avatar/community.openhab.org/kreutzer_peter/32/19202_2.png) [@kreutzer\_peter](https://community.openhab.org/u/kreutzer_peter)\
**Post date:** [December 23, 2017, 10:05am UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/52 "2017-12-23T10:05:11Z")

</div>

hi vaslkov,

sorry was very much busy in the last month and did not really had time to  
get the binding wokring in stable condition with the upgraded openmuc  
library.  
In the meantime i am able to receve data but the periodic load is not  
stable and the serial port get blocked.  
I assume that the code i took from the new library does in some cases not  
properly release the serial port.

In the meantime i do have a new laptop and now i need to first get the  
development environment again up and running.

I hope to have a bit more time during the christmas time.  
enjoin christmas

Peter

---

<div class="post-metadata">

**Author:** ![GreenUkr](https://community.openhab.org/letter_avatar_proxy/v4/letter/g/f4b2a3/32.png) [@GreenUkr](https://community.openhab.org/u/GreenUkr)\
**Post date:** [April 9, 2018, 12:29pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/53 "2018-04-09T12:29:45Z")

</div>

Hello Peter  
Any improovement?

---

<div class="post-metadata">

**Author:** ![jemotrain](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/958977/32.png) [@jemotrain](https://community.openhab.org/u/jemotrain)\
**Post date:** [May 13, 2018, 7:08pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/54 "2018-05-13T19:08:35Z")

</div>

Hello,

i am starting to use OpenHab 2.  
My first intention was to readout my power-meter. It’s a “Iskra mt174”.  
After some starting problems with the IEC62056-Meter bindings (installing by default the version 1.x bindings instead of the 2.x version), I think the binding in correct running.

This power-meter needs an init-string before it sends back the data.  
In the OpenHab-logfile I get the message:

2018-05-13 20:34:38.094 [ERROR] [meter.handler.Iec6205621MeterHandler] - IOException while trying to read: Timeout while listening for Data Message  
2018-05-13 20:34:38.150 [ERROR] [meter.handler.Iec6205621MeterHandler] - Could not get data from IEC 62056-21 meter connected to /dev/ttyUSB0.

With a short python script i have verified the connection to the power-meter:  
"  
# mt174read.py

import serial  
import time

SERIALPORT = “/dev/ttyUSB0”  
BAUDRATE = 300

ser = serial.Serial(SERIALPORT, BAUDRATE, serial.SEVENBITS, serial.PARITY\_EVEN)

sendtxt = “\x2F\x3F\x21\x0D\x0A”  
ser.write(sendtxt.encode())

time.sleep(0.5)  
numberOfLine = 0

while True:  
response=ser.readline()  
print(response)  
numberOfLine = numberOfLine + 1  
if (numberOfLine \>= 60):  
break  
ser.close()  
"

My question:  
Where can I set the initMessageBytes ?

If I change something via PaperUI: “Configuration → Things → Edit → IEC 62056-21 Meter Thing”  
I get an error message “Error 500: Internal error” and in the log file:  
“2018-05-13 20:56:07.000 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at ‘things/iec6205621meter:meter:a678e2d0/config’  
java.lang.NullPointerException: null  
at org.openhab.binding.iec6205621meter.handler.Iec6205621MeterHandler.dispose(Iec6205621MeterHandler.java:152) [223:org.openhab.binding.iec6205621meter:2.1.0.201711092305]  
…  
”

directly writing into the configuration file “/etc/openhab2/services/iec6205621meter.cfg”  
seems not successful to solve the problem.  
"  
meter.serialPort=/dev/ttyUSB0  
meter.baudRateChangeDelay=0  
meter.initMessage=\x2F\x3F\x21\x0D\x0A  
…  
"

Any hint’s ? 🤔

Regards  
Jens

---

<div class="post-metadata">

**Author:** ![jemotrain](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/958977/32.png) [@jemotrain](https://community.openhab.org/u/jemotrain)\
**Post date:** [May 21, 2018, 7:11pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/55 "2018-05-21T19:11:56Z")

</div>

In the meantime i have solved some problems…  
Now Openhab get every 60 Sek Data from my mt174 meter:

```auto
2018-05-21 20:53:19.517 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: MT174-0001;;
2018-05-21 20:53:19.520 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:0.9.1*255;205221;
2018-05-21 20:53:19.522 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:0.9.2*255;1180521;
2018-05-21 20:53:19.525 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:0.0.0*255;66816007;
2018-05-21 20:53:19.527 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:0.0.1*255;66816007;
2018-05-21 20:53:19.530 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:0.1.0*255;26;
2018-05-21 20:53:19.532 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:0.2.0*255;1.06;
2018-05-21 20:53:19.534 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 0-0:C.1.0*255;66816007;
2018-05-21 20:53:19.537 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 0-0:C.1.6*255;391B;
2018-05-21 20:53:19.539 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 0-0:C.51.1*255;3;
2018-05-21 20:53:19.542 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 0-0:C.51.2*255;0160129064505;
2018-05-21 20:53:19.544 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:1.7.0*255;0.165;kW
2018-05-21 20:53:19.546 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:1.8.0*255;0006437.749;kWh
2018-05-21 20:53:19.548 [DEBUG] [meter.handler.Iec6205621MeterHandler] - DataSet: 1-0:1.8.1*255;0006437.749;kWh

```

My actual problem is to get the data (eg. actual power 1.7.0) to OpenHab for visualization.  
In “default.items” I have added the following lines:

```csv
Number ActualEnergyConsumption "Zaehlerstand [%.3f kWh]" <energy> (meter) { iec6205621meter="meter;1-0:1.8.0*255" }
Number Power "Leistung [%.3f kW]" <energy> (meter) { iec6205621meter="meter;1-0:1.7.0*255" }

```

But the two items “Power” and “ActualEnergyConsumption” never will be changed to the values from the meter. The have the value NaN.  
What was my mistake ?

Regards  
Jens

---

<div class="post-metadata">

**Author:** ![matte1](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matte1](https://community.openhab.org/u/matte1)\
**Post date:** [June 25, 2018, 4:08pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/56 "2018-06-25T16:08:51Z")

</div>

Hello,  
First of all my english is not that good.  
I have installed openhab version 2.3.0 and wanted to try the binding iec 62056 21 with an ir-read head. I get this message in the openhab log:  
Unresolved requirement: Import Package: [gnu.io](http://gnu.io); version = “3.12.0.OH”  
What are my requirements?  
My system: Debian 9-bit 64-bit, openhab 2.3.0

Thanks a lot

---

<div class="post-metadata">

**Author:** ![hebel23](https://community.openhab.org/user_avatar/community.openhab.org/hebel23/32/44547_2.png) [@hebel23](https://community.openhab.org/u/hebel23)\
**Post date:** [March 7, 2019, 9:33pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/57 "2019-03-07T21:33:30Z")

</div>

Hi Jens,

I also try to integrate an MT174 meter to my openhab2 raspi.  
The basic communication is running. I checked this with minicom.  
Can you please give me an hint, how you got it running?  
I tried the smartmeter addon and the IEC 62056-21 addon. Without success.

Thank you in advance  
Andreas

---

<div class="post-metadata">

**Author:** ![Kristo](https://community.openhab.org/user_avatar/community.openhab.org/kristo/32/66527_2.png) [@Kristo](https://community.openhab.org/u/Kristo)\
**Post date:** [March 26, 2019, 8:53am UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/58 "2019-03-26T08:53:35Z")

</div>

Hi,

I would like to test this binding with WIFI- RS bridge base on ESP8266.  
Coudl you please tell if this could be use and if yes what i should put in Config - `<meter-id1>` .serialPort

---

<div class="post-metadata">

**Author:** ![Armin1](https://community.openhab.org/user_avatar/community.openhab.org/armin1/32/39921_2.png) [@Armin1](https://community.openhab.org/u/Armin1)\
**Post date:** [July 16, 2019, 10:24am UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/59 "2019-07-16T10:24:38Z")

</div>

Hi @hebel23 - did you finally get it going? I desperately went through forums, tried different things, but until now I only saw an iobroker - solution that should work (which I don’t want to use since I love my openhab Setup).

---

<div class="post-metadata">

**Author:** ![hebel23](https://community.openhab.org/user_avatar/community.openhab.org/hebel23/32/44547_2.png) [@hebel23](https://community.openhab.org/u/hebel23)\
**Post date:** [October 25, 2019, 1:01pm UTC](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322/60 "2019-10-25T13:01:10Z")

</div>

Hi @Armin1,

sorry its a long time ago. Unfortunately, I haven’t been able to get it to work yet.

Best regards  
Andreas

[Previous page](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322.md?page=2)

[Next page](https://community.openhab.org/t/migrated-openhab2-iec-62056-21-meter-binding/28322.md?page=4)
