Hey folks, I am trying to get a script setup to change the radio station on our Sonos, which will eventually take in the station as variable, the volume will then vary depending on the station.
Currently I’m just hard coding the variable to try and get it working, but I’m getting and error every time I try to run it I get an error.
Failed to call service script/sonos_radio. Error rendering data template: Result is not a Dictionary
I suspect it’s an obvious error, can anyone point out where I am going wrong, would be greatly appreciated!
sonos_radio:
alias: Sonos Radio
sequence:
- variables:
main_volume: 0.25
virgin_volume: 0.2
station: Radio 1
- service: media_player.select_source
target:
device_id: 920281ea7de5bc374e168d9f86fe3fa0
data:
source: "{{station}}"
- if: "{{ station == 'Virgin' }}"
then:
- service: media_player.volume_set
data: 0.2
target:
device_id: 920281ea7de5bc374e168d9f86fe3fa0
else:
- service: media_player.volume_set
data: 0.25
target:
device_id: 920281ea7de5bc374e168d9f86fe3fa0
enabled: true
mode: single