cyrilcc / org.openhab.binding.rflink

RFLink binding for OpenHAB 2.0
23 stars 32 forks source link

Wrong switch command send from Openhab to wall plug #47

Closed mpietrusa closed 5 years ago

mpietrusa commented 5 years ago

Hi, I am using cartemere/org.openhab.binding.rflink Travis Build 39 - 18.02.2019 21:33 - v2.3.0 The problem what I have found is related with send command to switch with protocol Tristate. When I press button on remote I see in openhab: 13:13:37.521 [DEBUG] [flink.connector.RfLinkSerialConnector] - <<< 20;10;TriState;ID=808aa1;SWITCH=10;CMD=ON; 13:13:37.531 [DEBUG] [ng.rflink.handler.RfLinkBridgeHandler] - Message received: Raw data = 20;10;TriState;ID=808aa1;SWITCH=10;CMD=ON;, Seq number = 16, Device name = TriState, Device ID = 808aa1-10, Command = ON, Contact = OPEN, running against 9 listeners 13:13:37.538 [DEBUG] [iscovery.RfLinkDeviceDiscoveryService] - Received: bridge: rflink:bridge:gateway message: Raw data = 20;10;TriState;ID=808aa1;SWITCH=10;CMD=ON;, Seq number = 16, Device name = TriState, Device ID = 808aa1-10, Command = ON, Contact = OPEN 13:13:37.548 [DEBUG] [.binding.rflink.handler.RfLinkHandler] - Message from bridge rflink:bridge:gateway from device [TriState-808aa1-10] type [RfLinkSwitchMessage] matched 13:13:37.558 [DEBUG] [.binding.rflink.handler.RfLinkHandler] - Update channel: contact, state: OPEN 13:13:37.568 [DEBUG] [.binding.rflink.handler.RfLinkHandler] - Update channel: command, state: ON 13:13:37.587 [INFO ] [smarthome.event.ItemStateChangedEvent] - TriState_Command changed from OFF to ON When I press item in UI Openhab: 13:12:31.160 [INFO ] [smarthome.event.ItemStateChangedEvent] - TriState_Command changed from OFF to ON 13:12:31.200 [DEBUG] [ng.rflink.handler.RfLinkBridgeHandler] - Transmitting message 'Raw data = unknown, Command = ON, Contact = OPEN' 13:12:31.224 [DEBUG] [ing.rflink.messages.RfLinkBaseMessage] - Decoded message to be sent: 10;TriState;00808aa1;10;ON;, deviceName: TriState, deviceChannel: 808aa1, primaryId: 10 13:12:31.246 [DEBUG] [flink.connector.RfLinkSerialConnector] - Send data (after 0ms, len=28): 31303B54726953746174653B30303830386161313B31303B4F4E3B0A 13:12:31.717 [DEBUG] [flink.connector.RfLinkSerialConnector] - <<< 20;09;OK; 13:12:31.726 [DEBUG] [ng.rflink.handler.RfLinkBridgeHandler] - Message not supported, data: 20;09;OK; The problem is Openhab send 10;TriState;00808aa1;10;ON; instead 10;TriState;808aa1;10;ON;

Please solve the problem it blocks me to move to openhab because my switches not work

cartemere commented 5 years ago

Hello mpietrusa :)

Can you describe more precisely the issue. From the log, I don't see any unexpected behavior.

The Thing identifier is indeed mapped on a 8 character label (so the thing Id is completed by ZEROs at the beginning if it is shorter), but it does not seems to cause any issue with the RfLink bridge, even if the official RfLink documentation is not very precise on this specific point. Anyway, this way of doing works without issue on other setup : the RfLink bridge is able to match the correct instruction.

You get a warning with the Message not supported, data: 20;09;OK; but if comes from the DEBUG mode activated on your bridge, which sends a verbose confirmation message on each command sent. This should not be taken into account (and is fixed on my local repository, I will push it in the next days)

mpietrusa commented 5 years ago

Hi Cartemere, First thanks for quick respond. Now becuase it not work directly in openhab I tested yesterday nodered. When I sent them same message which openhab sent: "10;TriState;00808aa1;10;ON;" on nodered (direct do serial port) then it now worked at all. However when I send "10;TriState;808aa1;10;ON;" it worked so in my opinion it seems that it is related with ZEROs in beginning at least for my wall plugs. If you want any more information or to test something please give me istruction so I would test it with pleasure

cartemere commented 5 years ago

Hi mpietrusa, I just pushed a fix for your case : the deviceId is now mapped on 6 chars if it is <= 6 char long, and to 8 chars if it is 7 or 8 char long. This way, you will send 6 char identifier in your case. And deviceIds with long encoding will continue to work.

mpietrusa commented 5 years ago

Hi Cartemere, So great news I am waiting for jar to be generated. As soon as I test I will inform you.

cartemere commented 5 years ago

ok. Keep me in touch. i made a quick unit test, and it seems to give the expected result

mpietrusa commented 5 years ago

Hi again, I have tested right now and now my six wall plugs work fine. 23:14:48.884 [DEBUG] [.binding.rflink.handler.RfLinkHandler] - Received channel: rflink:switch:gateway:Rf433_Switch_1411_1:command, command: OFF 23:14:48.895 [INFO ] [arthome.event.ItemStatePredictedEvent] - Rf433_Switch_1411_1 predicted to become OFF 23:14:48.904 [INFO ] [smarthome.event.ItemStateChangedEvent] - Rf433_Switch_1411_1 changed from ON to OFF 23:14:48.910 [DEBUG] [.binding.rflink.message.RfLinkMessage] - Decoded message to be sent: 10;TriState;808aa1;10;OFF;, deviceName: TriState, deviceChannel: 808aa1, primaryId: 10 23:14:48.923 [DEBUG] [flink.connector.RfLinkSerialConnector] - >>> 10;TriState;808aa1;10;OFF; 23:14:48.941 [DEBUG] [.binding.rflink.handler.RfLinkHandler] - Update channel: contact, state: CLOSED 23:14:48.946 [DEBUG] [.binding.rflink.handler.RfLinkHandler] - Update channel: command, state: OFF 23:14:49.198 [DEBUG] [flink.connector.RfLinkSerialConnector] - <<< 20;17;OK; Many thanks for solved my problem! It is fantastic that what you do!