openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.56k forks source link

[RFXCOM] Lighting4, A not completely supported command #3103

Closed westward closed 6 years ago

westward commented 6 years ago

Context

OpenHAB 2.2 with RFXCOM 2 addon. Some cheap door 433 mHz contact sensors like this: https://www.aliexpress.com/item/6pcs-lot-New-433mhz-While-Wireless-Home-Alarm-Window-Door-Sensor-to-Detect-Open-Door/32463726744.htm1 are connected to OpenHAB via RFXCOM transceiver. These KERUI sensors are decoded by RFXCOM as Lighting4 PT2262 devices and, as I can understand, only sends their state to the system. To properly configure these sensors in OpenHAB, I use the addon’s “Command ID” channel in configuration and rules. Everything works fine there.

However the following INFO messages are written to the events.log: [vent.ItemStateChangedEvent] - DoorSensor_CommandID changed from 7 to 14 [INFO ] [rnal.messages.RFXComLighting4Message] - A not completely supported command with value 14 was received, we can send it but please report it as an issue including what the command means, this helps to extend the binding with better support.

That’s why I created this issue. The mentioned KERUI wireless door/window sensor sends the following Command ID codes (all digits are decimal): 14 - when door is open 7 - when door is closed 11 - when tamper contact is switched (“Tamper” is an intrusion contact when someone opens the sensor case)

Also I want to notice that according to OpenHAB RFXCOM 2 addon, the Lighting4 devices are actuators. But it not always true. As you can see, RFXCOM use Lighting4 to handle some sensors like door contact or infrared motion detectors, that only able to send, not receive come data.

westward commented 6 years ago

Some extra update. I connected other KERUI wireless 433 mHz motion sensor to the system. RFXCOM also decodes it as PT2262 Lighting4 device. This sensor only sends the following when motion is detected: [INFO ] [rnal.messages.RFXComLighting4Message] - A not completely supported command with value 10 was received, we can send it but please report it as an issue including what the command means, this helps to extend the binding with better support.

westward commented 6 years ago

Sorry, I'm not sure it's a good idea, but when it's difficult to update the RFXCOM2 binding with all these commands, maybe it's possible to create an option to suppress these log events to not spam into the log?

martinvw commented 6 years ago

No problem, I added the warning there so we can extend it.

Could you switch the binding to debug mode, via karaf console log:set DEBUG org.openhab.binding.rfxcom and report one or some messages which are actually retrieved.

westward commented 6 years ago

Here it is, a KERUI 433 mHz door wireless sensor :

2018-01-10 21:37:35.436 [INFO ] [rnal.messages.RFXComLighting4Message] - A not completely supported command with value 14 was received, we can send it but please report it as an issue including what the command means, this helps to extend the binding with better support.

2018-01-10 21:37:35.443 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Message received: Raw data = 09130009232D2E013970, Packet type = LIGHTING4, Seq number = 9, Sub type = PT2262, Device Id = 144082, Command = UNKNOWN(14), Pulse = 313

2018-01-10 21:37:35.447 [DEBUG] [binding.rfxcom.handler.RFXComHandler] - Received message from bridge: rfxcom:bridge:f3d18fac message: Raw data = 09130009232D2E013970, Packet type = LIGHTING4, Seq number = 9, Sub type = PT2262, Device Id = 144082, Command = UNKNOWN(14), Pulse = 313

==> /var/log/openhab2/events.log <==

2018-01-10 21:37:35.464 [vent.ItemStateChangedEvent] - BedroomDoorSensor_CommandID changed from 7 to 14

==> /var/log/openhab2/openhab.log <==

2018-01-10 21:37:39.540 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Message received: Raw data = 0913000A232D27013B70, Packet type = LIGHTING4, Seq number = 10, Sub type = PT2262, Device Id = 144082, Command = ON_7(7), Pulse = 315

2018-01-10 21:37:39.564 [DEBUG] [binding.rfxcom.handler.RFXComHandler] - Received message from bridge: rfxcom:bridge:f3d18fac message: Raw data = 0913000A232D27013B70, Packet type = LIGHTING4, Seq number = 10, Sub type = PT2262, Device Id = 144082, Command = ON_7(7), Pulse = 315

==> /var/log/openhab2/events.log <==

2018-01-10 21:37:39.602 [vent.ItemStateChangedEvent] - BedroomDoorSensor_CommandID changed from 14 to 7

==> /var/log/openhab2/openhab.log <==

2018-01-10 21:38:19.220 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Checking RFXCOM transceiver connection, thing status = ONLINE

westward commented 6 years ago

And the motion wireless sensor:

2018-01-10 21:40:29.653 [INFO ] [rnal.messages.RFXComLighting4Message] - A not completely supported command with value 10 was received, we can send it but please report it as an issue including what the command means, this helps to extend the binding with better support.

2018-01-10 21:40:29.658 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Message received: Raw data = 0913000B4E462A012280, Packet type = LIGHTING4, Seq number = 11, Sub type = PT2262, Device Id = 320610, Command = UNKNOWN(10), Pulse = 290

2018-01-10 21:40:29.662 [DEBUG] [binding.rfxcom.handler.RFXComHandler] - Received message from bridge: rfxcom:bridge:f3d18fac message: Raw data = 0913000B4E462A012280, Packet type = LIGHTING4, Seq number = 11, Sub type = PT2262, Device Id = 320610, Command = UNKNOWN(10), Pulse = 290

2018-01-10 21:40:39.877 [INFO ] [rnal.messages.RFXComLighting4Message] - A not completely supported command with value 10 was received, we can send it but please report it as an issue including what the command means, this helps to extend the binding with better support.

2018-01-10 21:40:39.881 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Message received: Raw data = 0913000C4E462A011F80, Packet type = LIGHTING4, Seq number = 12, Sub type = PT2262, Device Id = 320610, Command = UNKNOWN(10), Pulse = 287

2018-01-10 21:40:39.885 [DEBUG] [binding.rfxcom.handler.RFXComHandler] - Received message from bridge: rfxcom:bridge:f3d18fac message: Raw data = 0913000C4E462A011F80, Packet type = LIGHTING4, Seq number = 12, Sub type = PT2262, Device Id = 320610, Command = UNKNOWN(10), Pulse = 287

2018-01-10 21:40:47.320 [INFO ] [rnal.messages.RFXComLighting4Message] - A not completely supported command with value 10 was received, we can send it but please report it as an issue including what the command means, this helps to extend the binding with better support.

2018-01-10 21:40:47.324 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Message received: Raw data = 0913000D4E462A012260, Packet type = LIGHTING4, Seq number = 13, Sub type = PT2262, Device Id = 320610, Command = UNKNOWN(10), Pulse = 290

2018-01-10 21:40:47.328 [DEBUG] [binding.rfxcom.handler.RFXComHandler] - Received message from bridge: rfxcom:bridge:f3d18fac message: Raw data = 0913000D4E462A012260, Packet type = LIGHTING4, Seq number = 13, Sub type = PT2262, Device Id = 320610, Command = UNKNOWN(10), Pulse = 290

westward commented 6 years ago

Martin, thank you so much for your hard work and lightweight answer to this issue!

Could you please suggest how to switch back the log to it's usual state without rebooting the PI3 system? :)

martinvw commented 6 years ago

rebooting will not help anyway ;-)

log:set DEFAULT org.openhab.binding.rfxcom will do the job

westward commented 6 years ago

Haha, nice! Like it. Will study docs how to suppress something in the log when something will be annoying.

westward commented 6 years ago

Hi Martin! I received a notification that you made some changes to the RFXCOM binding and they are approved and merged into the project. Nice! Thank you. I'm very interesting, is there a way to upgrade somehow my RFXCOM binding to use your latest changes? On my PI3 the OpenHAB 2.2.0 stable is installed. I don't want to switch the whole system to snapshot or other unstable build, but will be nice to upgrade only one concrete binding.

martinvw commented 6 years ago

Yes, you can see here:

https://community.openhab.org/t/frequently-asked-questions-faqs/17727#addons-1

https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.rfxcom/2.3.0-SNAPSHOT/

westward commented 6 years ago

Martin, Sorry but that FAQ doesn't works on my Raspberry PI 2.2 installation. When RFXCOM 2.2 binging is uninstalled in Paper UI, it disappears in Karaf console, so according to step 4) the command bundle:list -s doesn't show the RFXCOM binding. The command bundle:uninstall org.openhab.binding.rfxcom doesn't works too.

Nevertheless I tried to place the new org.openhab.binding.rfxcom-2.3.0-SNAPSHOT.jar into /addons folder, restart the OpenHAB and whole system - nothing works. The 2.3 binding doesn't appears in the Paper UI neither in Karaf console. Finally I surrender and installed back the 2.2. binding in Paper UI.

Have you any idea? Maybe there is other way, or maybe since some OpenHAB release the mentioned FAQ is no valid anymore? Thanks in advance!

westward commented 6 years ago

After some browsing on forum I found a solution. It's linux permissions, need to change the JAR owner to openhab. The trouble is fixed, sorry for disturbance. :)

martinvw commented 6 years ago

Great, I did not feel disturbed and thanks for giving some hints here how you resolved, it will most likely help others as well! Thanks

I-am-stefan commented 6 years ago

Hi Martin,

I have a problem with the rfxcom binding in file openhab2-addons/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComRfyMessage.java:

In the case structure for VENETIAN_BLIND the commands are not working for the European Version from somfy and the type IncreaseDecrease will not work because it sends an number and not the command.

So I need some changes like this (changes are bold):

case CHANNEL_VENETIANBLIND: if (type instanceof OpenClosedType) { this.command = (type == OpenClosedType.CLOSED ? Commands.DOWNLONG: Commands.UP_LONG); } else if (type instanceof OnOffType) { this.command = (type == OnOffType.ON ? Commands.DOWN_LONG : Commands.UP_LONG); } else if (type instanceof UpDownType) { this.command = (type == UpDownType.DOWN ? Commands.DOWN : Commands.UP); } else if (type instanceof StopMoveType) { this.command = RFXComRfyMessage.Commands.STOP; } else if (type instanceof IncreaseDecreaseType) { this.command = (type == IncreaseDecreaseType.INCREASE ? Commands.DOWN_LONG : Commands.UP_LONG); } else { throw new RFXComUnsupportedChannelException("Can't convert " + type + " to Command"); } break;

I have tried to do these changes but I am not able to compile the addons correctly for dropping in the addons folder.

So can you give me some hints for correct compiling. And it is possible to add an new case block like CHANNEL_VENETIAN_BLIND_EU to be compatible with the actual version?

Thanks in advance and...

martinvw commented 6 years ago

@I-am-stefan can you please create a separate issue for your problem, if you are certain about the code changes a pull request is of course welcome as well.