I’m wondering if there is a better or more elegant way to achieve what I need.
In my bathroom I have some hue gu10s, a hue dimmer, and a hue motion sensor.
What I want is for the lights to come on as soon as someone walks in the room, hue is doing this fine. The other requirements I’m wanting Home assistant to handle.
The first requirement is that the light go off after a predefined amount of time.
The second requirement is if there is still movement the lights should stay on for longer.
The third requirement is that hitting the on button on the dimmer will override the lights automatically going off for instances when people are having a bath or shower.
So my first automation triggers when the bathroom lights come on, it starts a script which has a delay for 2 mins then turns the lights off.
The second automation triggers on a state change of the motion sensor and if the script to wait for 2 mind and turn the lights off is running it just restarts this script so it will wait another 2 full mins until turning them off.
My third automation is triggered by a button press on the hue dimmer and just cancels the script that turns the lights off after 2mins.
Am I using the best solutions for my requirements?
Cheers.