SpotifyPlus Integration

Hi @thlucas,
We were discussing in another thread about using spotifyplus to solve an issue I have of getting the current que. That works great.
I’m also trying to use spotifyplus now to solve the issue of Home Assistant losing the ability to connect to some devices, and then having to open the spotify app on my phone to reconnect it.

I am never able to do so using the zeroconf_device_connect service:

HomeAssistantError: Validation error: SAM0001E - An unhandled exception occured while processing method “GetInformation”.
HTTPConnectionPool(host=‘192.168.0.139’, port=45679): Max retries exceeded with url: /zc?action=getInfo&version=1.0 (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x7f749674f980>: Failed to establish a new connection: [Errno 111] Connection refused’))

These are the parameters i’m using for the zeroconf_device_connect service

{
“host_ipv4_address”: “192.168.0.139”,
“host_ip_port”: 45679,
“cpath”: “/zc”,
“version”: “1.0”,
“use_ssl”: “False”,
“username”: “[email protected]”,
“password”: “YYY”,
“loginid”: “ZZZ”,
“pre_disconnect”: “True”,
“verify_device_list_entry”: “True”,
“delay”: 7
}

I am sort of able to do so using the player_transfer_playback functionality.
Usually it fails the first time at which stage I get the error:

HomeAssistantError: Validation error: SAM0001E - An unhandled exception occured while processing method “GetInformation”.
HTTPConnectionPool(host=‘192.168.0.139’, port=45371): Max retries exceeded with url: /zc?action=getInfo&version=2.7.1 (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x7f749557ea80>: Failed to establish a new connection: [Errno 111] Connection refused’))

If I try a second time it looks like it’s working. I have the impression when using the zeroconf discover devices service, that the HEOS devices are changing the port on which they need to be connected quite frequently and the first time it is using an outdated port. The second time I don’t know what port it uses as it is no longer throwing an error.

I’m doing these tests by connecting to the player on my phone with one spotify account and then trying to connect to it using your spotify plus with another account (for which it will be unavailable initially as the other account is using it).

I see you’ve been doing some digging for Denon AVR / HEOS devices recently on people getting this connection refused error.

Thanks, but I’m actually not able to delete the intigration from HA.
Going into the ‘Services and Integrations’ → ‘Spotifyplus’ -->Three dots → ‘Delete’, nothing happens. I’m able to Disable it, but even after restart the integration will not delete.
Going into HACS, trying to remove it, it promts to Delete prior to remove.
I have even tried to roll back my HA instance to a prior backup, I still get the errors in the log upon restart. In the Integration page it says that the integration is not loaded. Any clues?
image

@quizzical
It may be that the Denon HEOS device needs a little more time to process the command. The Connection refused error indicates the device is busy processing another Spotify Connect Zeroconf request; the built-in server can only handle 1 request at a time.

If the port IS changing like you suspect, then I would recommend using the get_spotify_connect_device service with the refresh_device_list: true and activate_device: true parameters. You might also play with the delay value to increase the time it waits for the device.

action: spotifyplus.get_spotify_connect_device
data:
  entity_id: media_player.spotifyplus_todd_l
  device_value: Bose-ST10-1
  refresh_device_list: true
  activate_device: true
  delay: 3.0

Another option is to use the player_transfer_playback service, with the refresh_device_list: true and force_activate_device: true options. You might also play with the delay value to increase the time it waits for the device.

action: spotifyplus.player_transfer_playback
data:
  entity_id: media_player.spotifyplus_todd_l
  device_id: Bose-ST10-1
  play: true
  delay: 3.0
  refresh_device_list: true
  force_activate_device: true

@witno
You may have to remove the integration manually. Only do this if you are comfortable editing JSON-formatted files; if you accidentally delete something you shouldn’t, then it could result in a complete restore of HA. I would also suggest taking a backup before you do it.

Use the following to manually remove the integration:

  1. In your HA config folder there’s a hidden “.storage” folder.
  2. In there you will see a file named core.config_entries.
  3. Lookup the entry in there for SpotifyPlus and remove that block.
  4. Restart HA.
  5. Now you should be able to remove SpotifyPlus from HACS as well.

Many thanks for the suggestions!

I tried the get_spotify_connect_device but it results in the same error:

HomeAssistantError: Validation error: SAM0001E - An unhandled exception occured while processing method “GetInformation”.
HTTPConnectionPool(host=‘192.168.0.139’, port=50041): Max retries exceeded with url: /zc?action=getInfo&version=2.7.1 (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x7fa78b8a0230>: Failed to establish a new connection: [Errno 111] Connection refused’))

I also tried player_transfer_playback with the options you suggested but the result is unfortunately the same.
It doesn’t work the first time but does work the second time.

Thanks. Will try.
Before I read your awnser, I actually think I was able to delete, uninstall and reinstall.
Upon restarting after reinstall, I went into Itegrations → Add integration and selected SpotifyPlus. It seems to start the config routine, however shortly, this appears:
image

@witno
It sounds like something is definitely wrong with the configuration data somewhere (e.g. corrupted HACS entry, entity config, etc). You may have partially removed it via the UI; if you can do that again, I would then restart HA a couple of times afterwards. Sometimes HA can restore things from saved state data, as well as have things cached in the web browser.

I would suggest performing a file search on “spotifyplus” in the .storage location, and try to manually remove configuration items related to matches found. If you can also do it while HA is shut down that would be even better. In searching my own install, the following are likely candidates:

  • application_credentials
  • core.config_entries
  • hacs.data
  • hacs.repositories

You can also manually remove the config\custom_components\spotifyplus directory.

I know it’s not the most convenient option, but when the HA user-interface doesn’t allow you to remove it you have to take drastic measures. I’ve had to do this on a couple of different integrations over the years, and it’s kinda nerve-wracking so I feel your pain.

@quizzical
At this point, I would suggest that you Open a New Issue so we can track progress.

Can you turn Debug mode on and go through the steps to reproduce the error, then post the results to the new issue?

@thlucas
OK great, I have opened the issue where I have documented the steps to produce the error:

Hi Todd,
I was able to delete and remove from Integrations and HACS. Did several restarts There were no spotifyplus entries in core.config_entries. I removed the application credentials for SpotifyPlus. Restarted.
Then I downoaded it from HACS to do a flesh start. Upon restaring, after download, I folowed the instructions on the wiki page. I used the same Sptotifi developer app that I used the last time, pasting in the CkientID and Client secret.
Now, when I press Add, I get a new error. No application_credentials platform for spotifyplus …? Any clues?

@witno
At this point, I would suggest that you Open a New Issue on GitHub so we can track progress.

Are there any system log entries related to the No application_credentials platform message you received?

What happens if you try manually adding application credentials for the Spotify integration? Just to verify that the HA application credentials integration is working properly.

Thank’s for your help and efford.
Finally got it fixed. Went through backups without luck. But the two weeks old Full backup got the Spotifyplus issue sorted. Thank god the integration is back. Now it’s just the job of rebuilding 14 days of dashboard modifications :wink:
Don’t know what it was that triggerd it, but my bet is som issue during the latest SP ugrade that messed up one or more files.
Thanks again and Happy New Year!

1 Like

@witno
You’re more than welcome; glad you got it fixed!

To be honest, I do not have a clue on what caused it. I’m thinking it has something to do with the way HACS updates things, but not for sure. This is only the second time in the life of the integration that someone has reported issues with the config flow / application credentials problems after an update. They had to remove things manually as well in order to get it going again. I have had to do the same with a couple of other integrations in the past, and it is not fun.

Happy New Year to you as well.

Hi @thlucas ,

I’m installing SpotifyPlus for the first time, and I’m also hitting the “No application_credentials platform for spotifyplus” error.

I’ve tried deleting/re-installing the integration with multiple restarts in between, clearing the cache, etc without any luck

HA, HACS, etc are all up to date.

Any recommendations?

@goalar
Please Open a New Issue on GitHub so we can track progress.

Not sure what is going on here, as you are the second user in 2 days to experience this issue. I completely uninstalled SpotifyPlus on 2 different HA instances and re-installed with no issues. I’m running HA OS 2024.12.5, and HACS 2.0.1 (frontend 20240903140523).

You might try uninstalling the HA Spotify integration and removing application credentials, and re-installing to see if the problem is isolated to SpotifyPlus (or if it’s an HA Application Credentials issue).

You might also post any relevant System Log entries to the new issue created.

Hi, how do i delete some devices from the list?
if i enter the name it gives me the attached error. But the same happens if i enter ID. I tried different combinations but nothing to do.
thanks in advance

@Ector73
Just use a string value, delimited by semi-colons (e.g. ;). Like so:

Bose-st300; havm-spotifyconnect

image

Is that not working for you?

unfortunately it doesn’t work, it gives me the error I attached. I’m looking for an alternative way to not make it appear in the list at all.

@Ector73
That’s odd, as the entry field is just a string-entry field; there is no device name or id verification at the point it’s trying to be saved.

The value must be one of ['CEOL ( ... error indicates there is something wrong with the “Default Spotify Connect Player Device ID when none are active” field. You do not have anything specified for that though, which is odd.

The only things I can suggest are:

  1. clear your browser cache and restart HA. This is quite frequently the issue with HA config entry screen errors due to the way the HA UI caching system works.
  2. if you are copy / pasting the value, then you might try just typing it in instead.
1 Like

Hi!

Has anyone succesfully been able to extract the result from get_player_queue_info and show it in lovelace, perhaps even with the ability to tap a track in the list and have it play?

1 Like