Migrated openhab2 IEC 62056 21 Meter Binding

hi,

finally found some time to make my first experience with openhab2 binding development.
I migrated the meter binding available in openhab 1 to openhab 2.

I heard that some users of the openhab1 binding were asking to get support for this binding in openhab2. Here now the first try…

The new binding can be fully configured with the PaperUI.
As the channels will vary from meter to meter the thing initializing will created the obis response from the meter as channels.
Download available here: binding download

If there are some tester here in the community could verfiy the binding, would appreciate your feedback.
If feedback is good I would like to issue a pull request in a few week from now.

BR
Peter

did some bug fixes on the bundle and uploaded a new version.
updated the way how existing thing structure is remapped to the obis from meter

/peter

Can i read out a EHM ehz power meter with this binding too?

I have an optical usb-reader from udo (volkszaehler.org) on my power meter.

yes , i am also using the IR from Udo, seems that we have supplied the same equipment :-).

unfortunately below link is in german but it states that the meter has implemented 62056-21
https://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/emh-ehz-h1

i see that the meter speaks sml , not sure if this is going to work

looking at the openmuc frauenhofer page , a lot of changes have been done on the code base which i started to use in 2014. so it may make sense to maybe reconsider to take a new step using there libraries.
license is gpl 2.1 and 3.0 (sml)

forgot to mention

i acutally have only test the paperUI interface to configure the thing and get the channels / items of the meter
main idea was to keep it as simple as possible.
i have not tested how to do this manually.
Will try to do this later on and will also provide that describtion in the final pull request.

it should like this… to be tested
item definition
String test “meter type [%s]” { channel=“iec6205621meter:meter:mymeter:meterType” }

thing definition
iec6205621meter:meter:mymeter [port="/dev/tts0", baudRateChangeDelay=false, initMessage="" refresh=60, ]

Hi halloween,

could you try this library https://www.openmuc.org/sml/
with the serial readerwith your meter.
If you receive data we could add this as a new meter type into the binding or create a new binding for sml

BR
pter

I didn´t have time to test this.

Now i use a c-script, which uses a sml-library to parse the output and then i grab the output with openhab.

Have a look at this:


and this

no need to use mincom.
The link i send is a command line tool which gets the data from the meter in case it speaks SML.
the command line is described in the download and called SampleSerialRead with the parameter of the serial interface

It is also java library which we could easily integrate in the exisitng binding as a new metertype
So if your test would be sucessful i could integrate it

no need to be a developer

BR
peter

On your link i get a tar-file. Don´t know what i have to do with this. But i don´t want to install something just for testing on my working openhab server.

I can say to you, that the ehm ehz power meter speaks sml. You can find many posts on the internet. But you only get few values out of the power meter, no voltage or historical data. Only kwh and watt.

In my current installation it works with the c-script, which reads out the data from the power meter and parses the smsl-data to readable values. See my links absove. It was a little bit tricky to get it running, so i don´t want to crash my system with much testing of other posibilites… I have an esxi-server and the usb-ir-readers are pass-through to my virtual machine. It was a long way to get this working properly.

Maybe @binderth can help you, he is a more advised user with the same power meter.

well the sml library from frauenhofer will not interfer with openhab and shoudl the same as your c programm.

It would be good for me to get somebody testing if the library works with the sml meter.
If it would work i could add a new thingtype in the existing library, to get the sml supported based on this library

maybe @binderth could do this for us?

Br
pter

hi there,
I’ll give your binding it a try, when I’m home.

As I’m using the EHZ from my utility provider, I assume using the openMUC reader isn’t necessary?

the binding has not implemented sml today.
if the library reader is working with the ehz meter i could integrate the library into the existing binding.

So please use the archive file from openmuc, start the reader from their archive and verify if you receive sml messages. here is what the openmuc libray states to run the reader from commandline

Using the examples:

For an example on how to use jSML see the folder src/sample/java/ .
You can create Eclipse project files as explained here:
http://www.openmuc.org/index.php?id=28 and run the sample from within
Eclipse or you can compile and execute it in a terminal. To compile
and execute the sample on Linux use something like this:
go to the folder src/sample/java/

javac *.java -cp "…/…/…/build/libsdeps/jsml-.jar:…/…/…/dependencies/rxtxcomm_api-2.2pre2-11_bundle.jar"
java -cp “…/…/…/build/libsdeps/jsml-.jar:…/…/…/dependencies/rxtxcomm_api-2.2pre2-11_bundle.jar:./” SampleSerialRead
or run SampleSMLServer or SampleSMLClient instead of SampleSerialRead

To execute the server and client in ssl mode:
java -Djavax.net.ssl.keyStore=/path/to/serverKeystore -Djavax.net.ssl.keyStorePassword=“storepass” -cp “…/…/…/build/libsdeps/jsml-.jar:…/…/…/dependencies/rxtxcomm_api-2.2pre2-11_bundle.jar:./” SampleSMLServer -s
java -cp “…/…/…/build/libsdeps/jsml-.jar:…/…/…/dependencies/rxtxcomm_api-2.2pre2-11_bundle.jar:./” SampleSMLClient -s

BR
peter

Do you know this binding?

Have seen it in the market.

Is this working too? Anybody knows this binding?

hi Peter,

don’t know, what to do now:

  1. downloaded the jsml-1.0.17.tgz
  2. extracted the tarball tar -xvzf jsml-1.0.17.tgz
  3. gone to Folder cd jsml/src/sample/java/
  4. tried to compile javac *.java -cp "../../../build/libsdeps/jsml-.jar:../../../dependencies/rxtxcomm_api-2.2pre2-11_bundle.jar"

got those errors:

SampleSerialRead.java:28: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.ASNObject;
                                  ^
SampleSerialRead.java:29: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.Integer32;
                                  ^
SampleSerialRead.java:30: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.Integer64;
                                  ^
SampleSerialRead.java:31: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.OctetString;
                                  ^
SampleSerialRead.java:32: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_File;
                                  ^
SampleSerialRead.java:33: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_GetListRes;
                                  ^
SampleSerialRead.java:34: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_List;
                                  ^
SampleSerialRead.java:35: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_ListEntry;
                                  ^
SampleSerialRead.java:36: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_Message;
                                  ^
SampleSerialRead.java:37: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_MessageBody;
                                  ^
SampleSerialRead.java:38: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_PublicOpenReq;
                                  ^
SampleSerialRead.java:39: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_Value;
                                  ^
SampleSerialRead.java:40: error: package org.openmuc.jsml.tl does not exist
import org.openmuc.jsml.tl.SML_SerialReceiver;
                          ^
SampleSMLClient.java:31: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.OctetString;
                                  ^
SampleSMLClient.java:32: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_File;
                                  ^
SampleSMLClient.java:33: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_GetProfileListReq;
                                  ^
SampleSMLClient.java:34: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_Message;
                                  ^
SampleSMLClient.java:35: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_MessageBody;
                                  ^
SampleSMLClient.java:36: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_PublicCloseReq;
                                  ^
SampleSMLClient.java:37: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_PublicOpenReq;
                                  ^
SampleSMLClient.java:38: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_TreePath;
                                  ^
SampleSMLClient.java:39: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.Unsigned8;
                                  ^
SampleSMLClient.java:40: error: package org.openmuc.jsml.tl does not exist
import org.openmuc.jsml.tl.SML_TConnection;
                          ^
SampleSMLClient.java:41: error: package org.openmuc.jsml.tl does not exist
import org.openmuc.jsml.tl.SML_TSAP;
                          ^
SampleSMLServer.java:29: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.OctetString;
                                  ^
SampleSMLServer.java:30: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_File;
                                  ^
SampleSMLServer.java:31: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_GetProfileListReq;
                                  ^
SampleSMLServer.java:32: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_Message;
                                  ^
SampleSMLServer.java:33: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_MessageBody;
                                  ^
SampleSMLServer.java:34: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_PublicCloseReq;
                                  ^
SampleSMLServer.java:35: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_PublicOpenReq;
                                  ^
SampleSMLServer.java:36: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.SML_TreePath;
                                  ^
SampleSMLServer.java:37: error: package org.openmuc.jsml.structures does not exist
import org.openmuc.jsml.structures.Unsigned8;
                                  ^
SampleSMLServer.java:38: error: package org.openmuc.jsml.tl does not exist
import org.openmuc.jsml.tl.SML_TConnection;
                          ^
SampleSMLServer.java:39: error: package org.openmuc.jsml.tl does not exist
import org.openmuc.jsml.tl.SML_TConnectionListener;
                          ^
SampleSMLServer.java:40: error: package org.openmuc.jsml.tl does not exist
import org.openmuc.jsml.tl.SML_TSAP;
                          ^
SampleSMLServer.java:42: error: cannot find symbol
public class SampleSMLServer implements SML_TConnectionListener {
                                        ^
  symbol: class SML_TConnectionListener
SampleSMLServer.java:98: error: cannot find symbol
        public void connectionIndication(SML_TConnection smlTConnection) {
                                         ^
  symbol:   class SML_TConnection
  location: class SampleSMLServer
SampleSerialRead.java:45: error: cannot find symbol
                SML_SerialReceiver receiver = new SML_SerialReceiver();
                ^
  symbol:   class SML_SerialReceiver
  location: class SampleSerialRead
SampleSerialRead.java:45: error: cannot find symbol
                SML_SerialReceiver receiver = new SML_SerialReceiver();
                                                  ^
  symbol:   class SML_SerialReceiver
  location: class SampleSerialRead
SampleSerialRead.java:50: error: cannot find symbol
                        SML_File smlFile = receiver.getSMLFile();
                        ^
  symbol:   class SML_File
  location: class SampleSerialRead
SampleSerialRead.java:53: error: cannot find symbol
                        List<SML_Message> smlMessages = smlFile.getMessages();
                             ^
  symbol:   class SML_Message
  location: class SampleSerialRead
SampleSerialRead.java:59: error: cannot find symbol
                                SML_Message sml_message = smlMessages.get(i);
                                ^
  symbol:   class SML_Message
  location: class SampleSerialRead
SampleSerialRead.java:63: error: cannot find symbol
                                case SML_MessageBody.OpenRequest:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:64: error: cannot find symbol
                                        SML_PublicOpenReq sml_PublicOpenReq = (SML_PublicOpenReq) sml_message.getMessageBody().getChoice();
                                        ^
  symbol:   class SML_PublicOpenReq
  location: class SampleSerialRead
SampleSerialRead.java:64: error: cannot find symbol
                                        SML_PublicOpenReq sml_PublicOpenReq = (SML_PublicOpenReq) sml_message.getMessageBody().getChoice();
                                                                               ^
  symbol:   class SML_PublicOpenReq
  location: class SampleSerialRead
SampleSerialRead.java:68: error: cannot find symbol
                                case SML_MessageBody.OpenResponse:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:71: error: cannot find symbol
                                case SML_MessageBody.CloseRequest:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:74: error: cannot find symbol
                                case SML_MessageBody.CloseResponse:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:77: error: cannot find symbol
                                case SML_MessageBody.GetProfilePackRequest:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:80: error: cannot find symbol
                                case SML_MessageBody.GetProfilePackResponse:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:83: error: cannot find symbol
                                case SML_MessageBody.GetProfileListRequest:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:86: error: cannot find symbol
                                case SML_MessageBody.GetProfileListResponse:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:89: error: cannot find symbol
                                case SML_MessageBody.GetProcParameterRequest:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:92: error: cannot find symbol
                                case SML_MessageBody.GetProcParameterResponse:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:95: error: cannot find symbol
                                case SML_MessageBody.SetProcParameterRequest:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:98: error: cannot find symbol
                                case SML_MessageBody.GetListRequest:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:101: error: cannot find symbol
                                case SML_MessageBody.GetListResponse:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSerialRead.java:102: error: cannot find symbol
                                        SML_GetListRes resp = (SML_GetListRes) sml_message.getMessageBody().getChoice();
                                        ^
  symbol:   class SML_GetListRes
  location: class SampleSerialRead
SampleSerialRead.java:102: error: cannot find symbol
                                        SML_GetListRes resp = (SML_GetListRes) sml_message.getMessageBody().getChoice();
                                                               ^
  symbol:   class SML_GetListRes
  location: class SampleSerialRead
SampleSerialRead.java:103: error: cannot find symbol
                                        SML_List smlList = resp.getValList();
                                        ^
  symbol:   class SML_List
  location: class SampleSerialRead
SampleSerialRead.java:107: error: cannot find symbol
                                        SML_ListEntry[] list = smlList.getValListEntry();
                                        ^
  symbol:   class SML_ListEntry
  location: class SampleSerialRead
SampleSerialRead.java:109: error: cannot find symbol
                                        for (SML_ListEntry entry : list) {
                                             ^
  symbol:   class SML_ListEntry
  location: class SampleSerialRead
SampleSerialRead.java:112: error: cannot find symbol
                                                SML_Value value = entry.getValue();
                                                ^
  symbol:   class SML_Value
  location: class SampleSerialRead
SampleSerialRead.java:113: error: cannot find symbol
                                                ASNObject obj = value.getChoice();
                                                ^
  symbol:   class ASNObject
  location: class SampleSerialRead
SampleSerialRead.java:115: error: cannot find symbol
                                                if (obj.getClass().equals(Integer32.class)) {
                                                                          ^
  symbol:   class Integer32
  location: class SampleSerialRead
SampleSerialRead.java:116: error: cannot find symbol
                                                        Integer32 val = (Integer32) obj;
                                                        ^
  symbol:   class Integer32
  location: class SampleSerialRead
SampleSerialRead.java:116: error: cannot find symbol
                                                        Integer32 val = (Integer32) obj;
                                                                         ^
  symbol:   class Integer32
  location: class SampleSerialRead
SampleSerialRead.java:119: error: cannot find symbol
                                                else if (obj.getClass().equals(Integer64.class)) {
                                                                               ^
  symbol:   class Integer64
  location: class SampleSerialRead
SampleSerialRead.java:120: error: cannot find symbol
                                                        Integer64 val = (Integer64) obj;
                                                        ^
  symbol:   class Integer64
  location: class SampleSerialRead
SampleSerialRead.java:120: error: cannot find symbol
                                                        Integer64 val = (Integer64) obj;
                                                                         ^
  symbol:   class Integer64
  location: class SampleSerialRead
SampleSerialRead.java:123: error: cannot find symbol
                                                else if (obj.getClass().equals(OctetString.class)) {
                                                                               ^
  symbol:   class OctetString
  location: class SampleSerialRead
SampleSerialRead.java:124: error: cannot find symbol
                                                        OctetString strVal = (OctetString) obj;
                                                        ^
  symbol:   class OctetString
  location: class SampleSerialRead
SampleSerialRead.java:124: error: cannot find symbol
                                                        OctetString strVal = (OctetString) obj;
                                                                              ^
  symbol:   class OctetString
  location: class SampleSerialRead
SampleSerialRead.java:133: error: cannot find symbol
                                case SML_MessageBody.AttentionResponse:
                                     ^
  symbol:   variable SML_MessageBody
  location: class SampleSerialRead
SampleSMLClient.java:73: error: cannot find symbol
                SML_TSAP sml_tSAP = null;
                ^
  symbol:   class SML_TSAP
  location: class SampleSMLClient
SampleSMLClient.java:75: error: cannot find symbol
                        sml_tSAP = new SML_TSAP();
                                       ^
  symbol:   class SML_TSAP
  location: class SampleSMLClient
SampleSMLClient.java:84: error: cannot find symbol
                        sml_tSAP = new SML_TSAP(sslSocketFactory);
                                       ^
  symbol:   class SML_TSAP
  location: class SampleSMLClient
SampleSMLClient.java:87: error: cannot find symbol
                SML_TConnection sml_tConnection = null;
                ^
  symbol:   class SML_TConnection
  location: class SampleSMLClient
SampleSMLClient.java:96: error: cannot find symbol
                SML_File sml_File = sml_tConnection.receive();
                ^
  symbol:   class SML_File
  location: class SampleSMLClient
SampleSMLClient.java:100: error: cannot find symbol
                List<SML_Message> sml_messages = sml_File.getMessages();
                     ^
  symbol:   class SML_Message
  location: class SampleSMLClient
SampleSMLClient.java:101: error: cannot find symbol
                for (SML_Message sml_message : sml_messages) {
                     ^
  symbol:   class SML_Message
  location: class SampleSMLClient
SampleSMLClient.java:104: error: cannot find symbol
                        case SML_MessageBody.OpenRequest:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:105: error: cannot find symbol
                                SML_PublicOpenReq sml_PublicOpenReq = (SML_PublicOpenReq) sml_message.getMessageBody().getChoice();
                                ^
  symbol:   class SML_PublicOpenReq
  location: class SampleSMLClient
SampleSMLClient.java:105: error: cannot find symbol
                                SML_PublicOpenReq sml_PublicOpenReq = (SML_PublicOpenReq) sml_message.getMessageBody().getChoice();
                                                                       ^
  symbol:   class SML_PublicOpenReq
  location: class SampleSMLClient
SampleSMLClient.java:109: error: cannot find symbol
                        case SML_MessageBody.OpenResponse:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:112: error: cannot find symbol
                        case SML_MessageBody.CloseRequest:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:115: error: cannot find symbol
                        case SML_MessageBody.CloseResponse:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:118: error: cannot find symbol
                        case SML_MessageBody.GetProfilePackRequest:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:121: error: cannot find symbol
                        case SML_MessageBody.GetProfilePackResponse:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:124: error: cannot find symbol
                        case SML_MessageBody.GetProfileListRequest:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:127: error: cannot find symbol
                        case SML_MessageBody.GetProfileListResponse:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:130: error: cannot find symbol
                        case SML_MessageBody.GetProcParameterRequest:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:133: error: cannot find symbol
                        case SML_MessageBody.GetProcParameterResponse:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:136: error: cannot find symbol
                        case SML_MessageBody.SetProcParameterRequest:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:139: error: cannot find symbol
                        case SML_MessageBody.GetListRequest:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:142: error: cannot find symbol
                        case SML_MessageBody.GetListResponse:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:145: error: cannot find symbol
                        case SML_MessageBody.AttentionResponse:
                             ^
  symbol:   variable SML_MessageBody
  location: class SampleSMLClient
SampleSMLClient.java:175: error: cannot find symbol
                OctetString transactionId = new OctetString(("" + transactionIDCounter++).getBytes());
                ^
  symbol:   class OctetString
  location: class SampleSMLClient
SampleSMLClient.java:175: error: cannot find symbol
                OctetString transactionId = new OctetString(("" + transactionIDCounter++).getBytes());
                                                ^
  symbol:   class OctetString
  location: class SampleSMLClient
Note: XTrustProvider.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
100 errors

do I miss some package? running Oracle JAVA8 JDK on RPI:

pi@raspberrypi:~/openMuc/jsml/src/sample/java $ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

Hi ,

you have to adapt the path to the version in the libdeps folder.
This is what i didi in the /jsml/src/sample/java folder

javac -Xlint:unchecked *.java -cp “…/…/…/build/libsdeps/jsml-1.0.17.jar:…/…/…/dependencies/rxtxcomm_api-2.2pre2-11_bundle.jar”

after that you should see a SampleSerialRead.java file
java -cp “…/…/…/build/libsdeps/jsml-1.0.17.jar:…/…/…/dependencies/rxtxcomm_api-2.2pre2-11_bundle.jar:./” SampleSerialRead

if rxtxSerial is missing you need to install it via apt

BR
peter

Hi Peter,

ok, got the compiling done now - thanks!
I searched for some rxtx packages, only came up with sudo apt-get install librxtx-java, after installing that, the same error is present:

pi@raspberrypi:~/jsml/src/sample/java $ java -cp "../../../build/libsdeps/jsml-1.0.17.jar:../../../dependencies/rxtxcomm_api-2.2pre2-11_bundle.jar:./" SampleSerialRead
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864)
        at java.lang.Runtime.loadLibrary0(Runtime.java:870)
        at java.lang.System.loadLibrary(System.java:1122)
        at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
        at org.openmuc.jsml.tl.SML_SerialReceiver.setupComPort(SML_SerialReceiver.java:56)
        at SampleSerialRead.main(SampleSerialRead.java:46)

sorry, I’m no JAVA-developer! ; do you have a hint for me? Stackoverflow (https://stackoverflow.com/questions/11380526/rxtx-on-ubuntu-12-04-netbeans) says something lilke copying librxtxSerial.so in /usr/lib, but I don’t find them:

pi@raspberrypi:~/jsml/src/sample/java $ sudo find / -name librxtxSerial.so
pi@raspberrypi:~/jsml/src/sample/java $

hi ,

it is verydifficult to support and get the serial interface properly working.

Assuming that the issue is in rxtx and not in general in the configuration of the serial interface you may try this perl script.

Hope this script will help you

Hi Peter,
1st of all: appreciate very much your hard work on creating a binding for OH2!
I used to successfully read my Landis E350 meter under OH1 with the old binding using an IR head with USB interface.
Without any changes on my RPi setup (besides migrating from OH1 to OH2), I tried to get your new binding working, but I’m struggling with a very basic error:
“Failed to open serial port /dev/ttyUSB0: Serial port with given name does not exist”

Checking via “$ ls -l /dev/serial/{by-path,by-id}/*” or “/sbin/udevadm info --query=all --name=/dev/ttyUSB0” shows that the IR head is all fine:

lrwxrwxrwx 1 root root 13 Jun 6 12:17 /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AI04ICCU-if00-port0 -> …/…/ttyUSB0
lrwxrwxrwx 1 root root 13 Jun 6 12:17 /dev/serial/by-path/platform-20980000.usb-usb-0:1.3:1.0-port0 -> …/…/ttyUSB0

Any hint?

BR,
Stefan

Hi Stefan,

nothing is hardcoded when it comes to the port to be used.
just handing over to as in OH1 to the same library. very strange.

Is the bundle in DEBUG mode?
In case not please please use the karaf console to set it to debug and see if there is more info in the log. here the commands to issue , passworfd should be “habopen”

ssh -p 8101 openhab@localhost 
log:set DEBUG org.openhab.binding.iec6205621meter
log:tail

According to the implementation this is an IOException from the nrjavaserial library inside OH2.
Does the user in which OH2 is running having proper access rights to port?

BR
peter

I uploaded a new version which adds some more info during looging the error
in below example i add the evailable ports

21:10:39.245 [ERROR] [meter.handler.Iec6205621MeterHandler] - Failed to open serial port /dev/ttyS1: Serial port with given name does not exist. :/dev/ttyS5:/dev/ttyS4:/dev/ttyS0
21:10:39.245 [ERROR] [meter.handler.Iec6205621MeterHandler] - Could not get data from IEC 62056-21 meter connected to /dev/ttyS1

In case the USB ports are not showing it maybe an issue with rxtx port issue

/Peter