Room Light with auto-off

The thing is that I am not exactly experienced in creating rules and automations so I am looking for advice and guidance. Most likely there is more short or neat way to do automations so, please, if you don't mind to share your thoughts. That way I can adjust my "radar" to the right direction. Your time is highly appreciated!

This is the scenario:
A room with single (no smart)light controlled by zigBee wall switch and motion sensor. Triggered by the motion sensor. The light stays On while the motion sensor is active with sub condition "if switched off manually to exit the rule". Another point is the rule to give you a short warning with flashing when it is about to switch off the light. In that way you have time to retrigger the rule and start the countdown again.
Thank you in advance :blush:

One problem apparent with your rule off-hand is that you likely don't really want to repeat a check for motion active every minute, as you are now, though that actually might work if your sensor has relatively long reporting periods for motion activity. (This will cause unexpected results if motion goes inactive and active and you check it at the "wrong" time. Such variation is typical for motion sensor reporting even in rooms that are really occupied, one reason you often use a delay before turning off, as you also are.)

Typically, you'd wait for an event or expression instead. For this rule, something like this seems like it would work:

Wait for expression: Toilet Motion sensor motion inactive --> duration 0:01:20

(i.e., replace the entire repeat with this)

You could then flash the light, wait for a few seconds (I'd suggest "Wait for events: elapsed time" instead of "Delay" here and can explain more if you're curious, the main reason being nothing is cancelling your delay right now), then turn off the light.

You can also remove that "Exit Rule" action--it does nothing here. You're already at the end of your rule actions.


First, let me thank You for your lightning fast response :astonished:
I assume you have something like this in mind:

As it indeed the rule looks much more leaner now. Thank you :pray: I'll try to stay away from the While expressions as possible :innocent:

1 Like