I understand that I need to change entity_id: “{{ sonos_entity }}” with my sonos i.e entity_id: media_player.living_room_3
But still I cannot get the script to save. What else am I missing here? What is volume, message, and delay. Do I need to declare that somewhere? Why is the script failing?
Paste everything except the first line (“script:”). You will also have to adjust the indentation of everything two spaces to the left.
You don’t change anything in the script. You change the variables passed to the script by the automation:
automation:
- alias: 'test'
trigger:
- platform: state
entity_id: input_boolean.mytest # change the trigger to what you need.
action:
- service: script.sonos_say
data:
sonos_entity: media_player.office # Change this to the Sonos player you want to use
volume: 0.5
message: 'Your husband coming home!' # and this obviously
delay: '00:00:05'
Maybe the ui editor has the naming key of the script elsewhere, so the screen you’ve posted there should start at alias and the sonos_say bit should be in a different box?
I know the ‘company line’ is to use the UI, but honestly for the sake of a simple copy and paste…