RFXCOM Cheap PIR Sensor Binding in Openhab2

Hey Ari,

I’ve bought the same PIR Sensors and they work very good and last long.

The solution to your problem is very simple. You need to set the Data Jumpers inside your PIR accordingly, so that they do not send a command which is UNKNOWN to rfxcom, but to ON. This will switch a Switch item to ON. (I believe, it would also CLOSE a contact, if used, but I only use switches).

Switch D1 to LOW: Remove all the jumpers from D0-D3 and place one Jumper to the left and middle row, in the D1 column. Just have a look at my picture and it will be clear.

This will cause to set the Switch to ON in OpenHAB. The good thing is: You can make yourself a rule to start a Timer to switch it off again after a few minutes. Presence-detection done.

If you need sophisticated examples using OpenHABs Timer Implementation, I’d be happy to provide them to you (all), if wanted.

Enjoy!

Thanks @pauli_anttila,

I allready installed the development environment, but setting all up was bit to much for time I have available now. Maybe some future weekend I will do this.

I am indeed from Finland so went to Clas Ohlson to buy this. It works and and fullfills my needs. Thanks for the tip.

I suppose you are also from Finland?

Hello @gersilex,

and thanks for help. It seems that I have a different version than you

So there is no jumpers. There might be in the other side, but I don’t want to break sensor.

It looks like you have the ev1527 learning code type. (simple comparison)

I never used those, it’s way harder because you can’t just configure them, but you have way more different codes to “choose” ( or better “learn”) from.

Have a search for ev1527 and openhab or rfxcom. I’m sure that some people use them as well. Good luck!

I installed development environment and copied the behaviour from rfxcom RFXComLighting4Message 1.0 to 2.0. Now PIR and Smoke detector sensor works in my dev machine.

@pauli_anttila so basically I just coped the encodeMessage and decodeMessage from 1.0 to 2.0. Is this feasible solution?

If this was a feasible solution, just wondering what should should be my next steps.

@Ari_Hagman, I just tried to fix Lightning4 message issue for OH2 (Openhab 2 with rfxcom 1 binding! (2 did not work at all)). I don’t have any Lighting4 devices my self, so could you double check the code and test it before I make PR?

Hello,

@pauli_anttila thanks for the quick response.

yes sure I can do the testing for my items. Just one beginner question:

What is the easiest way the get your changes to my development environment?

–Ari

You should be able to pull my changes directly from my repo (rfxcom-lighting4-fixes branch). Just click right button on Package Explorer → Team - Pull… → introduce new remote (GitHub - paulianttila/openhab-addons: The next-generation open Home Automation Bus (openHAB)). Reference should be rfxcom-lighting4-fixes branch.

Basically, I have just modified one file, so it could be easier to just copy content directly.

I will test this tonight or tomorrow.

What was the purpose of lightning4.xml?

XML file describes configuration variables to openhab. I just fixed one description field in xml, which does not have any functional changes.

Hello @pauli_anttila,

sorry been busy with other stuff, but today I managed to do the testing.

I had those 2 devices and both of them worked so, that they created 2 items over time. I sent the signal with different distances. Maybe that was having the impact?

LIGHTING4-119125.489
LIGHTING4-119125.491

Packettype = Lighting4
subtype = PT2262
Sequence nbr = 1
Code = 1D155C decimal:1906012
S1- S24 = 0001 1101 0001 0101 0101 1100
Pulse = 491 usec
Signal level = 7 -64dBm

and

LIGHTING4-694940.417
LIGHTING4-694940.419

Packettype = Lighting4
subtype = PT2262
Sequence nbr = 0
Code = A9A9C9 decimal:11119049
S1- S24 = 1010 1001 1010 1001 1100 1001
Pulse = 419 usec
Signal level = 7 -64dBm

@Ari_Hagman, thanks for the testing. I just copied idea from the OH1 binding, where pulse is part of the unit id. If pulse can be changed, then this broach doesn’t work on OH2 as it generate a new thing for every individual device id (it doesn’t work on OH1 either). I don’t have any clue, what is the purpose of this pulse is lighting4 messages and how it should be used.

So this have impact to the pulse, but what do you mean by distance?

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