SoundTouchPlus Custom Integration

yes, I installed it, I have too many things and I’m not sure if they are confusing one with the other.
I installed:

  • Spotify official integration (I wonder whether to remove it since I also have this…
  • Spotify Plus
  • Spotcast (which I’m now wondering if I still need)
  • Bose SoundTouch Plus (I deleted the official Bose SoundTouch one, it seemed like a useless duplicate

I tried to make a script this way, without specifying Device_ID and not knowing what to put, but it doesn’t seem to work

this is the code:

alias: Bose Spotify Diegocampy
sequence:
  - service: spotifyplus.player_transfer_playback
    data:
      entity_id: media_player.spotifyplus_diegocampy
      play: false
icon: mdi:speaker-play
mode: single

Andr this is in visual editor:

the error answer is: invocation of service not work
“Invocazione del servizio script/bose_spotify_diegocampy non riuscita. required key not provided @ data[‘device_id’]”

@Diegocampy
Regarding what you have installed:

  • Spotify official integration - can remove if SpotifyPlus installed.
  • SoundTouch official integration - can remove if SoundTouchPlus installed.
  • not sure about Spotcast - the SpotifyPlus / SoundTouchPlus integrations do not use it.

The device_id is a required parameter; you can use an asterisk (e.g. *) symbol to use the default spotify media player as configured in SpotifyPlus options (see Figure 1 below); otherwise, you will need to specify the device id that you want to transfer to - use the Spotify Developer Web API UI to get your current device list (click the “Try It” button to execute the command).

Try the following service call instead:

service: spotifyplus.player_transfer_playback
data:
  entity_id: media_player.spotifyplus_diegocampy
  device_id: "*"
  play: true

Firgure 1 - SpotifyPlus Config Options

Figure 2 - Spotify Web API, Get Devices
url = https://developer.spotify.com/documentation/web-api/reference/get-a-users-available-devices

all my best thanks, asterisk works!
not even a boolean was needed, the script simply works on google home and associated with a routine on it, now I can say “Hey google put some music on the Bose” and the music will start, as happens exactly with google home home. Many thanks again, as always the custom integrations work better than the official ones :wink:

1 Like

@thlucas you were so kind, I’ll try to ask here directly:
I deactivated the standard Spotify integration and now use Spotify Plus, but the card you see below no longer works:

Spotcast also no longer works, perhaps because it referred to the original Spotify integration.
I ask you, is it possible to play Spotify music on a Chromecast device with Spotify Plus? Because that’s exactly what spotcast was for, otherwise you won’t be able to wake up the Google Chromecast and Google Home Mini devices.
Do you have anything to recommend to be able to do this, or do I also have to use the original spotify integration to do this?
Also for the card if you have any advice

@Diegocampy Not for sure, but it sounds like they both require the original Spotify integration.

Regarding the SpotCast, I am not sure if it will be compatible with SoundTouchPlus.

If nothing else, SpotifyPlus will work fine if it’s installed with SpotCast and the original Spotify integration - there are no dependencies in SpotifyPlsu for those 2 integrations.

Edit : Per the Spotify Card readme page:
The component uses the Spotify Integration and SpotCast and both of them have to be installed for the card to function properly.

1 Like

@Diegocampy

I do not have any Chromecast devices, so not sure on this one. Does it have a Spotify Connect Player device ID assigned to it? You can check by making a call to the SpotifyPlus Get Player Devices service:

service: spotifyplus.get_player_devices
data:
  entity_id: media_player.spotifyplus_diegocampy
  refresh: true

Output will look similar to this:

...
result:
  - id: 30fbc80e35598f3c242f2120413c943dfd9715fe
    is_active: false
    is_private_session: false
    is_restricted: false
    name: Bose-ST10-1
    supports_volume: true
    type: Speaker
    volume_percent: 3
  - id: 3756903295ba7b47f8c36fc9a4ff7d833431a667
    is_active: false
    is_private_session: false
    is_restricted: false
    name: Bose-ST300
    supports_volume: true
    type: Speaker
    volume_percent: 16

Do you see anything in the device list that identifies your Chromecast device? If so, then you can take the device id (the id value) for it and try something like this to play a track:

# transfer playback to specified device id.
service: spotifyplus.player_transfer_playback
data:
  entity_id: media_player.spotifyplus_diegocampy
  device_id: YOUR_CHROMECAST_DEVICE_ID
  play: true

# play the track uri(s).
service: spotifyplus.player_media_play_tracks
data:
  entity_id: media_player.spotifyplus_diegocampy
  uris: "spotify:track:6zd8T1PBe9JFHmuVnurdRp"
  device_id: YOUR_CHROMECAST_DEVICE_ID

The player_transfer_playback should wake up the device if needed, though not sure if that’s true for a Chromecast device. I know it wakes up my Bose SoundTouch if needed.

Please let me know if this works or not, as I am curious since I don’t have any Chromecast devices to play with.

1 Like

no, it doesn’t appear, in fact you need spotcast to be able to recover them and make them work. No problem, I will keep both integrations installed and thank you very much again for all your help.

Please try the following:

  • playing something on the Chromecast device to “wake” it up.
  • issue the call to spotifyplus.get_player_devices to get the device id list.
  • the device id should be in the list this time.
  • stop play on the Chromecast device.
  • wait about 20 minutes (maybe more) for the device to go back to sleep.
  • issue the spotifyplus.player_transfer_playback to transfer playback.
  • issue the spotifyplus.player_media_play_tracks to start play.

My Bose SoundTouch devices fall off of the device list after about 20 minutes, and I can issue the above sequence to get them to play. Maybe the Chromecast is different, but I am betting not.

Please let me know if it works for you.

What do you ask me with this? Very sorry I’m not a good home assistant user :face_with_peeking_eye:

@Diegocampy

My apologies for the vague explanation. Get the current list of Spotify Device ID’s via the Home Assistant Developer Tools \ Services interface. See screen capture (Figure 1) below for an example.

Do the following:

  • go to the Developer Tools \ Services tab.
  • select the SpotifyPlus: Get Player Devices service.
  • select your SpotifyPlus media player Entity ID (SpotifyPlus Diegocampy).
  • check the Refresh? box to retrieve devices from Spotify Web API.
  • click Call Service button.
  • the results are displayed below
  • find the device id for your ChromeCast device name in the results (in the example below, my Bose SoundTouch device name is Bose-ST10-1 and the device id is 30fbc80e35598f3c242f2120413c943dfd9715fe). If you don’t see your ChromeCast device name, then play a Spotify Track on the ChromeCast device (initiated from your phone or Spotcast). Once it is playing, call the SpotifyPlus: Get Player Devices service again - your ChromeCast device should be in the list if it is playing something.
  • copy the ChromeCast device id, for specifying in automation scripts.
  • note that you should not have to do these steps again if the deviec id stays the same for your ChromeCast device (it should - at least my Bose SoundTouch device id does not change).

Figure 1 - Get Player Devices

You can also use the Developer Tools \ Services to call the SpotifyPlus: Player Media Play Tracks service:

  • go to the Developer Tools \ Services tab.
  • select the SpotifyPlus: Player Media Play Tracks service.
  • select your SpotifyPlus media player Entity ID (SpotifyPlus Diegocampy).
  • enter the device id for the ChromeCast device.
  • click Call Service button.

Figure 2 - Player Media Play Tracks

Thanks, I learned new things. But it doesn’t work with chromecast . It works to find the ID number:


But it didn’t work to make it play:

I’m not sure if the track could be the problem. I’m not sure I have entered a correct code.

@Diegocampy - I can’t see what you specified for the Entity ID and the Uri's values. You have to select your SpotifyPlus media player from the Entity ID list, and enter a Spotify Uri value in the Uri's textbox as well as the device id value.

Here’s an example:

You can also click on the Go To YAML Mode button to display the yaml representation of the input form:

service: spotifyplus.player_media_play_tracks
data:
  entity_id: media_player.spotifyplus_todd_l
  uris: spotify:track:6zd8T1PBe9JFHmuVnurdRp
  device_id: 3b278d1ada710295a18e9be34ad56a24

@Diegocampy - I just pushed out v1.0.7 of SpotifyPlus today that might fix the play on ChromeCast issue. There were times that my Sou dTouch would not play either - something going on with the Spotify player. The fix I pushed makes things a little more stable. Give it a try and let me know if it helps. Thanks

Device not found

If the Chromecast it’s already in use, works


Only if currently in use, even if stopped by a few seconds it does not work

@Diegocampy - Did you try it after installing the v1.0.7 that I pushed out yesterday? You might give that a try again if not.

If that doesn’t work, then I’m afraid you might still need to use the SpotCast route unfortunately. It works great for my Bose SoundTouch, but that doesn’t help you with ChromeCast.

Don’t worry, you’ve already been too kind.
I haven’t tried because I still have version 1.06. and I don’t see any possible updates notified

EDIT: update with 1.0.7 not work for my Chromecast (no problem for this I use spotify integration standard with spotcast)

Good to know, I will add that to my notes and thank you for trying.

1 Like

I have a small problem, the integrated Bose, after turning it off, does not appear as turned off, but as “waiting”.


This creates problems with automations, because there is no “waiting” among the triggers


Am I the only one to have this problem? Thanks

@Diegocampy it appears you are talking about the SpotifyPlus integration media player instance. It works the same way as the stock Spotify integration media player, in that it cannot be powered on / off. There is no equivalent Spotify Web API call to power on / off a device, which is why it’s always in an “idle” state when not playing.

In your case, you can just use your SoundTouchPlus media player instance to play Spotify content, yes? The SoundTouchPlus does support power on / off options.

no no, I’m talking about the Bose, therefore the Sound Touch Plus integration.
In my images you can also see the Spotify Plus integration, it’s true, but I was talking about the BOSE. It is the one that is always indicated as waiting, even if it is turned off.
In the screenshot: “Cambiato in in attesa attivato dal servizio media_player:Turn off” in english “Changed to waiting triggered by media_player:Turn off service”.
I don’t understand if it’s my problem, or if this is really how the integration works