Hi all,
I got a simple automation, which activate a script during sunset (get shutters down).
alias: Sunset - shutters - bedroom - down
trigger:
- platform: sun
event: sunset
offset: '0'
condition: []
action:
- service: script.shutters_bedroom_down
mode: single
But from time to time, it fails to execute (in logs there is Error executing script) probably because the device is temporarily unavailable at that moment.
Is there a way - how to setup automation, which will repeat ist action if that script failed to execute ?
Ou sorry, we misunderstand.
There is a switch, which is controlled by this script (script turns this switch on for a certain time and than turns it back off).
I checked this switch’s entity history / logbook but it does not show that it was unavailable.
The challenge is that there is nothing that tells you the switch failed to turn on other than you visually inspecting the log for errors.
When the script commands the switch to turn on but it fails to turn on, does the switch’s state value still indicate that it is off?
If it continues to report off even after being commanded to turn on, you can try this technique. In your existing script where it turns on the switch, replace the service call with a repeat that turns on the switch every 10 seconds until the switch finally reports on or it has tried and failed 5 times.