I have this automation that should be activated by any of the timer.sonex timers. I can’t find out why it’s not firing:
alias: Slå av forsterker fem minutter etter at JRMC har stoppet
description: ""
triggers:
- event_type: timer.finished
event_data:
entity_id:
- timer.sone1
- timer.sone2
- timer.sone3
- timer.sone4
- timer.sone5
- timer.sone6
- timer.sone7
- timer.sone8
- timer.sone9
trigger: event
conditions: []
actions:
- action: rest_command.girder
data:
kommandoklasse: Forsterker
kommando: 0
sone: 9
mode: single
Isn’t this correct? Or doesn’t multiple triggers work like this? Also, I would like to have the payload sone in the REST command send the number at the end of the triggering timer. How can I set that up? I’m trying to avoid a bunch of different automations doing the same thing.
The “event” trigger may have many (list of) event types, but not the entity_id. Anything in the “event trigger” under the “event_data” section must match the actual data content of the “firing” event and specifically for timer events, that data section contains only a single entity_id of a single timer.
I suggest you create multiple Event Triggers, one per timer, and assign each trigger’s id with the timer’s number. You can reference the trigger’s id using trigger.id.
Thank you very much, that works as your solutions always do! And here I thought it was only me. Edit: Btw trigger ID is something I can use in another part of the system that will cut down on clutter, never thought about that! Thanks for that too!
Oh, a problem in the other automation where I wanted to cut down on clutter. I need the code to actually start the timer that’s triggered in the automation above, but I can’t seem to crate a working template for the timer name. Here is a shortened version, with only one zone:
alias: Vise at JRMC har stoppet
description: ""
triggers:
- id: "1"
trigger: state
entity_id:
- media_player.hytteserver_stua
from: playing
for:
hours: 0
minutes: 0
seconds: 10
conditions: []
actions:
- action: rest_command.girder
data:
kommandoklasse: JRMC
kommando: Stoppet
sone: "{{ trigger.id }}"
alias: Sende REST-melding til Girder om at JRMC stopper
- action: timer.start
data:
target:
entity_id: timer.sone{{trigger.id}}
alias: " Timer start i sonene"
mode: single
The rest command is sent, but the timer “timer.sone1” does not start from this. Can you see what I am doing wrong?