SpotifyPlus Integration

I have a denon AVR and can operae Wireshark. What do you guys need?

@NathanCu @z3p337
Hi Nathan, thanks for reaching out. z3p337 is having trouble activating Spotify Connect Denon HEOS devices from the SpotifyPlus integration.

I only have an older Denon AVR (AVR-3808CI, no Spotify Connect capability), so I cannot test this myself. I’m thinking the functionality will work the same, regardless if it’s a smart speaker or an AVR.

2 things that would help:

  1. can you run a Wireshark trace between your desktop and your Denon AVR to see what the Spotify Connect Zeroconf API flow looks like between the Spotify Desktop application and the Denon AVR device? I am looking to see what the Spotify Connect Zeroconf GetInformation, and the addUser call requests / responses look like. Note that there could be multiple requests / responses for each, if there is a polling sort of process involved with the Denon device.

  2. can you install the SpotifyPlus integration and SpotifyPlus Card to see if you can connect / disconnect your Denon device from the Device Browser? Once you are in the Device Browser display, long click the Denon device name to display the device details; then use the ... (3 dots) action menu to Disconnect / Connect the device. This should cause the device to be removed from / readded to the Spotify Connect Player Device list in the Spotify desktop / mobile app.

I opened up issue #27 on the Spotify Card github wiki issues to track this, so we don’t fill up the community thread with troubleshooting data (if that works for you guys).

Thank you again Nathan for helping us with this.

1 Like

I was already working on #2 so my ai can drive Spotify so no problem.

#1 any specific filters other than at least the ZeroConf? (edit NVM read the doc that should be easy enough)

PM me about where to send the trace I’m. Not putting my network traces onthe open internet.

Edit edit.
The AVR has multiple zones and the bedroom has a HEOS bar. Do yih want multiple configurations?

1 Like

@thlucas I cannot understand what happened, but the day after I create the OAuth2, my Spotify have become very unstable, and I’m not able to use it on HA anymore.

Every time I turn on the media player SpotifyPlus entity it stops playing and clear the track list (but the device si connected and if I select another track/playlist from phone app it start on my Linkplay device), the same happen if I transfer a track (from entity more-info popup or with the service) from another device (Sonos or my iphone with Spotify App).

I have tried without solving to::

  • Reinstall both integrations (SpotifyPlus and Linkplay)
  • Restore HA backup from a few days ago
  • Delete all App access in Spotify dev.
  • Create a new App in Spotify dashboard.
  • Re-authenticate SpotifyPlus
  • The custom component logger does not show errors, as well as HA

I have also tried to come back to original Spotify integration, it does the same.

I’m not sure if it’s connected, but I have notices that 2 other integrations have lost the token at the same time I started to have problems with Spotify (Smartthings and Netatmo)

I would like to start from scratch and debug to understand where is the problem, but I think there’s something to do with Spotify tokens and devices access.

@Sofa_Surfer
If you created a new Spotify Developer App for the SpotifyPlus integration, then it should have issued a new auth credential token for that App; if you used the same Spotify Developer App that you created for the HA Spotify integration, then it would share the same auth credential token for the two integrations. I have configured my environment using both of those scenarios, and have not had any issues.

Just to be safe, I would probably define a new Spotify Developer App for the SpotifyPlus integration so that a new auth credential token is generated for it. I would probably go back and re-add the Spotify App from scratch using its Spotify Developer App - this includes deleting the Application Credentials, and re-authorizing access to Spotify in the setup process.

I am not familiar with the LinkPlay technology, so can’t comment about that.

I would think there would be something in the System Log relating to either the integration(s), or “OAuth”, or “authorization”, or just the phrase “token”.

Another possibility of tracking down the issue would be to use the SmartInspect utility. This is a detailed logging mechanism that I use to debug my applications. Note that it will only supply information for the SpotifyPlus integration though, as it is a code based tracing tool. More info on how to set it up can be found on the SpotifyPlus SmartInspect Logging Configuration wiki page. It will generate detailed log information (to it’s own file or console, not HA system log), and allow you to see what’s going on step by step, as well as in real time as it’s happening (if using the consle viewer).

1 Like

Thank you for your quick reply, I will try this week end.
Cheers

@thlucas I re-authenticate with the new app mad in Spotify dev, login, done again OAuth2 with the python script and it looks Sonos devices works fine.I see no errors on SI Console when transfering from both Sonos to Linkplay, and the transfer is pretty quick!
I think in the first attempt I made some mistake in the Spotify dev app…

Everything work fine if switch on the media player SpotifyPlus and start the music from the HA media browser. If I come home from outside and Spotify is on my iphone everything is fine if I only transfer the play to my Linkplay or Sonos, but as I turn on the media player I have a few errors and the actual “playing” is set to empty, and I have to start to play something from HA. It’s not a big deal (but if I reboot HA while playing something I have to stop and restart my playlist), now I can start to have a look at the card!

The log from the SI console, I can send you the .sil file if you want to have a look :smiley:

SAM1003E - Spotify ZeroConf API returned an error status while processing the "Connect" method.
Status: 402 - ERROR-SPOTIFY-ERROR
Message: "ZeroconfGetInfo: 
 SpotifyError="8"
 Status="402"
 StatusString="ERROR-SPOTIFY-ERROR"
 ActiveUser=""
 Aliases=[]
 Availability=""
 SupportedDrmMediaFormats=[]"
SAM0001E - An unhandled exception occured while processing method "PlayerTransferPlayback".
SAM1003E - Spotify ZeroConf API returned an error status while processing the "Connect" method.
Status: 402 - ERROR-SPOTIFY-ERROR
Message: "ZeroconfGetInfo: 
 SpotifyError="8"
 Status="402"
 StatusString="ERROR-SPOTIFY-ERROR"
 ActiveUser=""
 Aliases=[]
 Availability=""
 SupportedDrmMediaFormats=[]"
'SpotifyPlus Paolo': SpotifyApiError while transferring playback source; resetting source to: 'Stereo salone'
'SpotifyPlus Paolo': Processed a media player command - forcing a playerState scan window for the next 5 updates
SAM0001E - An unhandled exception occured while processing method "PlayerTransferPlayback".
SAM1003E - Spotify ZeroConf API returned an error status while processing the "Connect" method.
Status: 402 - ERROR-SPOTIFY-ERROR
Message: "ZeroconfGetInfo: 
 SpotifyError="8"
 Status="402"
 StatusString="ERROR-SPOTIFY-ERROR"
 ActiveUser=""
 Aliases=[]
 Availability=""
 SupportedDrmMediaFormats=[]"

I’ve seen also this:

SAM0001E - An unhandled exception occured while processing method "GetInformation".
HTTPConnectionPool(host='10.10.10.254', port=5356): Max retries exceeded with url: /zc/0?action=getInfo&version=2.7.1 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fa1e0ce7050>, 'Connection to 10.10.10.254 timed out. (connect timeout=5)'))

the address is not in my network.

I can tell you from my experiences with mixing Sonos with other device types (Bose in my case, Linkplay in yours) that you will have issues like these. It’s due to the fact that Sonos is considered a restricted device by the Spotify Web API, as it does not fully implement the Spotify Player API. If you are just switching play output then it usually works fine.

The weirdness starts happening when you issue play track or play context commands to the Sonos device. It cannot do those functions natively due to the device restrictions, but the SpotifyPlus gets around this by building a local queue on the Sonos device and transferring play to the Sonos device local queue. When that happens, the Sonos device disconnects from Spotify and is playing totally from its local queue. Then if you transfer play back to a non-Sonos device, it’s totally different because the Spotify player is not in sync with the Sonos local queue. It’s confusing I know, but it’s all due to Sonos being a restricted device.

More info can be found on the Sonos Brand Notes page.

Hi,

I tried the Spotify Plus Card and it is great and offers a lot of features.

But There is one problem. It shows only 3 Devices.My other Spotify card shows also the Chromecast devices which I´m missing in the Spotify Plus card.

Is it possible to get Chromecast devices as well displayed in your card as they also act as Spotify Connect devices?

Thx
René

1 Like

@rene-zuch
Chrome cast devices are currently not supported at this time, as I don’t have any devices to test with. It’s on the list for a future enhancement, but I cannot do anything until I have a device(s) to test with.

Hello, I’ve been using the integration for a few days now and I’m completely thrilled! Super performance! However, as I like to listen to the radio, my question is whether it is somehow possible to integrate radio stations ( url,…)?

Best regards!

@Richi
Hi Stefan - Are you referring to Spotify Radio? If so, then it’s as easy as searching for the Spotify Radio item that you want (usually an artist) and clicking on the tile to play it. Note that Spotify Radio stations are just playlists. You can also set user preset items for your favorite Spotify radio stations. For example:

userPresets:
  - name: MercyMe Radio
    subtitle: Radio Preset
    image_url: https://pickasso.spotifycdn.com/image/ab67c0de0000deef/dt/v1/img/radio/artist/6APm8EjxOHSYM5B4i3vT3q/en
    uri: spotify:playlist:37i9dQZF1E4yDJXskjdgzU
    type: playlist

If you are referring to TuneIn or some other type of radio play, then those are not supported in SpotifyPlus.

Hope it helps.

Todd

Todd thanks for your tip! I was actually thinking of tunein, but no problem.

However, I have just noticed that I often get this message and then nothing can be played!

@Richi
Hi Stefan - I get those messages sometimes too with my Bose devices. It is due to the device only being able to handle only 1 request at a time on its exposed Spotify Connect Zeroconf web-service. This can happen when the device is being polled, or if another Spotify Connect player is issuing a command. It can also happen due to SpotifyPlus polling the device every 5 minutes for updated status.

You should be able to try the operation again within a couple of seconds, and the operation should succeed.

What’s the manufacturer of the device in question (e.g. Sonos? Bose? etc)?

Hello, I have a denon avr x-1600 H and Teufel holist speakers. This has already happened with both devices!
Thanks for your help!

1 Like

Can I help with testing? Is the protocol completely different or is it something you just have to enable?

I´m willing to help and able to use wireshark if that helps.

BR
René

1 Like

@rene-zuch
Thanks for the offer, but I have not researched what it would take to enable Chromecast device support since I do not have any Chromecast devices to test with.

Questions for you …

  1. do the Chromecast devices show up in the SpotifyPlus card devices display after they have been “woken up” by another process? For example, if you start play on a Chromecast device via the Spotify desktop player, will it then show up in the SpotifyPlus card device list? I am trying to determine if the Chromecast device just needs to be woken up, or if it requires special processing to control play functions as well.

  2. do Chromecast devices show up in the source list for the standard HA Spotify player? Just curious how they work with the HA Spotify player.

  3. is the SpotifyCard (not SpotifyPlus Card) required in order to play Spotify on Chromecast devices? And I think SpotCast is required as well, correct?

  1. Yes they do. I had to do a refresh and then they appeared.

  2. Yes, but also only the ones I´m currently streaming to.

  3. You are right. Spotcast is required as well.

Regards
René

1 Like

@rene-zuch
Thanks Rene. From the SpotifyPlus Card Device Browser, can you do a click and hold on one of the Chromecast devices to display the details? If you could take a screen capture and replay back with it that would be great.

It will look something like this (this is for one of my Bose SoundTouch 10 devices):

I’m curious to see what some of the details are for Chromecast devices.

Thanks!

image