I’m following the documentation for scripts and passing variables but I’m having some issues.
I have the following tap-action in a button. It fires my script.
type: 'custom:button-card'
entity: media_player.sonos_bedroom_beam
name: Bedroom
tap_action:
action: call-service
service: script.test
data:
coordinator: Ceiling Speakers # I put quotes around these but saving removes them.
speaker: Bedroom # I put quotes around these but saving removes them.
And I have the following script.
test:
alias: Test
fields:
coordinator:
description: The main speaker in the group
example: Deck
speaker:
description: The speaker joining the group
example: Living Room
sequence:
- service: mqtt.publish
data: # Tried both data and data_template
topic: "home-assistant/sonos/group/{{ coordinator }}"
payload: "{{ speaker }}"
mode: single
Which sends the mqtt message but neither coordinator nor speaker have a value. Can anyone spot where I’ve gone wrong?