I have a sprinkler switch that turns on at 7am with a time based automation. no problem with this one.
Also have another automation to turn it off. The trigger is 8 mins after the sprinkler turned on (see below the yaml). no problem with this either.
But if I restart HA after the sprinkler turned on but before it gets turned off (i.e anytime between 7:00:01 to 7:07:59), it never gets turned off. I think the reason is when HA comes back, it restores the state of sprinkler switch to ON but the turn_off automation is not picking this state. I can see why the system is designed this way but how to solve this? Happy to provide any additional info if you need. Thanks for looking.
- id: '1611312877291'
alias: auto_irrigation_control_off
description: ''
trigger:
- platform: state
to: 'on'
for:
hours: 0
minutes: 8
seconds: 0
entity_id: switch.ikea_of_sweden_tradfri_control_outlet_603983fe_on_off
condition: []
action:
- service: switch.turn_off
data: {}
entity_id: switch.ikea_of_sweden_tradfri_control_outlet_603983fe_on_off
mode: single