Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

IEC-62056-21 Binding: Support for ISKRA MT174 OBIS Codes #4239

Closed
Puncher4444 opened this issue Mar 29, 2016 · 9 comments
Closed

IEC-62056-21 Binding: Support for ISKRA MT174 OBIS Codes #4239

Puncher4444 opened this issue Mar 29, 2016 · 9 comments
Labels

Comments

@Puncher4444
Copy link

Puncher4444 commented Mar 29, 2016

Hello,

no values are shown in Openhab even data comes in. I guess its because of the OBIS codes of the ISRKA MT174 meter.
When starting OH in debug mode, the binding gets the data (from my point of view) correct from the meter. The log shows the following:

19:26:42.579 [DEBUG] [o.b.i.i.Iec6205621MeterBinding:119  ] - Read meter: meter1; /dev/ttyUSB2
19:26:46.660 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: MT174-0001;;
19:26:46.661 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 0-0:F.F.0*255;0000000;
19:26:46.662 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.0.1*255;  1ISK00;
19:26:46.663 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.0.0*255;64153041;
19:26:46.663 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.0.2;4M012531;
19:26:46.664 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.9.1*255;192607;
19:26:46.665 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.9.2*255;1160329;
19:26:46.666 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.1.0*255;8;
19:26:46.666 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.1.2*01;1603010000;
19:26:46.667 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.1.2*02;1602010000;
19:26:46.668 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.1.2*03;1601010000;
19:26:46.669 [DEBUG] [iec6205621meter.internal.Meter:83   ] - DataSet: 1-0:0.1.2*04;1512010000;
. . .

I´ve created a Item Number in my Items files:

Number Strom "Zählerstand [%d]" (gVerbrauch) { iec6205621meter="meter1:1-0:1.8.0*255" }

I´ve tried different variations of the OBIS code, but nothing worked. I guess the binding parses the '*' in a wrong way, so the item gets no value from the binding (but I´m not into Java, so correct me if I´m wrong).

I´m on the latest OH release 1.8.2 (but also tried with 1.8.1). Also tried version 1.7.0, 1.8.1, 1.8.2 and 1.9.0 (latest nightly) of the binding - didnt work either.
The type of the meter is: ISKRA MT174-D1A51-M3K03, IR reader comes from volkszaehler.org (IR USB reader) & OH running on a Raspi 2.

Would be nice if someone could look at this.

thanks
Daniel

@steve-bate
Copy link
Contributor

You may get more feedback by discussing this at the community forum. After you determine if this is a bug or a feature request, please update the issue with a link to the forum discussion. Thanks.

@Puncher4444
Copy link
Author

Hi Steve,

thanks for your reply. Well, there is already a open thread on the OH community -> see: https://community.openhab.org/t/iec-62056-21-meter-binding-iskra-mt-174/9059
But didnt get any helpful feedback so far.
When the Binding is ment to be a 'IEC 620562-21' Binding, then from my point of view, this is a bug. As the bindind uses the OpenMUC implementation, it should also support the OBIS codes.

getId
public java.lang.String getId()
Returns the ID/Address of this data set. The ID is usually an OBIS code of the format A-B:C.D.E*F or on older EDIS code of the format C.D.E.that specifies exactly what the value of this data set represents. C is the type of the measured quantity (e.g 1 = positive active power), D describes the measurement mode and E is the tariff (e.g. 0 for total or 1 for tariff 1 only) associated with this value.
Returns:
the ID. If this data set contains no id this function returns the empty string.

(https://www.openmuc.org/projects/j62056/javadoc/)

As you can see in my first posting, the communication with the meter seems to be OK, data is coming in. Only the binding seems to interpret this in a wrong way. This makes sense, as the binding author brings some examples of using the binding, but only bringing 'iec6205621meter="meter1:1.8.1"' as example. But as from OpenMUC, these are the 'old' EDIS codes, not the (newer) OBIS codes.

regards
Daniel

@steve-bate
Copy link
Contributor

@kreutpet Any comments on this issue?

@kreutpet
Copy link
Contributor

Hi all,

oh yes I see. The issue is that the item configuration uses ":" to separate the meter name from the OBIS code.
If the OBIS code can contain ":" as been described in the getId() we run into the issue.
So sorry , it is an error.

So the only way out is to use a different separation string in the item binding configuration.
Not sure which string is used on other bindings , any suggestions?

/kreutpet

@Puncher4444
Copy link
Author

Hello @kreutpet ,

thanks a lot for your feedback! Well, unfortunately I´m not a developer and I´m not into programming.
We cant use ":" and "-", as it can be part of the EDIS/OBIS code.
Could you use a ";" or "," instead? Like:

{ iec6205621meter="meter1;1-0:1.8.0*255" }

What I´ve also seen at other bindings could be something like this:

{ iec6205621meter="meter1", OBIS="1-0:1.8.0*255" }

Would that be an option?

regards
Daniel

@kreutpet
Copy link
Contributor

Hi Daniel,

unfortunately I do not have a IDE up an running to implement the change.
For 1.x version of openhab I had big difficulties to get this up and running.
is there anybody else here who has the IDE up and running and could implement the change.

Change need to be implemented in
https://github.com/openhab/openhab/blob/master/bundles/binding/org.openhab.binding.iec6205621meter/src/main/java/org/openhab/binding/iec6205621meter/internal/Iec6205621MeterGenericBindingProvider.java

public void processBindingConfiguration(String context, Item item, String bindingConfig) 
             throws BindingConfigParseException { 
         super.processBindingConfiguration(context, item, bindingConfig); 
         Iec6205621MeterBindingConfig config = new Iec6205621MeterBindingConfig(); 
         StringTokenizer tokenizer = new StringTokenizer(bindingConfig.trim(), ";"); 
         String[] tokens = new String[tokenizer.countTokens()]; 
         for (int i = 0; i < tokens.length; i++) { 
             tokens[i] = tokenizer.nextToken(); 
         } 
         config.meterName = tokens[0].trim(); 
         config.obis = tokens[1].trim(); 
         config.itemType = item.getClass(); 
         addBindingConfig(item, config); 

The only change is in line "StringTokenizer tokenizer = new StringTokenizer(bindingConfig.trim(), ";"); "

I am not sure it you can also change this in the jar file directly for test purposes.

Then a
Number Strom "Zählerstand [%d]" (gVerbrauch) { iec6205621meter="meter1;1-0:1.8.0*255" }
should work.
At least as a first guess it looks promising.

BR
kreutpet

@kreutpet
Copy link
Contributor

Hi Daniel,

again tried to get IDE up and running . major improvement has been done here.
I have been able to change the separation string to ";"
Please rename the file extension of attached file from pdf to zip.
then unzip and you should get the jar file to do a test.
let me know if the problem is resolved

/kreutpet

org.openhab.binding.iec6205621meter.pdf

@Puncher4444
Copy link
Author

Hi @kreutpet

well, what can I say - its working now! :)

21:45:40.765 [DEBUG] [o.b.i.i.Iec6205621MeterBinding:128  ] - Updating item Strom with OBIS code 1-0:1.8.0*255 and value 0002069.984
21:45:40.767 [INFO ] [runtime.busevents             :26   ] - Strom state updated to 2069.984

Really, thanks a lot!!!
You may need to pull this change up, so the official bindings gets updated. Also probably need to change the example on the wiki page by then.

regards
Daniel

@kreutpet
Copy link
Contributor

That's great to hear.
I will do the other changes in the doc and issue a pull request.

thx
kreutpet

teichsta pushed a commit that referenced this issue May 2, 2016
IEC-62056-21 Binding: Support for ISKRA MT174 OBIS Codes 
OBIS code of the format A-B:C.D.E*F conflict with item configuration in which conflicts with separation string in item configuration
teichsta pushed a commit that referenced this issue May 6, 2016
IEC-62056-21 Binding: Support for ISKRA MT174 OBIS Codes
OBIS code of the format A-B:C.D.E*F conflict with item configuration in which conflicts with separation string in item configuration

cherry-picked from #4281

Signed-off-by: Thomas Eichstädt-Engelen <thomas@openhab.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants