Rule to launch a playlist to a Chromecast connected to a TV?

  • Platform information:
    • Hardware: Raspberry Pi4
    • OS: Openhabian 3.2
    • Java Runtime Environment:
  • Issue of the topic: Turn TV on and casting content from spotify
  • Please post configurations (if applicable):

Hi,
I have a chromecast inserted into a TV and I want to automatically turn on the tv and cast content from spotify.
If I launch the spotify app on my PC, I could select the chromecast as a audio source. If I do that I see my tv turning on and start playing music.

I’m in trouble replicating in in a rule on Openhab 3.
I’m trying this:

SpotifyPlayerChromecastCucina_TracktoPlay.sendCommand("spotify:playlist:37i9dQZF1DWV3VLITCZusq")

And if chromecast is already on and playing spotify, it changes the playlist
If the chromecast is off it does not power up and so it’s not working.

Reading on the Spotify binding doc I see that TrackPlay should activate the device:

Channel Type ID Item Type Read/Write Description
trackPlay String Write-only Update to play a track, playlist, artist. Activates the device.

Is it possible or the chromecast wake up is a not functionality exposed by the Spotify Web API?

I think this is the problem:

Some devices will not be visible (i.e. Chrome casts) when they are not active (they go into a sleep mode and are not visible through the Spotify Web API). The binding will show them as GONE.