RFXCOM Cheap PIR Sensor Binding in Openhab2

Thanks @pauli_anttila,

I try to do more detailed testing on next weekend to check that if the signal level actually had an impact to pulse / unit id.

Do you know any documentation that would have info about the lightning4 details? Only docs that I was able to find was rfxcom docs. There were some details about identifying id for different lightning4 devices. I will also read those more thought on next weekend.

These devices vary heavily with their pulse frequency. Mostly when they partly overlap with another device (they usually repeat their messages up to 7 times to ā€œensureā€ the message gets heard. Also it depends a lot on the ambient temperature and humidity of the room.

IMHO the pulse width should not be included into the thing ID. The device ID is the only interesting part anyways.

Yes, that would probably help with my cheap sensors, but maybe there was a reason to use the pulse in the first place? That is the question that some else needs to answer.

I have now spent few hours googling and I have not found any documentation that could help sort this out. @pauli_anttila do you have opinion about this?

Unfortunately no. Thatā€™s why I asked your help :wink:

If pulse is somehow mandatory and varies, switch item canā€™t be used. One possibility is to remove pulse from device ID and use static pulse value for normal ON/OFF commands and then introduce another number channel, which could be used to send commands with different pulse values. So e.g. integer value (hex) yxxxx, where y is command (on/off) and rest are pulse value.

Hello @pauli_anttila ,

I just received a cheap PIR sensor which works via the lighting4 protocol and I can confirm that it should not include the pulse-id in the device-id.

The strange thing is that the openHAB 1 binding includes the pulse id for output but not for input. And it will not work for input because it varies in a small range. However maybe some actors who run the Lighting4 protocol might require a proper value to be able to control them.

Could we also make it asymmetric in OH2?

A detected sensor is stored without pulse and if you want to add an output you can (optionally) add the pulse.

Note in OH1 my config looks like this:

Contact cheap_motion_sensor (gMyOpenHAB, gSyncToOH2) { rfxcom="<286169:Contact", expire="4s,CLOSED" }
Switch cheap_motion_sensor_2 (gMyOpenHAB, gSyncToOH2) { rfxcom="<286169:Command", expire="4s,OFF" }
Number cheap_motion_sensor_signal_level (gMyOpenHAB, gSyncToOH2)  { rfxcom="<286169:SignalLevel" }
String cheap_motion_sensor_rawData (gMyOpenHAB, gSyncToOH2) { rfxcom="<286169:RawData" }

Or it might be a suggestion to do some rounding, because the pulse might identify the protocol used by the devices but there is some variance in it. In the above sample I see a variance of 2.

With a larger subset of my log I see a range of 389 to 394, we could round the value to 390.

I donā€™t think rounding would be appropiate. Because the Device ID already uniquely identifies the device.

But do you know for sure that we donā€™t need it for sending either.

At this moment the device-id and command are the only properties used for input. For output also the PacketType and SubType are given.

In the OH1 binding the pulse is only required for output. But that does conflict with auto discovery and I think that Things in OH2 are used for both input and output.

Hereby a wiki example for the OH1 binding.

Switch swWallController { rfxcom="<1285:Command" } // receive wireless wall switch
Switch pCoffeeMachine { rfxcom=">1285.315:LIGHTING4.PT2262:Command" } // control wireless outlet

I do think that the following could work:

  • rounding it (to group for auto-discovery)
  • Ignoring it when receiving a message
  • Using the rounded value when sending a message

Sweet, thatā€™s the example I wrote for the wiki :slight_smile:

I now understand your idea about the auto-discovery and that it should for sure ā€˜saveā€™ the pulse length to be able to send data as well.

In this case I agree with your thoughts:

with a little addition that the rounding value should be configurable in terms of defining the pulse width steps (e.g. 5 for pulses of ā€¦, 315, 320, 325, 330, ā€¦) and disabling it using a checkbox or setting pulse width steps to <= 1 .

Hello,

just wonder do we really have a situation that we have 2 different devices with same device id?

If not how about following solution:

  1. identify device (thing) with just devices id
  2. save the pulse as ā€œdefault pulseā€ in thing configuration
  3. when receiving signal relay only the device id
  4. when sending use device id and the default pulse from configuration

But as far as I know the rfxcom things do not have something other type, subtype and device id or can we store anything there?

What is the status of this?

I am getting the following:

[DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Message received: Raw data = 091300E1D8AD59018F70, Packet type = LIGHTING4, Seq number = 225, Sub type = PT2262, Device Id = 14200069, Command = UNKNOWN, Pulse = 399 [DEBUG] [binding.rfxcom.handler.RFXComHandler] - Received message from bridge: rfxcom:bridge:rfxtrx433E message: Raw data = 091300E1D8AD59018F70, Packet type = LIGHTING4, Seq number = 225, Sub type = PT2262, Device Id = 14200069, Command = UNKNOWN, Pulse = 399 [ERROR] [binding.rfxcom.handler.RFXComHandler] - Error occurred during message receiving: Can't convert value UNKNOWN to COMMAND SwitchItem

Can I somehow create a device with that Raw Data ( it always stays the same).

thanks
Daniel

I had some time install the dev environment and play around with code.

In my code RFXComMessage are able to store a default pulse level to the configuration. And In discovery RFXComLighting4Message this value is stored to the thing. See bellow:

So the default pulse is used only when sending the message, but pulse level is not affecting when receiving a message.

That looks good to me, @pauli_anttila does this solution fit into your ideas about how the binding should work and develop?

If pulse length can be constant, yes, this is how it should be done . For me that has been always unclear, as I donā€™t own any Lightning4 devices and RFXCOM spec doesnā€™t say anything about it.

I have an extra Lightning4 fire alarm and motion sensor, I can give those for you as a gift for building (fixing :slight_smile: ) this binding.

Sorry for intruding, but Iā€™m curious as to the progress in being able to send Lightning4 commands? :blush:

Sending works fine, as long as you have the original remote and use your rfxcom to fund the device id and pulse length by yourself.

Whaaat? :grin:
I do have original remote(s), and I have lots of items automatically created when I push the different buttons, but I canā€™t seem to figure out how to transmit using these items. Where do I find a ā€˜step-by-stepā€™?

@Ari_Hagman Will you create a pull request based on these changes or was if for you just a proof of concept?

@pauli_anttila did you have any pending code changes for this, otherwise I should be able to make some time to work on this somewhere in the upcoming week.

@all please supply me with some debug data so I can properly create some unit tests the new changes, I have a motion sensor only so nothing to send data too.