I have been using Home Assistant for about 2 years now and have built up quite a complex Automated Home. I’m having a little trouble with Automation triggers after reloading all automations or even saving a different Automation (which I presume reloads all Automations automatically)
I have a few Automations that use something like below as a trigger:
- platform: state
entity_id: switch.aering_towel_rail
to: 'on'
for:
hours: 1
minutes: 0
seconds: 0
I use it to turn off an electric towel rail if it has been left on for an hour.
If I reload Automations from settings ‘Yaml Reload’ or save a change in a different automation after the switch has been on for say 30 minutes it does not trigger once the switch has been on for 1 hour or even 1 hour after the automations have been reloaded.
I have tried changing the trigger to 5 minutes, and doing the same (to save waiting for an hour) but it never triggers.
My problem is that if this switch is on (it is an electric towel rail) and I change another automation and save it, the trigger never happens to turn off the switch.
Is this a flaw with Home Assistant? and does anyone else have this problem.
Correct, the reload changes the state to unavailable then restores it to whatever it was before the restart. Effectively resetting the for: time counting.
It should do that. Mine do. As long as you don’t specify a from: state.
Wow, thanks for the quick reply.
For me this is a rather large flaw as I am always tinkering with Automations/Scripts.
Its not necessarily the hour that’s important, more that the switch being on is realised in some way and turned off (not left on until it’s noticed).
For Home Assistant reboots I run a Automation on restart that fires the necessary scripts to turn things off, it’s the Automation/Script reloads that drive me insane!!
Will there ever be a fix for this? Or is it a coding headache?