When I look at the log, I can see this automation trigger is being “caught”, however
the service actions aren’t being called. The auto_lock_disble timer is still running instead of restarting as I want it too.
- id: disable_autolock
alias: Disable Auto-Lock
trigger:
entity_id: input_boolean.disable_autolock
platform: state
to: 'on'
action:
service: timer.cancel
entity_id: timer.garage_door
service: timer.cancel
entity_id: timer.front_door
service: timer.cancel
entity_id: timer.auto_lock_disable
service: timer.start
entity_id: timer.auto_lock_disable
You need to make your action a list by putting dashes in front of each service:
action:
- service: timer.cancel
entity_id: timer.garage_door
- service: timer.cancel
entity_id: timer.front_door
- service: timer.cancel
entity_id: timer.auto_lock_disable
- service: timer.start
entity_id: timer.auto_lock_disable
EDIT: BTW, for the three timers you’re canceling, you can use one service call and list all three timers:
action:
- service: timer.cancel
entity_id:
- timer.garage_door
- timer.front_door
- timer.auto_lock_disable
- service: timer.start
entity_id: timer.auto_lock_disable
EDIT2: Oh, and BTW again, if you’re starting timer.auto_lock_disable you don’t have to cancel it first. When you start it, if it was already running, it will simply be restarted. So:
action:
- service: timer.cancel
entity_id:
- timer.garage_door
- timer.front_door
- service: timer.start
entity_id: timer.auto_lock_disable
Thanks! I though the dashes were just optional for alignment purposes. YAML is kinda annoying at times
Yes, but you get used to it.
The dashes mean this line starts a new list item. They are definitely important. For an automation or script, the action/sequence can consist of a single “step”, in which case the dash is optional. But if you have more than one step, it must be a list. In that case, the dash for each step is required.