OpenEnergyMonitor - Binding with RFM12Pi

Hello,

I try to use the OpenEnergyMonitor-Binding https://github.com/openhab/openhab/wiki/Open-Energy-Monitor-Binding with my RFM12Pi.
Using the rfm12pigw script, I am able to send received data to the UDP Port, where the Binding is supposed to listen. Well, it does listen but something is wrong with the parsing. This is what I get from the log:

2015-11-16 21:57:02.120 [TRACE] [b.o.i.OpenEnergyMonitorBinding] - Received data
 (len=7): 15EC1800106200
Exception in thread "Thread-25" java.lang.ArrayIndexOutOfBoundsException: 1
        at org.openhab.binding.openenergymonitor.protocol.OpenEnergyMonitorDataP
arser.toShort(OpenEnergyMonitorDataParser.java:113)
        at org.openhab.binding.openenergymonitor.protocol.OpenEnergyMonitorDataP
arser.convertTo(OpenEnergyMonitorDataParser.java:93)
        at org.openhab.binding.openenergymonitor.protocol.OpenEnergyMonitorDataP
arser.parseData(OpenEnergyMonitorDataParser.java:51)
        at org.openhab.binding.openenergymonitor.internal.OpenEnergyMonitorBindi
ng$MessageListener.run(OpenEnergyMonitorBinding.java:199)

when I used this settings in the cfg:

openenergymonitor:udpPort=9997

openenergymonitor:Tiny1=21:U16(0)
openenergymonitor:Tiny2=21:U16(2|1)
openenergymonitor:Tiny3=21:U16(4|3)
openenergymonitor:Tiny4=21:U16(6|5)

I also tried indexing from 1 to 7 or just or just using byte 1-2 but nothing seems to work.

Any input is highly appreciated. Thank you very much in advance

RandomWireMan

First byte is a address (0x15=21), so you only have 6 bytes left for the data. I don’t know you data structure, but you are trying to parse more bytes than message contains. If you message contains 3 16-bit numbers, try

openenergymonitor:Tiny1=21:U16(2|1)
openenergymonitor:Tiny2=21:U16(4|3)
openenergymonitor:Tiny3=21:U16(6|5)

which will parse EC1800106200 to

Tiny1 = 0x18EC = 6380
Tiny2 = 0x1000 = 4096
Tiny3 = 0x0062 = 98

-Pali

Hey Pali,

that helped a lot,

Thank you very much

RandomWireMan