openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.69k forks source link

RFXCOM Add binding support for OWL CM113, Electrisave, cent-a-meter #2772

Closed BoydHitchcock closed 8 years ago

BoydHitchcock commented 9 years ago

Is there a possibility that OWL - CM113 could be added to the RFXCOM binding.

openhab error = 08:46:07.931 [ERROR] [.rfxcom.internal.RFXComBinding:279 ] - Error occured during packet receiving, data: 0D59010C8900070000001A000079 org.openhab.binding.rfxcom.internal.RFXComException: Message CURRENT not implemented at org.openhab.binding.rfxcom.internal.messages.RFXComMessageFactory.getMessageInterface(RFXComMessageFactory.java:121) ~[bundlefile:na]

from rfxmngr the packet is = 03/05/2015 08:49:43 Packettype = CURRENT subtype = ELEC1 - OWL CM113, Electrisave, cent-a-meter Sequence nbr = 0 ID = 35072 Count = 0 Channel 1 = 0 ampere Channel 2 = 2.6 ampere Channel 3 = 0 ampere Signal level = 5 Battery = OK

Speederc commented 9 years ago

Hi BoydHitchcock, I prepared 2 files to add this CM113 support but unfortunately I'm not able to compile them before next week. Are you able to do it ? If yes the files are there : https://github.com/Speederc/openhab/blob/Speederc-RfxComCM113/bundles/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComCurrentMessage.java https://github.com/Speederc/openhab/blob/Speederc-RfxComCM113/bundles/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/RFXComValueSelector.java I hope that it works ! The value can be retrieve by the item using "Channel1Amps", "Channel2Amps", "Channel3Amps"

BoydHitchcock commented 9 years ago

Hi Speederc, Thank you for producing the files, I will give it a go compiling and let you know the result.

BoydHitchcock commented 9 years ago

Hi Speederc,

I have a compilation error for the following lines:- data[7] = (byte) (((channel1Amps * 10.0) >> 8) & 0xFF); data[8] = (byte) ((channel1Amps * 10.0) & 0xFF); data[9] = (byte) (((channel2Amps * 10.0) >> 8) & 0xFF); data[10] = (byte) ((channel2Amps * 10.0) & 0xFF); data[11] = (byte) (((channel3Amps * 10.0) >> 8) & 0xFF); data[12] = (byte) ((channel3Amps * 10.0) & 0xFF); e.g.

[ERROR] /home/boyd/openhab-master/bundles/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComCurrentMessage.java:[145] [ERROR] data[7] = (byte) (((channel1Amps * 10.0) >> 8) & 0xFF); [ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [ERROR] The operator >> is undefined for the argument type(s) double, int

Currently trying to compare against other message files.

Boyd

Speederc commented 9 years ago

It should work with data[7] = (byte) (((int)(channel1Amps * 10.0) >> 8) & 0xFF); for example. Otherwise I will compile it on Wednesday.

BoydHitchcock commented 9 years ago

Hi Speederc Correct works fine with the suggestion. I also adjusted, public byte[] decodeMessage() { byte[] data = new byte[13];

items= /* ELEC1 - OWL CM113, Electrisave, cent-a-meter */ Number Owl_Amps { rfxcom="<35072:Channel2Amps" } String Owl_raw { rfxcom="<35072:RawData" }

Then from the openHab.log 2015-06-28 18:20:56 - Owl_Amps state updated to 4.29999999999999982236431605997495353221893310546875 2015-06-28 18:20:56 - Owl_raw state updated to 0D5901208900090000002B000070 2015-06-28 18:21:02 - Owl_Amps state updated to 4.5 2015-06-28 18:21:02 - Owl_raw state updated to 0D5901218900080000002D000070 2015-06-28 18:21:26 - Owl_Amps state updated to 4.70000000000000017763568394002504646778106689453125 2015-06-28 18:21:26 - Owl_raw state updated to 0D5901228900040000002F000070

So it is working for me. Thank you very much for coding the CURRENT message.

Boyd

Speederc commented 8 years ago

Can be closed

teichsta commented 8 years ago

Appreciate your feedback @Speederc!