Since Spotcast was deprecated and rolled into the HA Spotify integration I have been struggling to get the Spotcast type functionality I was using working again.
Use Case
I have multiple family members each with their own Spotify account and Spotify Connect device. Each of them have different morning routines and have selected playlists that they like to use as their alarm in the morning.
Previous Behavior
Previously I had Spotcast configured to start the playlist of their choice on shuffle using their specific Spotify account at their given wake up time on a specific Spotify Connect device. This worked without fail until 2022.08 was released.
Previous Automation example
- id: '1636296144885'
alias: Wake Up Kid 1
description: ''
trigger:
- platform: time
at: 06:15:00
condition: []
action:
- service: spotcast.start
data:
shuffle: true
start_volume: 40
account: kid1account
uri: spotify:playlist:37i9dQZF1DX7cZxYLqLUJl
device_name: Kid1's Speaker
random_song: true
Current Behavior
Now I can get a playlist to play using the correct account at the correct time, but where I am struggling is having this trigger on the correct Spotify Connect device. What I have run into is the source_list
values getting overwritten periodically I assume via Spotify API??? So when I go to trigger the Automation if the device I want is no longer in the list it wont play anything.
Current Spotify Script
wake_up_kid1:
alias: Wake Up Kid 1
sequence:
- service: media_player.select_source
entity_id: media_player.spotify_kid1
data:
source: "Kid1's Speaker"
- service: media_player.volume_set
entity_id: media_player.spotify_kid1
data:
volume_level: 0.3
- service: media_player.shuffle_set
entity_id: media_player.spotify_kid1
data:
shuffle: true
- service: media_player.play_media
target:
entity_id: media_player.spotify_kid1
data:
media_content_id: spotify:playlist:37i9dQZF1DXdziGPHNE40t
media_content_type: playlist
Current Spotify Automation
alias: Wake up Kid 1
description: ""
trigger:
- platform: time
at: "06:15:00"
condition: []
action:
- service: script.wake_up_kid1
data: {}
mode: single
Entity Information (As you can see Kid1’s Speaker is not in the source_list
despite it being there an hour ago)
source_list:
- Fire Tablet
- Listening Room
volume_level: 0.5
media_content_id: spotify:track:00XUUci0jcUyCtVgMk8AxB
media_content_type: music
media_duration: 191.7
media_position: 54.042
media_position_updated_at: '2022-08-13T16:35:25.629000+00:00'
media_title: Some Other Time
media_artist: Lia Riggs Trio
media_album_name: Some Other Time
media_track: 1
media_playlist: Jazzy Morning
source: Listening Room
shuffle: true
repeat: 'off'
entity_picture: >-
/api/media_player_proxy/media_player.spotify_kid1?token=ee57db5bee1e8fcd8adb946d03635de521774a64ac47f6c4580d01d8e17a1475&cache=5f198fb5431edcf4
icon: mdi:spotify
friendly_name: Spotify Kid1
supported_features: 444983