wait some time (30…120 minutes, depends by a slider)
then turn off the fan.
What I expect is: when I start the script via the related switch on the Lovelace interface, the switch goes to ON position and remains ON until the script is terminated and the fan turn off.
The probelm is when I turn on the switch, it returns to off after some seconds, but the script is not yet terminated and the fan is active. If I update the Home Assistant webpage (pressing F5 for example), the switch returns to on position as expected.
My hassio is latest version (107.x), and it is installed into a Raspberry.
I have it since version 0.94, and this issue has always been present.
The fan is connected to a Sonoff with Tasmota firmware, but I think this is not useful, because the problem seems related to the script itself.
If you let the script run to completion does the fan turn off. If it does then there is nothing wrong with the script. You could also test this by activating the script from the services screen stand-alone. one would really need to understand what UI control you are using to active the script.
Yep, I agree with micque, the script looks fine.
So the question is how are you triggering it.
I generally use something similar in an automation which is triggered when the switch is turned on.
micque:
yes, if I let the script run, it complete its sequence turning off the fan. The script itself is working good. The problem is on the switch behaviour.
micque and Mutt:
The script is triggered by a switch on the Lovelace interface. No other way to start this script.
tom_l: thank you to inform me that this might be a bug. If it’s true, it exists since a long time, and I didn’t find any thread or forum speaking about it.
Actually the switch has been replaced with the word “Execute” and “Abort” (“Esegui” and “Annulla” in italian language). When I press the button, the word change accordingly and have the expected behaviour.
So, in my experience, the bug is solved.