Turn off if no movement detected after an event

Hi, hope someone can help.

I have a condition that fires my bathroom lamp when certain criteria is met, this is working fine, the condition is bedroom_late_when_sleeping. I have a motion detector in the bathroom. When the condition is met, the lamp goes on. I have also a move detector in the bathroom. I want to turn the bathroom off if there is no movement after five minutes, considering that maybe the last movement has happened hours before. Si if no one goes into the bathroom in the next five minutes, it will turn off. I have try this with no success.

bathroom_on AND (bathroom_move; no_move_bathroom; bedroom_late_when_sleeping) AND (no_move_bathroom; NOW > 5:00)

This fires immediately after the bedroom_late_when_sleeping condition is satisfied, that is not the idea, it has to wait 5 minutes, and the, if no motion detected, then it fires.

Regards.

I solved it this way, but I don’t know if this is the more elegant way.

((bedroom_late_when_sleeping;bathroom_on < 10) AND (no_move_bathroom;bedroom_late_when_sleeping)) AND bathroom_on AND no_move_bathroom AND (bathroom_on; NOW > 2:00)

[quote=“Vreo, post:1, topic:177929”]Hi, hope someone can help.

I have a condition that fires my bathroom lamp when certain criteria is met, this is working fine, the condition is bedroom_late_when_sleeping. I have a motion detector in the bathroom. When the condition is met, the lamp goes on. I have also a move detector in the bathroom. I want to turn the bathroom off if there is no movement after five minutes, considering that maybe the last movement has happened hours before. Si if no one goes into the bathroom in the next five minutes, it will turn off. I have try this with no success.

bathroom_on AND (bathroom_move; no_move_bathroom; bedroom_late_when_sleeping) AND (no_move_bathroom; NOW > 5:00)

This fires immediately after the bedroom_late_when_sleeping condition is satisfied, that is not the idea, it has to wait 5 minutes, and the, if no motion detected, then it fires.

Regards.[/quote]

You need to create a schedule in PLEG to fix the 5min delay.

(no_move_bathroom; NOW > 5:00) means: if there was no movement in the bathroom for the last 5 minutes. So if there was no movement for the last hour (> 5min), this statement is directly true.