I have tons of Hue lights that im using for double duty. The lights turns on mood lighting at sundown and turns off at sunrise, through the Hue app (not in HA, i want it that way).
After it gets below a certain lux lvl i want the lights to save the state they are in (done), turn on bright light scene (done) and then i have a timer that reverts the lights to previous state (done).
However, the automation only runs once, and i want to keep the lights bright as long as the sensor sees motion. When sensor does not see motion for X time, revert.
If i do reset on the automation type, it runs the whole script again which overwrites the state. Any help would be much appreciated.
I have changed the trigger and condition to states rather than devices as this is generally better practice.
By changing the delay to a wait for no motion for 3 mins this should prevent the scene from reverting back until there has been no motion for those 3 mins. Although further motion would in theory trigger this automation again, all the time its set to mode: single this would be prevented.
There may be better ways to do this, but the above should in theory work!
You sir, are a genius So far this seems to work just fine. Will continue testing on my whole setup and get back here so others can use this. I think i might make this a blueprint, has to be more people that want the lights to do double duty!
It did work! And it does, somewhat…however it does seem to not re-trigger if i go out of the motion sensor and then back again after say one minute. Then it just stays bright. Very strange…
Ok so this wait 3 mins timed out because motion continued, not what I expected to be honest.
I am thinking maybe you could add a 2nd trigger of no motion for 3 mins and the alter the automation to include a choose function. That was have the initial motion and lux condition and have the scene create, lights change and the 2nd choose with the same lux condition replay the light scene.
I am not in front of a computer so won’t attempt the yaml, if I get time in front of a PC i will post up an example if no one else suggests anything in the mean time.
EDIT:
Just quickly knocked this up, should work, let me know:
I see the thinking behind this, and it works when you trigger it once. If i trigger again after say 30 seconds it gets stuck. I think this might have to do with the Hue sensor, i think the timeout is 10 seconds. Attached the trace, i trigger it - then move away for 15 seconds and then trigger it again.
And thanks again for taking the time, really appreciate it!