[SOLVED] Detect absent of motion from multiple sensors in period of time

Hello,

Could be possible to describe the following kind of rule in OpenHab?

"Turn the lights off after 5 mins without motion detection in the room?

The rule should consider more than one motion sensor in the room, so the lights should be turned off only if none of the sensors (in my case 3) have detected motion for more than 5 mins.

Thanks in advance,
Humberto

Can’t test/verify ATM, I’d use a proxy switch item which my expires to OFF after 5 minutes. Each motion sensor should trigger this proxy switch to ON, thereby restarting the 5 minute count.

This is what I do and works…

Thanks for your suggestion :+1:

Hi, could you share your solution?
I just started with OpenHab today, I could save some time if you share it :slightly_smiling_face:

Get something working for one sensor.
Extend your solution to several sensors.

You are allowed this or that triggers in rules.

Install expire binding.

Create an item:

Switch MotionTimer { expire="5m, command=OFF" }

Now create the rule:

rule "Turn the lights off after 5 mins without motion detection"
when
        Item MotionSensor1 received command or
        Item MotionSensor2 received command // Declare here as many as you want
then
      if(triggeringItem.state == ON) { // or OPEN
             MotionTimer.sendCommand(ON)
      }
end

rule "Turn off light when timer is off"
when
       MotionTimer received command OFF
then
        RoomLight.sendCommand(OFF)
end

This should work out of the box (I suppose).

thanks for the reference!

Thanks!