I am working on an Automation that in it’s basic form will turn on lights following a motion detection. I am planning on having a delay before the lights turn off of a specified value. When the time is up, the lights go off.
I’ll have some other conditions that will apply (time of day, day, sun position, lux, etc.) but I see 2 solutions to this problem and I’m looking for pros / cons to each.
Solution #1 - Single Automation that Restarts on a Motion Trigger
Solution #2 - Two Automations … one that triggers on motion and starts (or restarts) a timer and a second that listens for the timer completing and then turning the lights off.
Any opinions on the more elegant / fail safe solution?
It looks like you’ve just tried to make a janky delay here, may be better to go with the official one if you go this route.
Anyway, doing it in one automation like this will continuously turn the light on to 100% bright, which may cause some problems if you ever want it dimmer than that. I think you could also achieve something similar with a wait_for_trigger that waits until the motion sensor state has been off for five minutes. This just stops it from continuously restarting, which I would consider more “elegant”. I haven’t done this exact thing myself before, so unsure if any quirks pop up, but I don’t think any should and it would probably be what I’d go with.
If you do separate it out into two automations, I wouldn’t do a timer and instead do what I said above: just wait for the state to be off for five minutes. There’s no reason to add complexity to something that already has a fine solution, but, based on that custom delay, it looks like you may just enjoy reinventing the wheel
Thanks. I’ll check out the features / code on that one. At first glance it looks pretty promising. I thought at one point Scenes were having issues with multiple lights though. I’ll have to do some homework, but the logic on that Blueprint looks pretty close to what I was wanting … great reference!