Spotify developer console looks different than the documentation.
Bug Ticket
Describe the bug
Spotify developer console looks nothing like what the documentation suggests it will. I assume this is because of an update or something. Is there any chance you can walk me through how to get the logs? I have also tried the home assistant logs method and get_spotify_devices doesn't seem to work either. If I type spotify, here's what I get:
2024-01-02 23:32:52.203 INFO (MainThread) [homeassistant.setup] Setting up spotify
2024-01-02 23:32:52.203 INFO (MainThread) [homeassistant.setup] Setup of domain spotify took 0.0 seconds
2024-01-02 23:32:54.802 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.spotify
2024-01-02 23:32:56.950 DEBUG (SyncWorker_4) [custom_components.spotcast.helpers] spotify integration found
These don't look like names of player. unless it's literally just media_player.spotify
Troubleshooting
Make sure to validate all the elements before submitting the ticket (Exception to the steps marked as optional)
- [ ] Using latest version of spotcast
- [ ] Using latest stable version of Home Assistant
- [ ] I have setup the Spotify integration in Home Assistant
- [ ] I have renewed my
sp_dcandsp_keyvalues and restarted Home Assistant (see README) - [ ] (optional) I have Spotify Premium
- [ ] (optional) I am using multiple accounts
- [ ] (optional) I'm attaching relevant logs with level debug for component spotcast (see README)
- [ ] (optional) I'm using entity_id in the service call and have tried device_name but the issue remains
Environment
- Installation type: [HA_OS|Container|Supervised|Core]
- HA version: [ container]
- spotcast version: [ most recent]
Configuration
# please remove any sensitive information like cookies and token keys
spotcast:
sp_dc: !secret sp_dc
sp_key: !secret sp_key
country: US #optional, added in 3.6.24
logger:
default: info
logs:
Service Call
If relevant, provide a yaml of the service call or explain the action taken to replicate the issue.
<insert the yaml of the service call here>
Logs
- normal|debug
<please insert any relevent logs here>
Additional context
Hi @Jacksonbm1 the spotify console did change, that's more than possible, still, it is almost the same workflow as before. I know you posted some questions in a closed ticket, but that wouldn't be great for documentation, so please confirm If my answer do help with your questions
To answer some of your question:
- I imagine you forgot to provide some details about your log configuration, because it has no detail about spotcast. Make sure you use the documented yaml configuration:
logger:
default: info
logs:
custom_components.spotcast: debug
-
If you search for logs of a specific integration, search with the name of this integration. The error you are making is searching for
spotify, but the integration is calledspotcast. But you should still have found the correct log, which seems to indicate that you didn't setup your debug log correctly. -
the developper did change, but purely from a cosmetic ui approach. The functionality is still there. One added benefit of the new interface is that it autofetch a token with the proper priviledges when clicking the
try itbutton, but that part is still working exactly the same.

- media_player.spotify is created by the Spotify integration, not spotcast (Spotcast actually does not create any media_player, you need to integrate them in Home Assistant separatly)
Hope this answers your questions. My final though would be a question to you. Why do you need the spotify ID? It is a lot more cumbersome to use compare to direct media_player request. I would only advise for using spotify ids for devices that can't nicely integrate with Home Assistant. So what kind of devices are you trying to control with spotcast at the moment? there might be a better way to do it.
Hi, there were a lot of things that I figured out after filing this bug, so I'll try to reset a little bit.
First, yes, I should have commented here, sorry about that.
Second, I figured out how to use the developer console a bit more and it now is no longer blocking. If I have time, I will create a PR to update the documentation with more specific instructions.
Third, regarding which player to use... this is the sticking point for me.
I thought I was supposed to set up with the spotify player ID because I thought that the base HA integration didn't allow for google homes to get paired with spotify (isn't that part of the point of this integration?).
When I try using the media_player, it works very flakily. Sometimes it works, but usually what happens is that it doesn't work. What happens is that it will make the chime noise that indicates I'm casting to it, but then won't play music. I'll attach some logs.
it almost looks like it's kicking the google home off of my network when I try to use the script
I
Messages I get using the spotify ID (I redacted the IDs, not sure if I needed to, but whatever):
Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.11/site-packages/pychromecast/socket_client.py:398
First occurred: 5:02:08 AM (151 occurrences)
Last logged: 10:43:49 PM
[Kitchen Wifi([::ffff:c0a8:5620]):8009] Failed to connect to service ServiceInfo(type='host', data=('[::ffff:c0a8:5620]', 8009)), retrying in 5.0s
[downstairs(192.168.86.49):32116] Failed to connect to service ServiceInfo(type='mdns', data='Google-Cast-Group-<ID>._googlecast._tcp.local.'), retrying in 5.0s
[everywhere(192.168.86.49):32161] Failed to connect to service ServiceInfo(type='mdns', data='Google-Cast-Group-<ID>-1._googlecast._tcp.local.'), retrying in 5.0s
[Integra DRX-2.1 E6A689(192.168.86.50):8009] Failed to connect to service ServiceInfo(type='mdns', data='Integra-DRX-2.1-<ID>._googlecast._tcp.local.'), retrying in 5.0s
[Living Room speaker([::ffff:c0a8:5631]):8009] Failed to connect to service ServiceInfo(type='host', data=('[::ffff:c0a8:5631]', 8009)), retrying in 5.0s
Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.11/site-packages/pychromecast/socket_client.py:678
First occurred: 5:58:24 AM (233 occurrences)
Last logged: 10:43:49 PM
[Integra DRX-2.1 E6A689(192.168.86.50):8009] Heartbeat timeout, resetting connection
[Wine speaker(192.168.86.42):8009] Heartbeat timeout, resetting connection
[downstairs(192.168.86.49):32116] Heartbeat timeout, resetting connection
[Living Room speaker(192.168.86.49):8009] Heartbeat timeout, resetting connection
[Kitchen Wifi(192.168.86.32):8009] Heartbeat timeout, resetting connection
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/spotcast/spotcast_controller.py:384
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:34:21 PM (2 occurrences)
Last logged: 10:43:40 PM
[2556801896] Error handling message: Unknown error (unknown_error) Jackson Min from 192.168.86.37 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
[2519209064] Error handling message: Unknown error (unknown_error) Jackson Min from 192.168.86.37 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 271, in _internal_call
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/me/player/play?device_id=<ID>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 782, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2111, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/__init__.py", line 256, in start_casting
spotcast_controller.play(
File "/config/custom_components/spotcast/spotcast_controller.py", line 384, in play
client.start_playback(**kwargs)
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 1821, in start_playback
return self._put(
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 338, in _put
return self._internal_call("PUT", url, payload, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 293, in _internal_call
raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=<id>:
Player command failed: Restriction violated, reason: UNKNOWN
Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:468
First occurred: 10:34:21 PM (2 occurrences)
Last logged: 10:43:40 PM
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: http status: 403, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=<ID>: Player command failed: Restriction violated, reason: UNKNOWN
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: http status: 404, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=<ID>: Device not found, reason: None
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 271, in _internal_call
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/me/player/play?device_id=<ID>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2111, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/__init__.py", line 256, in start_casting
spotcast_controller.play(
File "/config/custom_components/spotcast/spotcast_controller.py", line 384, in play
client.start_playback(**kwargs)
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 1821, in start_playback
return self._put(
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 338, in _put
return self._internal_call("PUT", url, payload, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 293, in _internal_call
raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=<ID>:
Player command failed: Restriction violated, reason: UNKNOWN
This error originated from a custom integration.
Logger: spotipy.client
Source: custom_components/spotcast/spotcast_controller.py:384
Integration: Spotcast (documentation, issues)
First occurred: 10:34:21 PM (2 occurrences)
Last logged: 10:43:40 PM
HTTP Error for PUT to https://api.spotify.com/v1/me/player/play?device_id=<ID> with Params: {} returned 403 due to Player command failed: Restriction violated
HTTP Error for PUT to https://api.spotify.com/v1/me/player/play?device_id=<ID> with Params: {} returned 404 due to Device not found
Messages for casting to media_player:
Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.11/site-packages/pychromecast/socket_client.py:678
First occurred: 5:58:24 AM (177 occurrences)
Last logged: 10:35:09 PM
[Living Room speaker(192.168.86.49):8009] Heartbeat timeout, resetting connection
[coffee maker(192.168.86.36):8009] Heartbeat timeout, resetting connection
[Kitchen Wifi(192.168.86.32):8009] Heartbeat timeout, resetting connection
[Wine speaker(192.168.86.42):8009] Heartbeat timeout, resetting connection
[Integra DRX-2.1 E6A689(192.168.86.50):8009] Heartbeat timeout, resetting connection
Then I get one of many messages:
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/spotcast/spotify_controller.py:110
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:32:29 PM (2 occurrences)
Last logged: 10:35:29 PM
[2556801896] Error handling message: Unknown error (unknown_error) Jackson Min from 192.168.86.37 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 782, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2111, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/__init__.py", line 221, in start_casting
spotify_device_id = spotcast_controller.get_spotify_device_id(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/spotcast_controller.py", line 301, in get_spotify_device_id
spotify_cast_device.start_spotify_controller(access_token, expires)
File "/config/custom_components/spotcast/spotcast_controller.py", line 104, in start_spotify_controller
sp.launch_app()
File "/config/custom_components/spotcast/spotify_controller.py", line 110, in launch_app
raise LaunchError(
pychromecast.error.LaunchError: Timeout when waiting for status response from Spotify app
Logger: homeassistant.helpers.script.websocket_api_script
Source: helpers/script.py:468
First occurred: 10:32:29 PM (2 occurrences)
Last logged: 10:35:29 PM
websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Timeout when waiting for status response from Spotify app
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2111, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/__init__.py", line 221, in start_casting
spotify_device_id = spotcast_controller.get_spotify_device_id(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/spotcast_controller.py", line 301, in get_spotify_device_id
spotify_cast_device.start_spotify_controller(access_token, expires)
File "/config/custom_components/spotcast/spotcast_controller.py", line 104, in start_spotify_controller
sp.launch_app()
File "/config/custom_components/spotcast/spotify_controller.py", line 110, in launch_app
raise LaunchError(
pychromecast.error.LaunchError: Timeout when waiting for status response from Spotify app
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/spotcast/spotcast_controller.py:384
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10:34:21 PM (1 occurrences)
Last logged: 10:34:21 PM
[2556801896] Error handling message: Unknown error (unknown_error) Jackson Min from 192.168.86.37 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 271, in _internal_call
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/me/player/play?device_id=<deviceID>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 782, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2111, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/__init__.py", line 256, in start_casting
spotcast_controller.play(
File "/config/custom_components/spotcast/spotcast_controller.py", line 384, in play
client.start_playback(**kwargs)
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 1821, in start_playback
return self._put(
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 338, in _put
return self._internal_call("PUT", url, payload, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 293, in _internal_call
raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=<deviceID>:
Player command failed: Restriction violated, reason: UNKNOWN
Here's another dump when it worked and then stopped. I do think there may have been some connectivity issues on my side, so I may need to troubleshoot more:
Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/spotcast/spotcast_controller.py:384 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 10:34:21 PM (4 occurrences) Last logged: 11:00:37 PM
[2556801896] Error handling message: Unknown error (unknown_error) Jackson Min from 192.168.86.37 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
[2519209064] Error handling message: Unknown error (unknown_error) Jackson Min from 192.168.86.37 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
[2629537960] Error handling message: Unknown error (unknown_error) Jackson Min from 192.168.86.37 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
[2918951464] Error handling message: Unknown error (unknown_error) Jackson Min from 192.168.86.37 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36)
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 271, in _internal_call
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/me/player/play?device_id=
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 782, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2111, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/init.py", line 256, in start_casting
spotcast_controller.play(
File "/config/custom_components/spotcast/spotcast_controller.py", line 384, in play
client.start_playback(**kwargs)
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 1821, in start_playback
return self._put(
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 338, in _put
return self._internal_call("PUT", url, payload, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/spotipy/client.py", line 293, in _internal_call
raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player/play?device_id=
Ok, this sounds super weird, but it seems like one of my scripts works perfectly and the other does not and the only difference is that one has
random song and shuffle true, but the other does not:
this one fails
service: spotcast.start
data:
force_playback: true
ignore_fully_played: true
uri: spotify:playlist:5qJYZVGOE7hSJZQYczGV8j
entity_id: media_player.downstairs_4
This one succeeds:
service: spotcast.start
data:
force_playback: true
random_song: true
shuffle: true
ignore_fully_played: true
uri: spotify:playlist:5qJYZVGOE7hSJZQYczGV8j
entity_id: media_player.downstairs_4
It's super weird, but maybe there's some bug I'm hitting?
Ok! Sorry for all the messages, I'm debugging as I go, but I think I figured out what is going on. The playlist I'm trying to play starts with a song that isn't on spotify in my region, so it bugs out.
there seems to be something wrong in your setup, almost like you don't have the correct permission for the speakers you are trying to setup. Are the speakers available in the google home app?
Basically, google's API seems to be fine with waking the device to make it available, but the problem is when Spotify tries to send an audio stream to it, it just fails to get the proper permissions.
One potential source of the problem could be that your secret is no longer active. Did you by accident logged out after you fetched the token? This might explain it. You could try to refresh the token from an incognito tab and make sure you close the window, not log out.
The playlist I'm trying to play starts with a song that isn't on spotify in my region, so it bugs out.
Unlikely, the error is at the device connection, not the playlist access part of the code
Ok. I went to sleep last night after a lot of debugging, but I think I figured it out. A lot of these issues were compounded by spectrum deciding to do WiFi repairs, so I think there was a lot of difficulty figuring out what the issue was. I think you're right that this isn't an issue with spotcast. Here's what I'm thinking it was for posterity
- I do think the playlist issue was a thing, but we'll table that for now
- spotty connection probably made issues
- I eventually realized that one of the speakers in the speaker group kept going down. Not sure why and need to debug, but it seems like resetting it helped.
Will let you know how this goes. Thank you!