How to connect generic PIRs to OpenHAB?


I would really like to use generic PIRs with OpenHAB (not just the ones that can sit on an Arduino or RPi), like this one -Luxomat RC-plus next 230 - what ways have folks here found to do it? or perhaps an idea how to?


The desired functionality is that:

  • the PIR’s signals to the security lights turning them on/off are intercepted by a “box” which communicates with OpenHAB
  • OpenHAB can also switch these lights on independently
  • OpenHAB knows that the lights are on or off (i.e. doesn’t have to recall the state of the PIR)

I’m new to OpenHAB and home automation in general, though I’m in the early stages of a mplete home renovation, so can run cables wherever needed.

What output or communication protocol do these have? That is the biggest factor as to how easy these would be to connect.

One easy way would be wire a sonoff in parallel this would allow openHAB to turn on and off. No feedback on the motion side though.

Yes you can, by wiring the output of the sensor to the pin 14 of the sonoff


Your question is overall inadequate in technical terms (I’m sorry for the rudeness)!
For clarity:
You are asking for a contact/switch to be integrated in openHAB, which as a question might be understandable for some of the openHAB users without the minimum understanding of what openHAB is!
I would like to be wrong saying this: whoever mislead you that openHAB can have you blanket covered in terms of not investing in hardware, was wrong!
The bindings themselves offer a lot of opportunities for a contact/switch to be integrated! All you need is the necessary hardware!

1 Like

Thanks! I’d not heard of Sonoff before, it looks an ideal component for my home system.

I don’t know what output or comms protocol exist in generic PIRs, nor this Luxomat one and I don’t have enough electrical knowledge to glean this from the installation manual.

It looks like you misunderstood my request or I wasn’t clear enough. Firstly though I am a complete HA newbie with minimal electrical expertise (I am comfortable replacing sockets, but that’s it so far). I have a very experienced electrician onsite who is doing all the installs. Back to the question, I would not know what technical terms you are alluding to.

I do expect to invest in hardware! That was what I meant when I said 'intercepted by a “box” which communicates with OpenHAB’ . Looking at Sonoff, there seem to be two options that could suit my needs and integrate with OpenHAB: Sonoff POW (inline switch) and Sonoff 4CH (in my home’s Consumer Unit / Fuse Box).

It would be great to benefit from talking with people who have integrated stand-alone PIRs with OpenHAB via Sonoff - is this the best sub-forum to find them?

Looking at the PIR you showed in your first post, they need power. Normal AC power seems to be what they need. Upon detection, they will close a contact. This switching can be detected in a number of way. Your conumdrum is how to feedback this switching to OH.

That can be done in a number of ways.

  • Your electrician can run a cable back to your cabinet where all the switching wire are then connected to a cheap and cheerful arduino and an arduino sketch can then publish the states of your PIRs to mqtt. OH can then read the mqtt messages
  • Because there is power going to the PIR you can get a simple sonoff (You don’t need the POW or the 4CH) connected to the power and then detect the PIR switch and feed back via MQTT to openHAB. The drawback is that each sonoff needs to connect to wifi, so you need a good wifi router for the house.
1 Like

The problem with a standalone PIR (providing a contact) is that you only get the contact status, you can not modify brightness parameters, delay times and/or re-triggering conditions (the standalone PIR’s have this settings provided on themselves without a possibility to remotely modify them). If you do not wish to ever modify this settings remotely, then you need to use an input module (to monitor the contact of the PIR), which AFAIK does not exist in the sonoff world yet! The only workaround is to use the sonoff TH and provide a different resistance for when the PIR contact is closed or open. Of course isolation from mains power is required!
Try other ESP based devices that have inputs.

1 Like

This is incorrect.
Your can flash the sonoff and connect the PIR output to the spare pin on the board and monitor the input. Tasmota does that very well.


In your first suggestion, to be clear, do you mean an Arduino (+ non-Sonoff hardware bits) would achieve this in the electrical cabinet?

I was thinking about the network topology too, whether a dedicated, strong WiFi network - seperate from the normal WiFi/wired non-HA network - is a good idea.

The other problem with the sonoff solution, if your PIRs are outside is that the sonoff are NOT rated for external work and would have to be put in a weather proof box.

Yep, I should have said, this set of PIRs will be outside. The power feed is from the loft, so each basic Sonoff could be inside the loft - or maybe outside in one of the Sonoff IP66 boxes.

The range of Sonoff devices is fabulous and reasonably priced: very exciting.

OK, it seems that you have decided to go with the sonoff solution.
I recommend that you flash that Tasmota firmware on them.

But make sure that you have a good Wifi router in the house. Poor wifi connections reduces the sonoff lifetime and they will fail.

Read the MQTT for openhab docs and 101:

And finally this one:

Thank you very much for those set of links. It is good to be advised on a set of docs to start with (there are so many to choose from, when you don’t know!).

Yes, the Sonoff solution would allow me to switch on all the lights manually if needed, which is part of my user requirements. Thanks again.

@gr1nch may I suggest you also watch some youtube videos on the topic. Look at youtube for Sonoff and openhab. Plus MQTT. For example here is a great mqtt tutorial i ran across yesterday.

An overide switch. Similiar to how I was originally talking hooking up your pir.

BEG Luxomat make a KNX version of the sensor that you mentioned. There are also many others.

All you would need is the KNX bus cable at the sensor position. The relay actuator would be located elsewhere.

I guess he is after some cheap stuff … otherwise he would have bought some smart sensors/actors and not tinker around with generic ones :grinning:

1 Like

Do you have evidence too back this up? why does it do that? are other devices effected like tp-smart WiFi sockets?

A couple of my switches failed after a while. I think it is because of power demands on the WiFi transceiver in the sonoff. I don’t know if other devices are affected.
There are other posts about this.