RFXCOM Cheap PIR Sensor Binding in Openhab2

Hello,

I ordered cheap PIR Sensor for testing.

In rfxmngr I recive following message:

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

And in openhab log:

2016-08-27 10:42:59.281 [DEBUG] [binding.rfxcom.handler.RFXComHandler] - Received message from bridge: rfxcom:bridge:ecc6de52 message: Raw data = 0913005FA9A9C901A170, Packet type = LIGHTING4, Seq number = 95, Sub type = PT2262, Device Id = 11118860, Command = UNKNOWN, Pulse = 417

2016-08-27 10:43:21.785 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Message received: Raw data = 09130060A9A9C901A170, Packet type = LIGHTING4, Seq number = 96, Sub type = PT2262, Device Id = 11118860, Command = UNKNOWN, Pulse = 417

I’m using openhab2 beta 3.

Is there any way to make rfxcom binding to work with this pir sensor?

For me It would be just fine if I could catch this message in the rules file

I alsos have a fire alarm that is having same “issue”

So in rfxmngr

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

And in openhab log:

2016-08-27 11:45:46.872 [DEBUG] [binding.rfxcom.handler.RFXComHandler] - Received message from bridge: rfxcom:bridge:ecc6de52 message: Raw data = 091300021D155C01E960, Packet type = LIGHTING4, Seq number = 2, Sub type = PT2262, Device Id = 1905925, Command = UNKNOWN, Pulse = 489

2016-08-27 11:45:46.872 [ERROR] [binding.rfxcom.handler.RFXComHandler] - Error occured during message receiving:

Lightning4 message seems to be manufacture specific. Code (S1-S24) can probably be anything (at least RFXCOM spec does not specifies it). Currently RFXCOM binding parse first 5 nibbles from the code as a device id and last nibble as command. Your device send code where last nibble is 0xC and this is not recognised by the 2.0 binding.

2.0 binding seems to have also bug in the device id parsing.

RFXCOM 1.0 binding have wider support nowadays for the command nibble. So most probably that should solve your problem (device id bug should also be fixed).

1.0 Lighting4 code:

https://github.com/openhab/openhab/blob/master/bundles/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComLighting4Message.java

2.0 Lighting4 code:
https://github.com/openhab/openhab2-addons/blob/master/addons/binding/org.openhab.binding.rfxcom/src/main/java/org/openhab/binding/rfxcom/internal/messages/RFXComLighting4Message.java

I had a similar issue. Since a lot of Lighting4 433mhz only send a single command I use the following items: note I changed the device id for your situation

String Motion1Raw “Raw Data [%s]” { rfxcom="<11118860:RawData" }
Switch Motion1 “Master Bath Motion PIR”

And the rule is:
rule “433 Motion Control”

when
	Item Motion1Raw changed

then
	sendCommand(Motion1,ON)
	Thread::sleep(10000)
	sendCommand(Motion1,OFF)

end

Hope it works for you.

@jcf6288 RawData only works with RFXCOM 1.0 binding. @Ari_Hagman use 2.0 binding.

Thanks, @pauli_anttila and @jcf6288.

@pauli_anttila, sorry just bit confused here. So should I use 1.0 or 2.0 binding? Or are you saying that openhab2 beta 3 has some bugs that will be fixed at some point?

BTW do you know any cheap PIR sensors that I can order that works in openhab2 and rfxcom binding.

–Ari

@pauli_anttila sorry to bother you more, but is there any possibility to make these items work in openhab2?

is there any possibility to make these items work in openhab2?

You could try OH1 binding and see if it works better with Lightning4 messages. Anyway, RFXCOM v2.0 binding’s Lightning4 message support should be fixed (device id problem) and extended to support more commands. Pull request are always welcome (Lightning4 message handling differences between OH1 and OH2 bindings could be easily find and fixed from files which I linked my early post.

BTW do you know any cheap PIR sensors that I can order that works in openhab2 and rfxcom binding.

Your name sound Finnish? E.g. all Nexa devices should work very well with rfxcom binding and they are sold e.g. by the Clas Ohlson. All nexa devices are using Lightning2 messages.

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 (https://github.com/paulianttila/openhab2-addons/). 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?