core: Google devices all stopped worked, 109.x: Exception in async_set_cast_info

The problem

Ever since 109, all my Google devices are now showing as unavailable, even though Modifications within the Google Home app (e.g. name changing, removing groups) are being seen by the integration.

Environment

  • Home Assistant Core release with the issue: 109.x
  • Last working Home Assistant Core release (if known): 108.x
  • Operating environment (Home Assistant/Supervised/Docker/venv): Unbuntu on Docker env
  • Integration causing this issue: Chromecast
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/cast/

Traceback/Error logs

I enabled debugging, and have multiple speakers. It’s difficult to discern which trace goes to what device… So here’s a big dump of a couple to insure everything’s there.



2020-04-30 10:20:19 DEBUG (MainThread) [homeassistant.components.cast.media_player] [media_player.guest_room_speaker Guest Room Mini (192.168.2.56:8009)] Connecting to cast device by service {'Google-Home-Mini-5d5d555688cb0d3219fb8bb580277af7._googlecast._tcp.local.'}
2020-04-30 10:20:19 ERROR (MainThread) [asyncio.events] Exception in async_set_cast_info called from
   File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 355, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 347, in main
    exit_code = asyncio.run(setup_and_run_hass(config_dir, args), debug=args.debug)
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 574, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 541, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1786, in _run_once
    handle._run()
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity
    await entity.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 215, in async_added_to_hass
    async_create_catching_coro(self.async_set_cast_info(self._cast_info))

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 272, in async_set_cast_info
    pychromecast.get_chromecast_from_service,
AttributeError: module 'pychromecast' has no attribute 'get_chromecast_from_service'

2020-04-30 10:20:20 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] add_service _googlecast._tcp.local., Google-Home-8fc8170d86bd29bb259babb17056e78e._googlecast._tcp.local.
2020-04-30 10:20:20 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [homeassistant.components.cast.discovery] Discovered chromecast ChromecastInfo(host='192.168.1.113', port=8009, service='Google-Home-8fc8170d86bd29bb259babb17056e78e._googlecast._tcp.local.', uuid='8fc8170d-86bd-29bb-259b-abb17056e78e', model_name='Google Home', friendly_name='Basement Home')
2020-04-30 10:20:20 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] add_service _googlecast._tcp.local., Google-Home-Mini-ee814a78cc4c0c4a42212050920c73ae._googlecast._tcp.local.
2020-04-30 10:20:20 DEBUG (MainThread) [homeassistant.components.cast.media_player] _async_create_cast_device: ChromecastInfo(host='192.168.1.113', port=8009, service='Google-Home-8fc8170d86bd29bb259babb17056e78e._googlecast._tcp.local.', uuid='8fc8170d-86bd-29bb-259b-abb17056e78e', model_name='Google Home', friendly_name='Basement Home')
2020-04-30 10:20:20 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [homeassistant.components.cast.discovery] Discovered chromecast ChromecastInfo(host='192.168.1.242', port=8009, service='Google-Home-Mini-ee814a78cc4c0c4a42212050920c73ae._googlecast._tcp.local.', uuid='ee814a78-cc4c-0c4a-4221-2050920c73ae', model_name='Google Home Mini', friendly_name='Kids Room Mini')
2020-04-30 10:20:20 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] add_service _googlecast._tcp.local., Google-Home-Mini-57d77f571cc59bbdd41cf23013e8e672._googlecast._tcp.local.
2020-04-30 10:20:20 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [homeassistant.components.cast.discovery] Discovered chromecast ChromecastInfo(host='192.168.1.31', port=8009, service='Google-Home-Mini-57d77f571cc59bbdd41cf23013e8e672._googlecast._tcp.local.', uuid='57d77f57-1cc5-9bbd-d41c-f23013e8e672', model_name='Google Home Mini', friendly_name='Crafts Room Mini')
2020-04-30 10:20:20 DEBUG (MainThread) [homeassistant.components.cast.media_player] [media_player.basement_speaker Basement Home (192.168.1.113:8009)] Connecting to cast device by service {'Google-Home-8fc8170d86bd29bb259babb17056e78e._googlecast._tcp.local.'}
2020-04-30 10:20:20 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] add_service _googlecast._tcp.local., Chromecast-b20dc1833a50c1e7fbeaf4c9f4673d5f._googlecast._tcp.local.
2020-04-30 10:20:20 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [homeassistant.components.cast.discovery] Discovered chromecast ChromecastInfo(host='192.168.1.134', port=8009, service='Chromecast-b20dc1833a50c1e7fbeaf4c9f4673d5f._googlecast._tcp.local.', uuid='b20dc183-3a50-c1e7-fbea-f4c9f4673d5f', model_name='Chromecast', friendly_name='Media TV')
2020-04-30 10:20:20 ERROR (MainThread) [asyncio.events] Exception in async_set_cast_info called from
   File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 355, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 347, in main
    exit_code = asyncio.run(setup_and_run_hass(config_dir, args), debug=args.debug)
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 574, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 541, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1786, in _run_once
    handle._run()
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity
    await entity.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 215, in async_added_to_hass
    async_create_catching_coro(self.async_set_cast_info(self._cast_info))

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 272, in async_set_cast_info
    pychromecast.get_chromecast_from_service,
AttributeError: module 'pychromecast' has no attribute 'get_chromecast_from_service'

After casting a station to “Living Room Endtable”:

2020-04-30 10:28:34 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] add_service _googlecast._tcp.local., Chromecast-Audio-d4be646d2b55d72a4c2f8c682a6ab9f2._googlecast._tcp.local.
2020-04-30 10:28:34 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast] _get_chromecast_from_host ('192.168.2.37', 8009, UUID('d4be646d-2b55-d72a-4c2f-8c682a6ab9f2'), 'Chromecast Audio', 'Living Room Endtable')
2020-04-30 10:28:34 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] add_service _googlecast._tcp.local., Chromecast-Audio-d4be646d2b55d72a4c2f8c682a6ab9f2._googlecast._tcp.local.
2020-04-30 10:28:34 INFO (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast] Querying device status
2020-04-30 10:28:34 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [homeassistant.components.cast.discovery] Discovered chromecast ChromecastInfo(host='192.168.2.37', port=8009, service='Chromecast-Audio-d4be646d2b55d72a4c2f8c682a6ab9f2._googlecast._tcp.local.', uuid='d4be646d-2b55-d72a-4c2f-8c682a6ab9f2', model_name='Chromecast Audio', friendly_name='Living Room Endtable')
2020-04-30 10:28:34 DEBUG (MainThread) [homeassistant.components.cast.media_player] _async_create_cast_device: ChromecastInfo(host='192.168.2.37', port=8009, service='Chromecast-Audio-d4be646d2b55d72a4c2f8c682a6ab9f2._googlecast._tcp.local.', uuid='d4be646d-2b55-d72a-4c2f-8c682a6ab9f2', model_name='Chromecast Audio', friendly_name='Living Room Endtable')
2020-04-30 10:28:34 DEBUG (MainThread) [homeassistant.components.cast.media_player] [media_player.living_room_endtable Living Room Endtable (192.168.2.37:8009)] Connecting to cast device by service {'Chromecast-Audio-d4be646d2b55d72a4c2f8c682a6ab9f2._googlecast._tcp.local.'}
2020-04-30 10:28:34 ERROR (MainThread) [asyncio.events] Exception in async_set_cast_info called from
   File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 355, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 347, in main
    exit_code = asyncio.run(setup_and_run_hass(config_dir, args), debug=args.debug)
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 574, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 541, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1786, in _run_once
    handle._run()
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity
    await entity.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 215, in async_added_to_hass
    async_create_catching_coro(self.async_set_cast_info(self._cast_info))

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 272, in async_set_cast_info
    pychromecast.get_chromecast_from_service,
AttributeError: module 'pychromecast' has no attribute 'get_chromecast_from_service'

Additional information

I’m running on Unifi Ultimate Dream Machine, majority of my devices are within the same subnet as HomeAssistant. mDNS is enabled; Multicast Filtering is disabled; Audo-Optimize is disabled

I can see in the logs Google is successfully discovering my devices. But they’re all coming up as unavailable. I was able to make a name-change modification via the Home app and it did show in the Entities list.

It sees them. Why are they unavailable?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 29 (6 by maintainers)

Most upvoted comments

Running Home Assistant on the host network is the only officially supported configuration for Home Assistant in a Docker container as doing otherwise breaks UPnP, mDNS as well as other functionality.

An unsupported alternative to make mDNS work is to setup mDNS forwarding on the host as discussed here https://github.com/home-assistant/core/issues/34874#issuecomment-621507292:

# Install the Avahi-daemon
sudo apt-get install avahi-daemon
# Turn on the reflector. Go into /etc/avahi/avahi-daemon.conf and change the reflector section to:
 [reflector]
 enable-reflector=yes
 reflect-ipv=no
# (re)start the Avahi daemon to reload config
sudo service avahi-daemon restart

Can’t do that. Home Assistant loses access to all my other Docker services such as MariaDB, InfluxDB, and Traefik. If I give all these containers host network access, then they would lose access to my other Docker containers.

I’d need to give all my docker containers host network access which is both a security issue and unusable as many of the services want to bind to the same ports.