I’m new to homeassistant and having trouble getting a script to work.
I would like to play a spotify playlist on a google cast group.
For now, I’m just trying to get it to work on a single Google Home Mini called “Kitchen.”
It doesn’t work, and in home-assistant.log I see:
KeyError: ‘Kitchen’
I’m running this on a Mac. Here’s the script:
# Play random playlist and switch to Chromecast
spotifydemo:
alias: 'Spotify on Chromecast'
sequence:
- service: media_player.select_source
data:
entity_id: media_player.spotify
source: Kitchen
- service: media_player.play_media
data:
entity_id: media_player.spotify
media_content_type: playlist
data_template:
media_content_id: >
{%- set plists = ["spotify:user:spotify:playlist:1aoIH3IB2MRfYhD1Z2Y5aK",
] -%}
{% set pindex = (range(0, (plists | length - 1 ) )|random) -%}
{{ plists[pindex] }}
Any ideas what I’m doing wrong?