Well into automating my live aboard boat, lights, music, heating system, etc.
So now my attention has come to the bar cabinet (old school, opens with a tray and has mirror all inside), and I have made a switch that turns on a LED strip inside when the cabinet it opened.
So here is the question: I wanted to make it so that when I open that bar cabinet the boat goes into “romantic mode” or something. In this I want to have Spotify automatically play a specific song.
Is this possible with HA? I prefer not having a Spotify server running on my HA-instance (tried it and prefer a dedicated music server). My music is streaming from an audio streamer called Wiim. (similar to Sonos).
So, to sum up: is it possible to play a specific track from Spotify within an automation in HA. And if so, how?
# Example script to play playlist
script:
play_jazz_guitar:
sequence:
- service: media_player.play_media
target:
entity_id: media_player.spotify
data:
media_content_id: "https://open.spotify.com/playlist/5xddIVAtLrZKtt4YGLM1SQ?si=YcvRqaKNTxOi043Qn4LYkg"
media_content_type: playlist
you of course have to first set spotify up… which is a little involved, but spelled out here.
your media_player also need to be provisioned and able to support receiving the media in this way. as i recall with wiim (i don’t have one, but i researched it and was almost going to buy one then opted for sonos)… wiim can both receive streams and can also play spotify directly.
After you wrote I went out and got the Sonos Port. Mostly because I have had Sonos previously and it just seemed to work really well. The Wiim is lagging in the volume control from the app which for me is a fundamental feature, and Sonos doesn’t lag. In addition, Sonos can be expanded with extra wireless speakers. And lastly I couldn’t be bothered integrating a less known system into my HA setup.
The most reliable way for wiim (in my experience) is using its Preset function. Set your Spotify Playlist/song as preset in the wiim app. Install the linkplay integration and then use the ‘linkplay Preset’ service to play the Spotify song.