Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot load on beta 2021.12.0b.0 #269

Closed
Bluhme1 opened this issue Dec 4, 2021 · 15 comments · Fixed by #271
Closed

Cannot load on beta 2021.12.0b.0 #269

Bluhme1 opened this issue Dec 4, 2021 · 15 comments · Fixed by #271

Comments

@Bluhme1
Copy link

Bluhme1 commented Dec 4, 2021

After upgrading to the new beta the Spotcast cannot load.

The release notes say that Spotipy has been upgraded to 2.19.0

@hmmbob
Copy link
Contributor

hmmbob commented Dec 4, 2021

What's in your logs?

Edit: installing beta as we speak to test myself as well

@hmmbob
Copy link
Contributor

hmmbob commented Dec 4, 2021

Seeing this too. Debug logs:

2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.spotcast_controller] setting up with account t
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.spotcast_controller] expires: 1638616055 time: 1638613285.3012052
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.spotcast_controller] setting up with account t
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_spotify_devices: media_player.spotify_t: Spotify T: []
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_spotify_devices: {'devices': []}
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.hele_huis: Hele huis cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.16', 32059)), ServiceInfo(type='mdns', data='google-cast-group-eec4b1d472ec428fad8f291a69a2d97d-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('[::ffff:c0a8:5810]', 32059))}, uuid=UUID('eec4b1d4-72ec-428f-ad8f-291a69a2d97d'), model_name='Google Cast Group', friendly_name='Hele huis', host='[::ffff:c0a8:5810]', port=32059, cast_type='group', manufacturer='Google Inc.'), is_dynamic_group=False)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.boven: Boven cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='mdns', data='Google-Cast-Group-e18cddf284be43da9917ddb7d4ceb42c-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 32213)), ServiceInfo(type='host', data=('192.168.88.17', 32213))}, uuid=UUID('e18cddf2-84be-43da-9917-ddb7d4ceb42c'), model_name='Google Cast Group', friendly_name='Boven', host='[::ffff:c0a8:5811]', port=32213, cast_type='group', manufacturer='Google Inc.'), is_dynamic_group=False)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.zolder: Zolder cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.17', 8009)), ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-71d8c580bbd0166b72f10071a427b6cb._googlecast._tcp.local.')}, uuid=UUID('71d8c580-bbd0-166b-72f1-0071a427b6cb'), model_name='Google Home Mini', friendly_name='Zolder', host='[::ffff:c0a8:5811]', port=8009, cast_type='audio', manufacturer='Google Inc.'), is_dynamic_group=None)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.woonkamer: Woonkamer cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('[::ffff:c0a8:5810]', 8009)), ServiceInfo(type='host', data=('192.168.88.16', 8009)), ServiceInfo(type='mdns', data='google-nest-hub-4660f5b8aabe10031a93ebd362367256._googlecast._tcp.local.')}, uuid=UUID('4660f5b8-aabe-1003-1a93-ebd362367256'), model_name='Google Nest Hub', friendly_name='Woonkamer', host='[::ffff:c0a8:5810]', port=8009, cast_type='cast', manufacturer='Google Inc.'), is_dynamic_group=None)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.tv_slaapkamer: TV Slaapkamer cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.18', 8009)), ServiceInfo(type='mdns', data='TPM191E-bec05970880b9a0a6966437ba87df4fe._googlecast._tcp.local.')}, uuid=UUID('bec05970-880b-9a0a-6966-437ba87df4fe'), model_name='TPM191E', friendly_name='TV Slaapkamer', host='192.168.88.18', port=8009, cast_type='cast', manufacturer='Philips'), is_dynamic_group=None)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.slaapkamer: Slaapkamer cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.13', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.')}, uuid=UUID('0256c1dd-13b4-4c80-849b-281970d02d11'), model_name='Google Home Mini', friendly_name='Slaapkamer', host='192.168.88.13', port=8009, cast_type='audio', manufacturer='Google Inc.'), is_dynamic_group=None)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.studeerkamer: Studeerkamer cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.12', 8009)), ServiceInfo(type='mdns', data='Google-Home-d4063db0253e246c9d66d8f7fda77a6a._googlecast._tcp.local.')}, uuid=UUID('d4063db0-253e-246c-9d66-d8f7fda77a6a'), model_name='Google Home', friendly_name='Studeerkamer', host='192.168.88.12', port=8009, cast_type='audio', manufacturer='Google Inc.'), is_dynamic_group=None)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.soundbar: Soundbar cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.14', 8009)), ServiceInfo(type='mdns', data='B8805-81704a75fd037a7c38090eb3c5dffea5._googlecast._tcp.local.')}, uuid=UUID('81704a75-fd03-7a7c-3809-0eb3c5dffea5'), model_name='B8805', friendly_name='Soundbar', host='192.168.88.14', port=8009, cast_type='audio', manufacturer='Philips'), is_dynamic_group=None)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.helpers] get_cast_devices: media_player.tv_woonkamer: TV Woonkamer cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='mdns', data='2021/22-Philips-UHD--587df1d4b0881d92a81d6c0dd78adf4d-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.88.15', 8009))}, uuid=UUID('587df1d4-b088-1d92-a81d-6c0dd78adf4d'), model_name='2021/22 Philips UHD Android TV', friendly_name='TV Woonkamer', host='192.168.88.15', port=8009, cast_type='cast', manufacturer='TPV'), is_dynamic_group=None)
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.spotcast_controller] Chromecast devices: [ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.16', 32059)), ServiceInfo(type='mdns', data='google-cast-group-eec4b1d472ec428fad8f291a69a2d97d-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('[::ffff:c0a8:5810]', 32059))}, uuid=UUID('eec4b1d4-72ec-428f-ad8f-291a69a2d97d'), model_name='Google Cast Group', friendly_name='Hele huis', host='[::ffff:c0a8:5810]', port=32059, cast_type='group', manufacturer='Google Inc.'), is_dynamic_group=False), ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='mdns', data='Google-Cast-Group-e18cddf284be43da9917ddb7d4ceb42c-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 32213)), ServiceInfo(type='host', data=('192.168.88.17', 32213))}, uuid=UUID('e18cddf2-84be-43da-9917-ddb7d4ceb42c'), model_name='Google Cast Group', friendly_name='Boven', host='[::ffff:c0a8:5811]', port=32213, cast_type='group', manufacturer='Google Inc.'), is_dynamic_group=False), ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.17', 8009)), ServiceInfo(type='host', data=('[::ffff:c0a8:5811]', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-71d8c580bbd0166b72f10071a427b6cb._googlecast._tcp.local.')}, uuid=UUID('71d8c580-bbd0-166b-72f1-0071a427b6cb'), model_name='Google Home Mini', friendly_name='Zolder', host='[::ffff:c0a8:5811]', port=8009, cast_type='audio', manufacturer='Google Inc.'), is_dynamic_group=None), ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('[::ffff:c0a8:5810]', 8009)), ServiceInfo(type='host', data=('192.168.88.16', 8009)), ServiceInfo(type='mdns', data='google-nest-hub-4660f5b8aabe10031a93ebd362367256._googlecast._tcp.local.')}, uuid=UUID('4660f5b8-aabe-1003-1a93-ebd362367256'), model_name='Google Nest Hub', friendly_name='Woonkamer', host='[::ffff:c0a8:5810]', port=8009, cast_type='cast', manufacturer='Google Inc.'), is_dynamic_group=None), ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.18', 8009)), ServiceInfo(type='mdns', data='TPM191E-bec05970880b9a0a6966437ba87df4fe._googlecast._tcp.local.')}, uuid=UUID('bec05970-880b-9a0a-6966-437ba87df4fe'), model_name='TPM191E', friendly_name='TV Slaapkamer', host='192.168.88.18', port=8009, cast_type='cast', manufacturer='Philips'), is_dynamic_group=None), ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.13', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.')}, uuid=UUID('0256c1dd-13b4-4c80-849b-281970d02d11'), model_name='Google Home Mini', friendly_name='Slaapkamer', host='192.168.88.13', port=8009, cast_type='audio', manufacturer='Google Inc.'), is_dynamic_group=None), ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.12', 8009)), ServiceInfo(type='mdns', data='Google-Home-d4063db0253e246c9d66d8f7fda77a6a._googlecast._tcp.local.')}, uuid=UUID('d4063db0-253e-246c-9d66-d8f7fda77a6a'), model_name='Google Home', friendly_name='Studeerkamer', host='192.168.88.12', port=8009, cast_type='audio', manufacturer='Google Inc.'), is_dynamic_group=None), ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.14', 8009)), ServiceInfo(type='mdns', data='B8805-81704a75fd037a7c38090eb3c5dffea5._googlecast._tcp.local.')}, uuid=UUID('81704a75-fd03-7a7c-3809-0eb3c5dffea5'), model_name='B8805', friendly_name='Soundbar', host='192.168.88.14', port=8009, cast_type='audio', manufacturer='Philips'), is_dynamic_group=None), ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='mdns', data='2021/22-Philips-UHD--587df1d4b0881d92a81d6c0dd78adf4d-1._googlecast._tcp.local.'), ServiceInfo(type='host', data=('192.168.88.15', 8009))}, uuid=UUID('587df1d4-b088-1d92-a81d-6c0dd78adf4d'), model_name='2021/22 Philips UHD Android TV', friendly_name='TV Woonkamer', host='192.168.88.15', port=8009, cast_type='cast', manufacturer='TPV'), is_dynamic_group=None)]
2021-12-04 11:21:25 DEBUG (SyncWorker_10) [custom_components.spotcast.spotcast_controller] cast info: ChromecastInfo(cast_info=CastInfo(services={ServiceInfo(type='host', data=('192.168.88.13', 8009)), ServiceInfo(type='mdns', data='Google-Home-Mini-0256c1dd13b44c80849b281970d02d11._googlecast._tcp.local.')}, uuid=UUID('0256c1dd-13b4-4c80-849b-281970d02d11'), model_name='Google Home Mini', friendly_name='Slaapkamer', host='192.168.88.13', port=8009, cast_type='audio', manufacturer='Google Inc.'), is_dynamic_group=None)
2021-12-04 11:21:25 ERROR (MainThread) [homeassistant.components.script.start_music_t] Slaaptijd: Error executing script. Unexpected error for call_service at pos 2: 'ChromecastInfo' object has no attribute 'cast_type'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1534, in _execute_service
await self._hass.async_add_executor_job(handler.job.target, service_call)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/spotcast/__init__.py", line 156, in start_casting
spotify_device_id = spotcast_controller.get_spotify_device_id(
File "/config/custom_components/spotcast/spotcast_controller.py", line 196, in get_spotify_device_id
spotify_cast_device = SpotifyCastDevice(
File "/config/custom_components/spotcast/spotcast_controller.py", line 51, in __init__
self.castDevice = self.getChromecastDevice(device_name)
File "/config/custom_components/spotcast/spotcast_controller.py", line 70, in getChromecastDevice
return pychromecast.get_chromecast_from_cast_info(
File "/usr/local/lib/python3.9/site-packages/pychromecast/__init__.py", line 69, in get_chromecast_from_cast_info
return Chromecast(
File "/usr/local/lib/python3.9/site-packages/pychromecast/__init__.py", line 271, in __init__
if not cast_info.cast_type:
AttributeError: 'ChromecastInfo' object has no attribute 'cast_type'
2021-12-04 11:21:25 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140158036160768] 'ChromecastInfo' object has no attribute 'cast_type'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 185, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 273, in service_handler
await script_entity.async_turn_on(
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 377, in async_turn_on
await coro
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 403, in _async_run
return await self.script.async_run(script_vars, context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1259, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1534, in _execute_service
await self._hass.async_add_executor_job(handler.job.target, service_call)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/spotcast/__init__.py", line 156, in start_casting
spotify_device_id = spotcast_controller.get_spotify_device_id(
File "/config/custom_components/spotcast/spotcast_controller.py", line 196, in get_spotify_device_id
spotify_cast_device = SpotifyCastDevice(
File "/config/custom_components/spotcast/spotcast_controller.py", line 51, in __init__
self.castDevice = self.getChromecastDevice(device_name)
File "/config/custom_components/spotcast/spotcast_controller.py", line 70, in getChromecastDevice
return pychromecast.get_chromecast_from_cast_info(
File "/usr/local/lib/python3.9/site-packages/pychromecast/__init__.py", line 69, in get_chromecast_from_cast_info
return Chromecast(
File "/usr/local/lib/python3.9/site-packages/pychromecast/__init__.py", line 271, in __init__
if not cast_info.cast_type:
AttributeError: 'ChromecastInfo' object has no attribute 'cast_type'

@hmmbob
Copy link
Contributor

hmmbob commented Dec 4, 2021

Probably caused by home-assistant/core#60205

@Bluhme1
Copy link
Author

Bluhme1 commented Dec 4, 2021

Should we raise an issue in the Core?
Can you do that posting the log @hmmbob ?

@hmmbob
Copy link
Contributor

hmmbob commented Dec 5, 2021

It needs to be changed in Spotcast, as per maintainer of pychromecast in a DM on Discord

Mention these core PRs in the spotcast ticket:

@Bluhme1
Copy link
Author

Bluhme1 commented Dec 5, 2021

Ok. Thank you. We will have to wait for Fondberg & Co, then

@hmmbob
Copy link
Contributor

hmmbob commented Dec 5, 2021

It might be a fairly easy fix, I think I fixed it locally. Willing to try?

in file spotcast_controller.py, change line 71 by adding an additional .cast_info so it reads:

                cast_info.cast_info, ChromeCastZeroconf.get_zeroconf()

Restart HA and see if it is fixed

@Bluhme1
Copy link
Author

Bluhme1 commented Dec 5, 2021

Didn't work for me. Same error in log

@Bluhme1
Copy link
Author

Bluhme1 commented Dec 5, 2021

When I com to think of it my error log is maybe different from yours

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/spotcast/init.py:128
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 11.36.19 (515 occurrences)
Last logged: 12.10.54

[140631677502464] Error handling message: Unknown error
[140631677476768] Error handling message: Unknown error
[140631651035792] Error handling message: Unknown error
[140631687929040] Error handling message: Unknown error
[140631686429952] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 100, in async_handle
handler(self.hass, self, schema(msg))
File "/config/custom_components/spotcast/init.py", line 125, in websocket_handle_castdevices
resp = [
File "/config/custom_components/spotcast/init.py", line 128, in
"model_name": cast_info.model_name,
AttributeError: 'ChromecastInfo' object has no attribute 'model_name'

@hmmbob
Copy link
Contributor

hmmbob commented Dec 5, 2021

When I com to think of it my error log is maybe different from yours

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/spotcast/init.py:128 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 11.36.19 (515 occurrences) Last logged: 12.10.54

[140631677502464] Error handling message: Unknown error [140631677476768] Error handling message: Unknown error [140631651035792] Error handling message: Unknown error [140631687929040] Error handling message: Unknown error [140631686429952] Error handling message: Unknown error Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 100, in async_handle handler(self.hass, self, schema(msg)) File "/config/custom_components/spotcast/init.py", line 125, in websocket_handle_castdevices resp = [ File "/config/custom_components/spotcast/init.py", line 128, in "model_name": cast_info.model_name, AttributeError: 'ChromecastInfo' object has no attribute 'model_name'

Ah, the error is different, but the fix is in the PR too.

In your case the sensor failed, in my case starting a stream failed. Both are fixed in #271
(have a look at the changes in sensor.py and __init.py__ if you want to hot-fix your specific issue)

@Bluhme1
Copy link
Author

Bluhme1 commented Dec 5, 2021

You're the man. Everything works again, so your PR is ready for merging. Thank you very much

@FrancoLoco
Copy link

Mine loads but when I want to start casting in my automation it does this even with the patch: ChromecastInfo' object has no attribute 'cast_type'

@FrancoLoco
Copy link

Wait I might have applied the patch incorrectly

@Bluhme1
Copy link
Author

Bluhme1 commented Dec 9, 2021

Will your PR be merged soon as an update to the custom component from Fondberg?

@FrancoLoco
Copy link

I managed to patch correctly and it does work thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants