Failed to get device id from Spotify (3.5.4)
See original GitHub issueHi Niklas,
Tried the new release, but it is throwing errors at me when I am using a 2nd account:
Spotcast config (3.5.4):
# configuration.yaml
spotcast:
sp_dc: !secret spotcast_sp_dc
sp_key: !secret spotcast_sp_key
accounts:
t:
sp_dc: !secret spotcast_t_sp_dc
sp_key: !secret spotcast_t_sp_key
# scripts.yaml in HomeAssistant
start_music_t:
alias: Slaaptijd
mode: restart
sequence:
- service: spotcast.start
data:
account: "t"
entity_id: media_player.hmt
uri: "spotify:track:5OoSxUZSbP1p7kb1d0SozG"
Error in the log:
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] setting up with account t
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] get_cast_devices: media_player.soundbar: Soundbar cast info: ChromecastInfo(services={ServiceInfo(type='mdns', data='B8805-81704a75fd037a7c38090eb3c5dffea5._googlecast._tcp.local.')}, uuid='81704a75-fd03-7a7c-3809-0eb3c5dffea5', _manufacturer=None, model_name='B8805', friendly_name='Soundbar', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] get_cast_devices: media_player.woonkamer: Woonkamer cast info: ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Nest-Hub-4660f5b8aabe10031a93ebd362367256._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.16', 8009))}, uuid='4660f5b8-aabe-1003-1a93-ebd362367256', _manufacturer='Google Inc.', model_name='Google Nest Hub', friendly_name='Woonkamer', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] get_cast_devices: media_player.hele_huis: Hele huis cast info: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.16', 32059)), ServiceInfo(type='mdns', data='Google-Cast-Group-eec4b1d472ec428fad8f291a69a2d97d-1._googlecast._tcp.local.')}, uuid='eec4b1d4-72ec-428f-ad8f-291a69a2d97d', _manufacturer=None, model_name='Google Cast Group', friendly_name='Hele huis', is_audio_group=True, is_dynamic_group=False)
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] get_cast_devices: media_player.studeerkamer: Studeerkamer cast info: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.12', 8009)), ServiceInfo(type='mdns', data='Google-Home-d4063db0253e246c9d66d8f7fda77a6a._googlecast._tcp.local.')}, uuid='d4063db0-253e-246c-9d66-d8f7fda77a6a', _manufacturer='Google Inc.', model_name='Google Home', friendly_name='Studeerkamer', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] get_cast_devices: media_player.zolder: Zolder cast info: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.17', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-71d8c580bbd0166b72f10071a427b6cb-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 8009))}, uuid='71d8c580-bbd0-166b-72f1-0071a427b6cb', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='Zolder', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] get_cast_devices: media_player.boven: Boven cast info: ChromecastInfo(services={ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 32213)), ServiceInfo(type='host', data=('192.168.xx.17', 32213)), ServiceInfo(type='mdns', data='Google-Cast-Group-e18cddf284be43da9917ddb7d4ceb42c-2._googlecast._tcp.local.')}, uuid='e18cddf2-84be-43da-9917-ddb7d4ceb42c', _manufacturer=None, model_name='Google Cast Group', friendly_name='Boven', is_audio_group=True, is_dynamic_group=False)
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] get_cast_devices: media_player.hmt: HMT cast info: ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.13', 8009))}, uuid='0256c1dd-13b4-4c80-849b-281970d02d11', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='HMT', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] Chromecast devices: [ChromecastInfo(services={ServiceInfo(type='mdns', data='B8805-81704a75fd037a7c38090eb3c5dffea5._googlecast._tcp.local.')}, uuid='81704a75-fd03-7a7c-3809-0eb3c5dffea5', _manufacturer=None, model_name='B8805', friendly_name='Soundbar', is_audio_group=False, is_dynamic_group=None), ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Nest-Hub-4660f5b8aabe10031a93ebd362367256._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.16', 8009))}, uuid='4660f5b8-aabe-1003-1a93-ebd362367256', _manufacturer='Google Inc.', model_name='Google Nest Hub', friendly_name='Woonkamer', is_audio_group=False, is_dynamic_group=None), ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.16', 32059)), ServiceInfo(type='mdns', data='Google-Cast-Group-eec4b1d472ec428fad8f291a69a2d97d-1._googlecast._tcp.local.')}, uuid='eec4b1d4-72ec-428f-ad8f-291a69a2d97d', _manufacturer=None, model_name='Google Cast Group', friendly_name='Hele huis', is_audio_group=True, is_dynamic_group=False), ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.12', 8009)), ServiceInfo(type='mdns', data='Google-Home-d4063db0253e246c9d66d8f7fda77a6a._googlecast._tcp.local.')}, uuid='d4063db0-253e-246c-9d66-d8f7fda77a6a', _manufacturer='Google Inc.', model_name='Google Home', friendly_name='Studeerkamer', is_audio_group=False, is_dynamic_group=None), ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.17', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-71d8c580bbd0166b72f10071a427b6cb-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 8009))}, uuid='71d8c580-bbd0-166b-72f1-0071a427b6cb', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='Zolder', is_audio_group=False, is_dynamic_group=None), ChromecastInfo(services={ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 32213)), ServiceInfo(type='host', data=('192.168.xx.17', 32213)), ServiceInfo(type='mdns', data='Google-Cast-Group-e18cddf284be43da9917ddb7d4ceb42c-2._googlecast._tcp.local.')}, uuid='e18cddf2-84be-43da-9917-ddb7d4ceb42c', _manufacturer=None, model_name='Google Cast Group', friendly_name='Boven', is_audio_group=True, is_dynamic_group=False), ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.13', 8009))}, uuid='0256c1dd-13b4-4c80-849b-281970d02d11', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='HMT', is_audio_group=False, is_dynamic_group=None)]
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] cast info: ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.13', 8009))}, uuid='0256c1dd-13b4-4c80-849b-281970d02d11', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='HMT', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:35:30 DEBUG (SyncWorker_4) [custom_components.spotcast] Found cast device: Chromecast(None, port=8009, device=DeviceStatus(friendly_name='HMT', model_name='Google Home Mini', manufacturer='Google Inc.', uuid='0256c1dd-13b4-4c80-849b-281970d02d11', cast_type='audio'))
2021-04-19 09:35:36 DEBUG (SyncWorker_4) [custom_components.spotcast] get_spotify_devices: media_player.spotify_t: Spotify T HH: []
2021-04-19 09:35:36 DEBUG (SyncWorker_4) [custom_components.spotcast] get_spotify_devices: media_player.spotify_m: Spotify M HH: []
2021-04-19 09:35:36 DEBUG (SyncWorker_4) [custom_components.spotcast] get_spotify_devices: media_player.spotify_hmmbob: Spotify Hmmbob HH: []
2021-04-19 09:35:36 DEBUG (SyncWorker_4) [custom_components.spotcast] devices_available: {'devices': []} bf7485e4bdc069dfd996748826af2f02
2021-04-19 09:35:36 ERROR (SyncWorker_4) [custom_components.spotcast] No device with id "bf7485e4bdc069dfd996748826af2f02" known by Spotify
2021-04-19 09:35:36 ERROR (SyncWorker_4) [custom_components.spotcast] Known devices: []
2021-04-19 09:35:36 ERROR (MainThread) [homeassistant.components.script.start_music_t] Slaaptijd: Error executing script. Error for call_service at pos 2: Failed to get device id from Spotify
2021-04-19 09:35:36 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 392, in _async_run
return await self.script.async_run(variables, context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1200, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 341, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 359, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 559, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1519, in _execute_service
await self._hass.async_add_executor_job(handler.job.target, service_call)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/spotcast/__init__.py", line 379, in start_casting
spotify_device_id = spotify_cast_device.getSpotifyDeviceId(get_spotify_devices(hass))
File "/config/custom_components/spotcast/__init__.py", line 574, in getSpotifyDeviceId
raise HomeAssistantError("Failed to get device id from Spotify")
homeassistant.exceptions.HomeAssistantError: Failed to get device id from Spotify
What I can see with my non-dev eye, is that the requested Cast device is actually found (media_player.hmt) by get_cast_devices
, but that it isn’t listed as known spotify device (in get_spotify_devices
and thus throws an error. To be sure it wasn’t a token error or something, I’ve already updated the sp_dc
and sp_key
values for both accounts (default and t
account), without any difference.
When using the default account, it all works fine: --edit: later proved wrong, see comments below
# scripts.yaml in HomeAssistant
start_music_t:
alias: Slaaptijd
mode: restart
sequence:
- service: spotcast.start
data:
entity_id: media_player.hmt
uri: "spotify:track:5OoSxUZSbP1p7kb1d0SozG"
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] setting up with account default
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] get_cast_devices: media_player.soundbar: Soundbar cast info: ChromecastInfo(services={ServiceInfo(type='mdns', data='B8805-81704a75fd037a7c38090eb3c5dffea5._googlecast._tcp.local.')}, uuid='81704a75-fd03-7a7c-3809-0eb3c5dffea5', _manufacturer=None, model_name='B8805', friendly_name='Soundbar', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] get_cast_devices: media_player.woonkamer: Woonkamer cast info: ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Nest-Hub-4660f5b8aabe10031a93ebd362367256._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.16', 8009))}, uuid='4660f5b8-aabe-1003-1a93-ebd362367256', _manufacturer='Google Inc.', model_name='Google Nest Hub', friendly_name='Woonkamer', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] get_cast_devices: media_player.hele_huis: Hele huis cast info: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.16', 32059)), ServiceInfo(type='mdns', data='Google-Cast-Group-eec4b1d472ec428fad8f291a69a2d97d-1._googlecast._tcp.local.')}, uuid='eec4b1d4-72ec-428f-ad8f-291a69a2d97d', _manufacturer=None, model_name='Google Cast Group', friendly_name='Hele huis', is_audio_group=True, is_dynamic_group=False)
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] get_cast_devices: media_player.studeerkamer: Studeerkamer cast info: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.12', 8009)), ServiceInfo(type='mdns', data='Google-Home-d4063db0253e246c9d66d8f7fda77a6a._googlecast._tcp.local.')}, uuid='d4063db0-253e-246c-9d66-d8f7fda77a6a', _manufacturer='Google Inc.', model_name='Google Home', friendly_name='Studeerkamer', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] get_cast_devices: media_player.zolder: Zolder cast info: ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.17', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-71d8c580bbd0166b72f10071a427b6cb-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 8009))}, uuid='71d8c580-bbd0-166b-72f1-0071a427b6cb', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='Zolder', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] get_cast_devices: media_player.boven: Boven cast info: ChromecastInfo(services={ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 32213)), ServiceInfo(type='host', data=('192.168.xx.17', 32213)), ServiceInfo(type='mdns', data='Google-Cast-Group-e18cddf284be43da9917ddb7d4ceb42c-2._googlecast._tcp.local.')}, uuid='e18cddf2-84be-43da-9917-ddb7d4ceb42c', _manufacturer=None, model_name='Google Cast Group', friendly_name='Boven', is_audio_group=True, is_dynamic_group=False)
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] get_cast_devices: media_player.hmt: HMT cast info: ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.13', 8009))}, uuid='0256c1dd-13b4-4c80-849b-281970d02d11', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='HMT', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] Chromecast devices: [ChromecastInfo(services={ServiceInfo(type='mdns', data='B8805-81704a75fd037a7c38090eb3c5dffea5._googlecast._tcp.local.')}, uuid='81704a75-fd03-7a7c-3809-0eb3c5dffea5', _manufacturer=None, model_name='B8805', friendly_name='Soundbar', is_audio_group=False, is_dynamic_group=None), ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Nest-Hub-4660f5b8aabe10031a93ebd362367256._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.16', 8009))}, uuid='4660f5b8-aabe-1003-1a93-ebd362367256', _manufacturer='Google Inc.', model_name='Google Nest Hub', friendly_name='Woonkamer', is_audio_group=False, is_dynamic_group=None), ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.16', 32059)), ServiceInfo(type='mdns', data='Google-Cast-Group-eec4b1d472ec428fad8f291a69a2d97d-1._googlecast._tcp.local.')}, uuid='eec4b1d4-72ec-428f-ad8f-291a69a2d97d', _manufacturer=None, model_name='Google Cast Group', friendly_name='Hele huis', is_audio_group=True, is_dynamic_group=False), ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.12', 8009)), ServiceInfo(type='mdns', data='Google-Home-d4063db0253e246c9d66d8f7fda77a6a._googlecast._tcp.local.')}, uuid='d4063db0-253e-246c-9d66-d8f7fda77a6a', _manufacturer='Google Inc.', model_name='Google Home', friendly_name='Studeerkamer', is_audio_group=False, is_dynamic_group=None), ChromecastInfo(services={ServiceInfo(type='host', data=('192.168.xx.17', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-71d8c580bbd0166b72f10071a427b6cb-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 8009))}, uuid='71d8c580-bbd0-166b-72f1-0071a427b6cb', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='Zolder', is_audio_group=False, is_dynamic_group=None), ChromecastInfo(services={ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 32213)), ServiceInfo(type='host', data=('192.168.xx.17', 32213)), ServiceInfo(type='mdns', data='Google-Cast-Group-e18cddf284be43da9917ddb7d4ceb42c-2._googlecast._tcp.local.')}, uuid='e18cddf2-84be-43da-9917-ddb7d4ceb42c', _manufacturer=None, model_name='Google Cast Group', friendly_name='Boven', is_audio_group=True, is_dynamic_group=False), ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.13', 8009))}, uuid='0256c1dd-13b4-4c80-849b-281970d02d11', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='HMT', is_audio_group=False, is_dynamic_group=None)]
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] cast info: ChromecastInfo(services={ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.xx.13', 8009))}, uuid='0256c1dd-13b4-4c80-849b-281970d02d11', _manufacturer='Google Inc.', model_name='Google Home Mini', friendly_name='HMT', is_audio_group=False, is_dynamic_group=None)
2021-04-19 09:49:07 DEBUG (SyncWorker_5) [custom_components.spotcast] Found cast device: Chromecast(None, port=8009, device=DeviceStatus(friendly_name='HMT', model_name='Google Home Mini', manufacturer='Google Inc.', uuid='0256c1dd-13b4-4c80-849b-281970d02d11', cast_type='audio'))
2021-04-19 09:49:13 DEBUG (SyncWorker_5) [custom_components.spotcast] get_spotify_devices: media_player.spotify_t: Spotify T HH: []
2021-04-19 09:49:13 DEBUG (SyncWorker_5) [custom_components.spotcast] get_spotify_devices: media_player.spotify_m: Spotify M HH: []
2021-04-19 09:49:13 DEBUG (SyncWorker_5) [custom_components.spotcast] get_spotify_devices: media_player.spotify_hmmbob: Spotify Hmmbob HH: []
2021-04-19 09:49:13 DEBUG (SyncWorker_5) [custom_components.spotcast] devices_available: {'devices': [{'id': 'bf7485e4bdc069dfd996748826af2f02', 'is_active': False, 'is_private_session': False, 'is_restricted': False, 'name': 'HMT', 'type': 'CastAudio', 'volume_percent': 49}]} bf7485e4bdc069dfd996748826af2f02
2021-04-19 09:49:13 DEBUG (SyncWorker_5) [custom_components.spotcast] Playing URI: spotify:track:5OoSxUZSbP1p7kb1d0SozG on device-id: bf7485e4bdc069dfd996748826af2f02
2021-04-19 09:49:13 DEBUG (SyncWorker_5) [custom_components.spotcast] Playing track using uris= for uri: spotify:track:5OoSxUZSbP1p7kb1d0SozG
2021-04-19 09:49:13 DEBUG (SyncWorker_5) [custom_components.spotcast] Turning repeat on
(interestingly enough, here get_spotify_devices
also seems to return []
)
(Spotify M is another spotify account loaded in the core spotify integration, but not being used with Spotcast)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:17 (16 by maintainers)
Top GitHub Comments
I’ll have a look
@gabosom I think there might be something else that is a problem for you. Feel free to post a new bugreport if you have the problem. closing this seeing as it solved it for the actual reported issue