Thank you. I had read those posts and gave device_name a try, but using that same syntax, I keep getting ‘Failed to call service spotcast.start. Unknown error’ in the Developer|Services Tools and ‘Failed to call service spotcast/start. ‘NoneType’ object is not subsriptable’ when actually trying it with a service call from Mini Media Player. The only seemingly relevant difference between our setups is Google vs Echo devices. Does Google allow for more than one Spotify account to be connected to a Google Assistant (Home?) device at a time?
EDIT: I have also tried the media_player entity_id. Same errors.
One of my children who is older has their own Spotify account (under our Family plan). I have configured spotcast with their sp_dc and sp_key and successfully used that account in their original preset buttons.
However, going by this, the main house account is configured without a name (a default of sorts).
I’ve tried using that default account (no account specified) and my child’s account. Same issues.
Here’s a debug log:
Logger: homeassistant.helpers.script.websocket_api_script
Source: custom_components/spotcast/spotcast_controller.py:187
Integration: Spotcast (documentation, issues)
First occurred: 3:34:02 PM (1 occurrences)
Last logged: 3:34:02 PM
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: ‘NoneType’ object is not subscriptable
Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 447, in _async_step await getattr(self, handler)() File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 680, in _async_call_service_step await service_task File “/usr/src/homeassistant/homeassistant/core.py”, line 1627, in async_call task.result() File “/usr/src/homeassistant/homeassistant/core.py”, line 1670, in _execute_service await self._hass.async_add_executor_job( File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 58, in run result = self.fn(*self.args, **self.kwargs) File “/config/custom_components/spotcast/init.py”, line 190, in start_casting spotify_device_id = spotcast_controller.get_spotify_device_id( File “/config/custom_components/spotcast/spotcast_controller.py”, line 200, in get_spotify_device_id spotify_device_id = self._getSpotifyConnectDeviceId(client, device_name) File “/config/custom_components/spotcast/spotcast_controller.py”, line 187, in _getSpotifyConnectDeviceId for device in devices_available[“devices”]: TypeError: ‘NoneType’ object is not subscriptable
Hmm. So in my spotcast setup I redefine the default account to give it a name. I would try that and try calling it with that account.
Another question. Do you see the media player you are trying to target in sensor.chromecast_devices attributes? I’m wondering if your Echo is being picked up as a Spotify Connect device for spotcast.
Have you ever succesfully started Spotify with spotcast on that echo?
Is the media player listed in sensor.chromecast device attributes?
Are you trying to start spotify directly from dev_tools to test it?
Can you post the service call yaml you are using?
Ah. I have all cast devices. I thought the chromecast_devices would have picked up the Spotify Connect devices also. And yeah your service call looks ok…
Do you have any other media players that spotcast does work on? Do you have any spotcast errors on startup? You’re sure the credentials haven’t expired?
You might have to open an issue on the github. I think I’m all out of ideas.
I’m fairly certain the sp_dc and sp_key are still good since the service call works with a renewed Spotify Device ID, but never the other two “device types.” But, I’m not certain the token isn’t expiring after 1-2 days. Wouldn’t an expired token only affect the use of a Spotify Device ID though?
Just curious to see if anyone has managed to cast to a mobile phone running the Spotify App?
I have captured the Spotify connect ID of my Samsung S20, but Spotcast does not recognise it as as device when I run the service.
I have found that Spotify Connect devices are “locked” to the Spotify account that last used that device. They would not be available under Spotcast until I use the Android App with the account that I want to use and select that device again. I have a number of Spotify Connect devices - say Living Room and Bedroom, and two accounts A and B. If account A has connected to Living Room then Living Room is no longer available to account B. The Living Room device can be seen if account B uses an Android Spotify App to scan for Spotify Connect devices, and can be called by the spotcast.start service with account B after it has been selected using the Android Spotify App.
I can’t seem to find a way around this without using the Android Spotify App.
Do you find that Spotcast stays connected via Spotify ID as long as you don’t change the associated Spotify account? If you do change accounts and then reconnect later with that same account, do you find the Spotify ID has changed? Have you had success using Spotcast on those Spotify Connect devices using Entity ID?
Has anyone tested to compare with our lovely spotcast? I like spotcast but have to reboot HA and update the keys from time to time. Not a big deal and still very glad of the work that has been done on this component, but I wonder if this new option could benefit from more resources to support it and more stability ?
So it looks like repeat is broken (ive submitted a bug report on github). Is anyone else repeating things in Spotify? I’m using it to play some white noise during the night.
Does anyone have a workaround for repeat being broken?
Thanks
EDIT####
So, im not sure if this has now been fixed or the doco was just wrong. But repeat is now working with;
I’m trying to resolve problems with my Spotcast use case.
When I’m going shower, motion detection is starting my playlist.
Unfortunately, sometimes I got errors like: Could not get spotify token Cound not get device ID
or Error: http status: 404, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=blablabla: Device not found, reason: None
So I started to use continue_on_error flag from recent changes to repeat until my google home mini start spotify playlist. Unfortunately I’m still stuck with: Error: http status: 404, code:-1 - https://api.spotify.com/v1/me/player/play device_id=4a6386d57172e18e0103de65e9a5a574: Device not found, reason: None
I believe it can’t find device because it’s not available source (checked with spotify API).
How to get past that?
I have a generic question: After how long do the tokens/cookies expire ?
My Spotify-Card stopped working a few days ago and I realized it relied on Spotcast. I then followed the Spotcast installation process again, and then realized I just had to update the sp_dc and sp_key cookies.
It might be obvious for people who often read the debug logs, but for random users like me, it would be great to get a notification on the Home Assistant left panel when the tokens have to be renewed. That would really help understand what’s wrong and save a lot of time !