core: Google cast broken in 0.109 in docker
The problem
On updating from 0.107.7 to 0.109.0, all my Chromecasts (v1, v2, Ultra, Audio) show as unavailable with the restored: true attribute.
My Chromecasts are all on a different subnet to Home Assistant, but have worked perfectly with static IPs up until now. mDNS repeater is setup on my router and I am able to cast and work with my Chromecasts from a different subnet.
Environment
- Home Assistant Core release with the issue: 0.109.0
- Last working Home Assistant Core release (if known): 0.107.7 (0.108 may or may not work. I couldn’t use that version due to an unrelated bug)
- Operating environment (Home Assistant/Supervised/Docker/venv): Docker
- Integration causing this issue: Google Cast
- Link to integration documentation on our website: https://www.home-assistant.io/integrations/cast/
Problem-relevant configuration.yaml
# Chromecast
cast:
media_player:
- host: 192.168.5.3
- host: 192.168.5.9
- host: 192.168.5.27
- host: 192.168.5.36
- host: 192.168.5.45
- host: 192.168.5.54
- host: 192.168.5.63
- host: 192.168.5.72
- host: 192.168.5.81
- host: 192.168.5.99
Traceback/Error logs
I enabled debug logging:
logger:
default: info
logs:
homeassistant.components.cast: debug
homeassistant.components.cast.media_player: debug
pychromecast: debug
pychromecast.discovery: debug
pychromecast.socket_client: debug
zeroconf: debug
And these are the only relevant logs:
2020-04-29 13:25:00 INFO (SyncWorker_61) [homeassistant.loader] Loaded zeroconf from homeassistant.components.zeroconf
2020-04-29 13:25:01 INFO (SyncWorker_81) [homeassistant.loader] Loaded media_player from homeassistant.components.media_player
2020-04-29 13:25:01 INFO (MainThread) [homeassistant.setup] Setting up media_player
2020-04-29 13:25:01 INFO (MainThread) [homeassistant.setup] Setup of domain media_player took 0.0 seconds.
2020-04-29 13:24:58 INFO (SyncWorker_0) [homeassistant.loader] Loaded cast from homeassistant.components.cast
2020-04-29 13:25:48 INFO (MainThread) [homeassistant.setup] Setting up cast
2020-04-29 13:25:48 INFO (MainThread) [homeassistant.setup] Setup of domain cast took 0.0 seconds.
2020-04-29 13:25:49 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.cast
2020-04-29 13:25:49 DEBUG (SyncWorker_100) [homeassistant.components.cast.discovery] Starting internal pychromecast discovery.
Additional information
I looked through the changelogs and the change that looks like it could be causing this is #33922.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 30 (19 by maintainers)
PR for the documentation change was rejected, as this is describing a way of running HA that is not supported by the HA team.
So to conclude:
--net=host/network_mode: host, and if this is followed mDNS discovery works.A PR mentioning docker as well as a summary of setting up avahi on the host for here https://www.home-assistant.io/integrations/discovery/#troubleshooting or here https://www.home-assistant.io/integrations/cast/#cast-devices-and-home-assistant-on-different-subnets would be very welcome.
I wasn’t happy about having to use host networking with the container, both for security reasons, and because I use separate Docker networks for postgres and other services to keep them segmented from my main network.
I found this post which works perfectly. With the avahi-daemon reflector running on the host, Home Assistant immediately picked up the Chromecasts.
@hmmbob Not relying on mDNS had the following issues:
The two first issues were more about code complexity and maintainability, the third one was the last straw.
@hmmbob Thanks for putting the PR for the docs together.
I managed to do it without --net=host. You just need to install avahi-daemon on the docker host with
enable-reflector=yes@hmmbob OK, can you please open a separate issue, let’s keep this about google cast on different subnets.