home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.87k stars 28.97k forks source link

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

Closed guice closed 4 years ago

guice commented 4 years ago

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

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?

guice commented 4 years ago

Here's HA's recent attempt to update Office Mini, fresh stack.

2020-04-30 10:45:29 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] add_service _googlecast._tcp.local., Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local.
2020-04-30 10:45:29 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [homeassistant.components.cast.discovery] Discovered chromecast ChromecastInfo(host='192.168.2.152', port=8009, service='Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local.', uuid='ab381eb2-c067-6099-e563-c11dac745976', model_name='Google Home Mini', friendly_name='Office Mini')
2020-04-30 10:45:29 DEBUG (MainThread) [homeassistant.components.cast.media_player] _async_create_cast_device: ChromecastInfo(host='192.168.2.152', port=8009, service='Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local.', uuid='ab381eb2-c067-6099-e563-c11dac745976', model_name='Google Home Mini', friendly_name='Office Mini')
2020-04-30 10:45:30 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] add_service _googlecast._tcp.local., Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local.
2020-04-30 10:45:30 DEBUG (MainThread) [homeassistant.components.cast.media_player] Discovered chromecast with same UUID: ChromecastInfo(host='192.168.2.152', port=8009, service='Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local.', uuid='ab381eb2-c067-6099-e563-c11dac745976', model_name='Google Home Mini', friendly_name='Office Mini')
2020-04-30 10:45:30 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast] _get_chromecast_from_host ('192.168.2.152', 8009, UUID('ab381eb2-c067-6099-e563-c11dac745976'), 'Google Home Mini', 'Office Mini')
2020-04-30 10:45:30 DEBUG (MainThread) [homeassistant.components.cast.media_player] [media_player.office_speaker Office Mini (192.168.2.152:8009)] Got new service: Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local. ({'Google-Home-Mini-ab381eb2c0676099e563c11dac745976._googlecast._tcp.local.'})
2020-04-30 10:45:30 INFO (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast] Querying device status
2020-04-30 10:45:30 DEBUG (MainThread) [homeassistant.components.cast.media_player] [media_player.office_speaker Office Mini (192.168.2.152:8009)] Connecting to cast device by service {'Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local.', 'Google-Home-Mini-ab381eb2c0676099e563c11dac745976._googlecast._tcp.local.'}
2020-04-30 10:45:30 ERROR (MainThread) [homeassistant.util.logging] Exception in _async_cast_discovered when dispatching 'cast_discovered': (ChromecastInfo(host='192.168.2.152', port=8009, service='Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local.', uuid='ab381eb2-c067-6099-e563-c11dac745976', model_name='Google Home Mini', friendly_name='Office Mini'),)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/cast/media_player.py", line 722, in _async_cast_discovered
    await self.async_set_cast_info(discover)
  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'
guice commented 4 years ago

No idea why I see this later on -- a remove (??)

2020-04-30 10:53:42 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] remove_service _googlecast._tcp.local., Google-Home-Mini-ab381eb2c0676099e563c11dac745976._googlecast._tcp.local.
2020-04-30 10:53:42 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [pychromecast.discovery] remove_service _googlecast._tcp.local., Google-Home-Mini-ab381eb2c0676099e563c11dac745976._googlecast._tcp.local.
2020-04-30 10:53:42 DEBUG (zeroconf-ServiceBrowser__googlecast._tcp.local.) [homeassistant.components.cast.discovery] Removed chromecast ChromecastInfo(host='192.168.2.152', port=8009, service='Google-Home-Mini-ab381eb2c0676099e563c11dac745976._googlecast._tcp.local.', uuid='ab381eb2-c067-6099-e563-c11dac745976', model_name='Google Home Mini', friendly_name='Office Mini')
2020-04-30 10:53:42 DEBUG (MainThread) [homeassistant.components.cast.media_player] Removed chromecast with same UUID: ChromecastInfo(host='192.168.2.152', port=8009, service='Google-Home-Mini-ab381eb2c0676099e563c11dac745976._googlecast._tcp.local.', uuid='ab381eb2-c067-6099-e563-c11dac745976', model_name='Google Home Mini', friendly_name='Office Mini')
2020-04-30 10:53:42 DEBUG (MainThread) [homeassistant.components.cast.media_player] [media_player.office_speaker Office Mini (192.168.2.152:8009)] Remove service: Google-Home-Mini-ab381eb2c0676099e563c11dac745976._googlecast._tcp.local. ({'Google-Home-Mini-ab381eb2c0676099e563c11dac745976-1._googlecast._tcp.local.'})
probot-home-assistant[bot] commented 4 years ago

cast documentation cast source (message by IssueLinks)

probot-home-assistant[bot] commented 4 years ago

Hey there @emontnemery, mind taking a look at this issue as its been labeled with a integration (cast) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

gambith commented 4 years ago

Have a look at issue #34620 I my case it was the Plex Assistant Custom Component, I removed the line with "pychromecast==4.1.1" from the manifest.json file and after a restart the Google devices are available again.

captainnapalm commented 4 years ago

My cast devices also stopped working after upgrading.

captainnapalm commented 4 years ago

@gambith I only have 2 custom_components in my install, HACS, and wyzesense, and neither list pychromecast in manifest.json.

droans commented 4 years ago

All cast devices disappeared from my install also. Docker container can reach all of my devices but Home Assistant can't find them.

guice commented 4 years ago

Have a look at issue #34620 I my case it was the Plex Assistant Custom Component, I removed the line with "pychromecast==4.1.1" from the manifest.json file and after a restart the Google devices are available again.

That was indeed it for me! I have Plex Assistant installed, too. Removing that line did fix it, mostly. One of my Chromecast devices still isn't showing, but it might be related to something else? I've had ups and downs on some of these devices.

kurumuru commented 4 years ago

I had similar issue, but i I remove cast configuration from yaml file - cast is working.

diff --git a/packs/conf_conf.yaml b/packs/conf_conf.yaml
index 5535897..f388d69 100644
--- a/packs/conf_conf.yaml
+++ b/packs/conf_conf.yaml
@@ -22,10 +22,10 @@ media_extractor:
     media_player.bedroom_speaker:
       music: bestaudio[ext=m4a]

-cast:
-  media_player:
-    - host: !secret cast_bedroom
-    - host: !secret cast_sound_bar
+# cast:
+#   media_player:
+#     - host: !secret cast_bedroom
+#     - host: !secret cast_sound_bar
emontnemery commented 4 years ago

Caused by custom_component pinning an outdated version of pychromecast: https://github.com/home-assistant/core/issues/34968#issuecomment-622090096

droans commented 4 years ago

I don't have any custom components using pychromecast. All my Home Minis are showing as unavailable with nothing present in the logs. Works perfectly fine if I downgrade to 0.108.9.

jes1417 commented 4 years ago

Do you use spotcast?

On Fri, May 1, 2020, 7:31 AM droans notifications@github.com wrote:

I don't have any custom components using pychromecast. All my Home Minis are showing as unavailable with nothing present in the logs. Works perfectly fine if I downgrade to 0.108.9.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/34968#issuecomment-622368949, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCT7SZIVBAS7L6ILWHQ5ALRPK6K3ANCNFSM4MVX5CSA .

droans commented 4 years ago

I do not.

Pychromecast version is 5.0.0. Logging is set to debug for pychromecast, pychromecast.discovery, pychromecast.socket_client, homeassistant.components.cast, homeassistant.components.cast.media_player, and zeroconf.

Oddly I don't have a single debug log in my log files. Only cast reference in the log file is zeroconf broadcast and homeassistant.components.cast being loaded.

captainnapalm commented 4 years ago

I did a search of my entire homeassistant install, and the term "pychromecast" doesn't appear at all, unless it's in some kind of binary file?

danukefl commented 4 years ago

I am experiencing the same issue after updating to 109.2 (docker/kubernetes) where both Chromecasts, Google Home, and Google Home Mini are unavailable. The devices are manually set as they are on a different VLAN in my network and no other changes have been made. Enabling debug logging did not show anything odd for the devices. I do not have any other custom components and a search for "pychromecast" in my HASS directory only returned entries under the file core.

I downgraded to 109.1 then 109.0 with no change, but back down to 108.9 all the devices immediately started working. I then created a brand new docker container running stable (109.2), specified one Google Home by IP, and the devices still do not connect or show up. The debug log has nothing for the IP, its like it is ignoring the hosts.

cast: media_player:

  • host: 192.168.25.234
emontnemery commented 4 years ago

@droans, @captainnapalm, @danukefl are you using docker? if you are, please share docker command line or docker composer setting.s

droans commented 4 years ago

If the tag is changed to 0.108.9 it works just fine.

I don't think media_player is even being loaded by Home Assistant. Running a script to send a message to one of the devices returns "Unable to find service media_player/play_media"

networks:                                                                              
  t2_proxy:                                                                            
    external:                                                                          
      name: t2_proxy                                                                   
  default:                                                                             
    driver: bridge

services:
---------------

  homeassistant:                                                                
    container_name: homeassistant                                               
    restart: always                                                             
    dns:                                                                        
      - 192.168.86.35                                                           
      - 192.168.86.36                                                           
    image: homeassistant/home-assistant:stable                                 
    devices:                                                                                                                  
      - /dev/hidraw0:/dev/hidraw0                                               
      - /dev/hidraw1:/dev/hidraw1                                               
    volumes:                                                                    
      - ${USERDIR}/docker/homeassistant:/config                                 
      - /etc/localtime:/etc/localtime:ro                                        
      - ${USERDIR}/docker/shared:/shared                                        
    ports:                                                                      
      - "8123:8123"                                                             
    privileged: true                                                            
    environment:                                                                
      - PUID=${PUID}                                                            
      - PGID=${PGID}                                                            
      - TZ=${TZ}                                                                                                                
    networks:                                                                   
      - t2_proxy                                                                
      - default                                                                 
    labels:                                                                     
      - "traefik.enable=true"                                                   
      ## HTTP Routers                                                           
      - "traefik.http.routers.home-assistant-rtr.entrypoints=https"             
      - "traefik.http.routers.home-assistant-rtr.rule=Host(`hass.$DOMAINNAME`)" 
      - "traefik.http.routers.home-assistant-rtr.tls=true"                      
      ## Middlewares                                                            
      - "traefik.http.routers.home-assistant-rtr.middlewares=chain-no-auth@file>
      ## HTTP Services                                                          
      - "traefik.http.routers.home-assistant-rtr.service=home-assistant-svc"
      - "traefik.http.services.home-assistant-svc.loadbalancer.server.port=8123"
droans commented 4 years ago

I'm also able to ping all the Homes from within the container so it isn't a networking issue.

danukefl commented 4 years ago

My main instance is in Kubernetes but my test instance with no configuration besides adding the cast and logger lines is using the below command.

`docker run -d -p 8124:8123 --name test2 -v test:/config homeassistant/home-assistant:stable configuration.zip

`

emontnemery commented 4 years ago

@danukefl, @droans You need to use Docker command line option --net=host or the compose file equivalent network_mode: host to put Home Assistant on the host network. If you don't do that, mDNS does not work which is a requirement for the cast integration from 0.109. Please note the -p command line option or the compose file equivalent ports: is not compatible with host networking mode and must not be used.

droans commented 4 years ago

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.

captainnapalm commented 4 years ago

@emontnemery yes, i'm using Docker in unraid and just recently moved my instance to my letsencrypt/nginx reverse proxy, and therefore changed the network to the same network as the letsencrypt container. I have reset that to "host", and, while losing access through my reverse proxy, has resolved the issue. I'll continue to just use the remote ui through nabu casa instead of my own reverse proxy.

danukefl commented 4 years ago

@emontnemery, after recreating the test container with host networking, the devices are still not included and the log is no different. I am with @droans though as this is a security risk and I ran with it previously but then disabled it with the migration to k8s and manually specified all my devices. I do not use discovery.

Edit: Nor can use discovery as my network is segregated into VLANs with HASS on one vlan and media devices on another.

emontnemery commented 4 years ago

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
emontnemery commented 4 years ago

@danukefl Please note you must remove the Docker command line parameter -p 8124:8123 because it is not compatible with host networking mode.

danukefl commented 4 years ago

@emontnemery Yes I removed the parameter, I use Portainer for general admin and the fact that I had to reconnect to 8123 versus 8124 validated that it was using host networking.

Now what I don't understand is what changed to require mDNS for 109 and why it would be required now, I don't see anything in the changelog. mDNS would not work across different networks anyways so I would be forced to use the forwarder.

Edit: I found the change, make sense so I'll have to either use the forwarder or move stuff around. Thanks.

droans commented 4 years ago

For future reference - I was unable to get Avahi working as-is with Docker and on a virtual machine as Avahi would crash with all the networks created by VirtualBox.

I was able to get it working by setting allow-interfaces to include my network docker0, and the networks created by docker (br-***).

I think it would be a good idea to add in the documentation pull request from @hmmbob with a disclaimer that his method is not supported by Home Assistant.

hmmbob commented 4 years ago

That documentation pull request was rejected.