Triggering a flow on a « non event »

Hello,

I would like to automatically switch off the lights in my living room if no one is detected for 30 minutes.
I’m using a Aqara Motion Sensor to detect presence.
I tried to use a Poll State component, setting it to interval of 30 minutes and checking if the sensor returns off… but I see it doesn’t work. My guess is that the « update interval » is actually the time that Node Red waits before polling the sensor, and not the time the sensor is off.

So, how could I do? I was thinking about setting an interval of 2 minutes, and use a counter or persiste somewhere the status, but there may be a simpler solution ?

Thanks

You can use the join node.
There probably are other nodes that work too, but I use that for my remote receiver.
It joins button presses of my remote, like 1…2 => 12.

If you use that at the sensor event node then each new presence detection should reset the timer and make it wait.

I looked at the nodes and probably the trigger node is an equivilent.

Just make sure send nothing and extend delay

EDIT
Now that I read the settings of join node it seems it will not work for you.
It says “After a timeout following the first message”.

You probably need the trigger node

Perhaps I’m missing something but, don’t you mean this? Event state node, off for 30 minutes:

Thanks a lot Hellis81!

Hi Obaldius,

yes, I think this is the one i need for this use-case :slight_smile:

Thanks!