So I want to use automations to call a script that temporarily increases the volume, then sends a text-to-speech message to a specified google home. I’ve almost got it, but I’m caught up on the wait template. Basically the script isn’t waiting for the message to finish playing before reducing the volume.
Here’s the script:
'1540512309772':
alias: Send Alert - Local Media Player
sequence:
- data_template:
entity_id: >
{{ media_player_id }}
volume_level: '0.5'
service: media_player.volume_set
- data_template:
entity_id: >
{{ media_player_id }}
message: '{{ message }}'
service: tts.google_say
- delay: '1'
- wait_template: >
{{ not is_state({{ media_player_id }}, "playing") }}
- data_template:
entity_id: >
{{ media_player_id }}
volume_level: '0.25'
service: media_player.volume_set
I can call this with:
- data:
media_player_id: media_player.kitchen
message: test message
service: script.1540512309772
Everything works except for the wait template portion. I know I’m missing something with passing the media_player_id variable but I haven’t been able to figure it out. As a work around, I’ve just commented out the broken portion and increased the delay, but that isn’t really ideal. Hopefully someone here can point me in the right direction.
Also, bonus points if someone has a clue on how to restore the original volume level rather than always setting it back to 0.25.
Thanks!