Hi all,
I had an automation, that was: When someone turn off light on bathroom, then start the timer, and when this timer was gone, fan in bathroom was turned off. And if the lights was turned on during the timer is on, this timer was stopped. It prevent turn off fan if someone is back again in bathroom. How can i solve this?
Rather than triggering when the light has been off for a minute, trigger as soon as the light goes off but put the delay in the action. See automation #2 in the first example in the docs.
I get around this by using scripts and have one automation first stop the timer script. You could make it such that when the light is turned on, you call script.turn_off for the timer script
Hi, I don’t have sensor. Automation is depending only by lights is turned on or off. Then wait 1 minute and turn off fan, or stop this automation, if is lights turned on again.
Pretty much like Dave I have a script and some fairly complex automation logic, but that’s because : -
My fans all run 1/day on a schedule (stops seldom used fans seizing up)
They run if the house is hot
I can manually switch them on
I can adjust or eliminate the timer
The fans are not to run between set times (night) but this can be overridden with a permissive. And this can turn them on/off if occupied on a transition
But the use case here is simple
Light goes on fan goes on
Light goes off for 1min fan goes off
All done in two very small and neat automations, what’s the problem ?
What have I missed ? I thought I’d read the whole thread but maybe my glasses need changing their prescription ?
Hi Mutt, the problem is in case, that the lights goes on again, during the automation is fired. I need stop this automation, when the lights goes on again.
By the way I left out some stuff in my above post, which relates to how I control them with Xiaomi buttons. They control the above automations and scripts with single clicks, double clicks and long presses.
Yeah I get that, but the automation is to switch the fan off ONLY if the light has been off for one minute. If its off for 59 seconds and the light goes back on again, nothing happens
You are basically doing the same as a motion sensor with a light
No worries! (also, the odd code for turning the light off slowly is due to those particular lights being z-wave which don’t permit on/off transitions, so that is my pretend transition)
Jaun,
Noticed that you used this in your automation, you are aware that this cancels the last_triggered attribute of any such automation on a restart so you need special testing conditions in order for any automation running subsequent to a restart to ‘test and/or ride through’?
Not a problem if you never use last triggered as a condition in automations.