How to connect generic PIRs to OpenHAB?

Has anyone here successfully linked a Sonoff switch with a PIR and, say a lamp, to OpenHAB?

I’m not at the stage to try the KNX route yet, but I’ve got some Sonoff Basics heading my way from eBay UK to try them.

For anyone else interested there’s a discussion here on using Sonoff Basics and PIRs - https://groups.google.com/forum/m/#!topic/sonoffusers/GAv0qnjA04A

And there is the PIR relevant info from Tasmota - https://github.com/arendst/Sonoff-Tasmota/wiki/GPIO-Locations

I haven’t done it with PIRs but it will be the same as other external devices of a sonoff.
Connect your PIR output to the gnd and pin 14 of the sonoff
And tell the sonoff that the external switch is active via the tasmota console.

You will then get MQTT messages everytime the PIR is triggered

Of course it still is :wink:
Well, TCO consists of CAPEX and OPEX. What you likely meant to express is that usually CAPEX is over- and OPEX is underestimated by laymen, and for sure you’re right there.
Then again, OPEX and thus TCO highly depends on the (virtual or real) hourly rates of the guys to do the ops/maintenance work (eventually including travel time, replacement components), the cost to coordinate works and some more factors.
And these are vastly different if you compare the professional to the home sector (ceteris paribus of course, i.e. assuming the infrastructure was the same). If I’m to spend an hour on this, you can factor this in as either 0€ ('cause it’s my hobby) or 50€ (these I’m charged to have some external electrician do it) or 100€ (my own rate in my professional life). Neither or any of these figures is the correct one to use in TCO calculation.
Btw, my quote on KNX usually being the most expensive solution was referring to TCO due to higher CAPEX and was made a) in the home building context and b) in comparison to alternatives such as Zwave which I think is on par with KNX when it comes to OPEX if we’re talking “at home”. Then again, unlike with KNX, it’s probably hard to find some professional to do (cheap) maintenance for Zwave, so OPEX may well be higher if you were to deploy that in the professional market context.
Ok I’m completely off-topic now, sooooorry!

A few weeks down the line into my home renovations and I got my Sonoffs and tried, with the advice given and additional research, to figure out a way of utilising them in a standard PIR + Lamp system. I tried to work out how to use the Tasmota-flashed Sonoff to statist the following requirements.

  1. When the PIR detects motion a message is sent. (To be aware if a potential intruder or welcome visitor is present)

  2. Permit me to turn on the Lamp remotely whatever the state of the PIR (a problem, because when the PIR detects no motion it’s relay controlling switched live (L’) is in the off position, i.e. it’s turned the light off as intended).

I could not see how to use the GPIOs on a single Sonoff to meet these requirements.

I’ve ended up with this design decoupling the PIR and Lamp functionality. They talk to each other over MQTT.

Can anyone think of a better (e.g. improving elegance, simplicity, speed, cost, stability, etc) solution that gives full independent control of the lights?

Physical environment.
I have 4 external areas to my property. Each area is covered by one Lamp activated automatically by its own PIR. All the Lamp and PIR cabling is terminated together into a DIN-railed electrical board in the loft. The broker is Mosquitto with OpenHabian on a RPi, all latest versions.