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?
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.
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.
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.
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.
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 .
[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).
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:
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.
Whaaat?
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.