core: Chromecast and Home-mini not detected after HA restart

The problem

Recently I have noticed that my chromecast and home-mini are not detected anymore after ha restarts. If I reboot the chromecast device or the google home mini, they appear in home assistant. I checked the mDNS messages on the ha container and I can see status updates from both devices, but it seems they are ignored by HA. Do these devices advertise themselves at boot and not anymore after? This used to work until a few versions ago

Environment

  • Home Assistant Core release with the issue: 0.110.1
  • Last working Home Assistant Core release (if known): ?
  • Operating environment (Home Assistant/Supervised/Docker/venv): docker
  • Integration causing this issue: cast/media_player
  • Link to integration documentation on our website:

Problem-relevant configuration.yaml


Traceback/Error logs

mDNS messages coming into HA network

13:01:14.360139 IP 172.27.0.2.5353 > 224.0.0.251.5353: 0 [4q] SRV (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. TXT (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. A (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. AAAA (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. (108)
13:01:14.362811 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 2/0/0 (Cache flush) TXT "id=208b1023e0dad3fe2b46ecf030a15ed3" "cd=0FBEF871F0D4A65BE824B1B54BB67AFF" "rm=" "ve=05" "md=Google Home Mini" "ic=/setup/icon.png" "fn=Living Room speaker" "ca=215044" "st=1" "bs=FA8FCA7D147C" "nf=1" "rs=Casting: Turning Away", (Cache flush) SRV 208b1023-e0da-d3fe-2b46-ecf030a15ed3.local.:8009 0 0 (358)
13:01:14.561602 IP 172.27.0.2.5353 > 224.0.0.251.5353: 0 [4q] SRV (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. TXT (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. A (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. AAAA (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. (108)
13:01:14.963304 IP 172.27.0.2.5353 > 224.0.0.251.5353: 0 [4q] SRV (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. TXT (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. A (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. AAAA (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. (108)
13:01:14.965596 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 2/0/0 (Cache flush) TXT "id=208b1023e0dad3fe2b46ecf030a15ed3" "cd=0FBEF871F0D4A65BE824B1B54BB67AFF" "rm=" "ve=05" "md=Google Home Mini" "ic=/setup/icon.png" "fn=Living Room speaker" "ca=215044" "st=1" "bs=FA8FCA7D147C" "nf=1" "rs=Casting: Turning Away", (Cache flush) SRV 208b1023-e0da-d3fe-2b46-ecf030a15ed3.local.:8009 0 0 (358)
13:01:15.764683 IP 172.27.0.2.5353 > 224.0.0.251.5353: 0 [4q] SRV (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. TXT (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. A (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. AAAA (QM)? Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local. (108)
13:01:15.767972 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 2/0/0 (Cache flush) TXT "id=208b1023e0dad3fe2b46ecf030a15ed3" "cd=0FBEF871F0D4A65BE824B1B54BB67AFF" "rm=" "ve=05" "md=Google Home Mini" "ic=/setup/icon.png" "fn=Living Room speaker" "ca=215044" "st=1" "bs=FA8FCA7D147C" "nf=1" "rs=Casting: Turning Away", (Cache flush) SRV 208b1023-e0da-d3fe-2b46-ecf030a15ed3.local.:8009 0 0 (358)
13:01:39.546282 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0 [4a] PTR (QM)? _googlecast._tcp.local. (288)
13:01:39.549647 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR Chromecast-42a55766d50deb153177c8243c21da69-1._googlecast._tcp.local., (Cache flush) TXT "id=42a55766d50deb153177c8243c21da69" "cd=C271A9E91E06F0DC532994EEFD8146ED" "rm=" "ve=05" "md=Chromecast" "ic=/setup/icon.png" "fn=Living Room TV" "ca=200709" "st=0" "bs=FA8FCA3206EE" "nf=1" "rs=", (Cache flush) SRV 42a55766-d50d-eb15-3177-c8243c21da69-1.local.:8009 0 0, (Cache flush) A 192.168.1.13 (354)
13:01:39.558000 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3._googlecast._tcp.local., (Cache flush) TXT "id=208b1023e0dad3fe2b46ecf030a15ed3" "cd=0FBEF871F0D4A65BE824B1B54BB67AFF" "rm=" "ve=05" "md=Google Home Mini" "ic=/setup/icon.png" "fn=Living Room speaker" "ca=215044" "st=1" "bs=FA8FCA7D147C" "nf=1" "rs=Casting: Turning Away", (Cache flush) SRV 208b1023-e0da-d3fe-2b46-ecf030a15ed3.local.:8009 0 0, (Cache flush) A 192.168.1.146 (388)
13:01:40.905461 IP 172.27.0.2.5353 > 224.0.0.251.5353: 0 [4a] PTR (QM)? _googlecast._tcp.local. (288)
13:02:17.125459 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0 PTR (QM)? _googlerpc._tcp.local. (39)
13:02:17.128769 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0 PTR (QM)? _googlezone._tcp.local. (40)
13:02:17.130528 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR googlerpc-1._googlerpc._tcp.local., (Cache flush) TXT "cd=0FBEF871F0D4A65BE824B1B54BB67AFF", (Cache flush) SRV 208b1023-e0da-d3fe-2b46-ecf030a15ed3.local.:8012 0 0, (Cache flush) A 192.168.1.146 (180)
13:02:17.134695 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0 SRV (QM)? 42a55766-d50d-eb15-3177-c8243c21da69-1._googlezone._tcp.local. (79)
13:02:17.136980 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 4/0/0 PTR 42a55766-d50d-eb15-3177-c8243c21da69-1._googlezone._tcp.local., (Cache flush) TXT "id=C271A9E91E06F0DC532994EEFD8146ED" "__common_time__=0|0", (Cache flush) SRV 42a55766-d50d-eb15-3177-c8243c21da69-1.local.:10001 210 115, (Cache flush) A 192.168.1.13 (230)
13:02:17.139940 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 3/0/0 PTR 208b1023-e0da-d3fe-2b46-ecf030a15ed3._googlezone._tcp.local., (Cache flush) TXT "id=0FBEF871F0D4A65BE824B1B54BB67AFF" "__common_time__=1|0", (Cache flush) SRV 208b1023-e0da-d3fe-2b46-ecf030a15ed3.local.:10001 610 139 (210)
13:02:17.487131 IP 172.27.0.2.5353 > 224.0.0.251.5353: 0 [2a] PTR (QM)? _googlecast._tcp.local. (164)
13:02:17.584440 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0*- [0q] 2/0/0 PTR Google-Home-Mini-208b1023e0dad3fe2b46ecf030a15ed3-1._googlecast._tcp.local., PTR Chromecast-42a55766d50deb153177c8243c21da69._googlecast._tcp.local. (158)
13:02:20.626248 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0 SRV (QM)? google-home-mini-208b1023e0dad3fe2b46ecf030a15ed3-1._googlecast._tcp.local. (92)
13:02:20.631869 IP 172.27.0.1.5353 > 224.0.0.251.5353: 0 SRV (QM)? chromecast-42a55766d50deb153177c8243c21da69._googlecast._tcp.local. (84)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 54 (42 by maintainers)

Most upvoted comments

Two corrections which together should fix this:

@hmmbob has been very patient with debugging and testing, it would be really appreciated if someone else could test after applying these changes

Just wanted to add that I am experiencing the same issue since the update to HA 0.110.0. My 2 chromecasts and google home mini are no longer in HA. As opposed to others, I use the PyPi/venv way of installing HA rather than Docker. Unless I experience a different problem, the problem itself is not Docker related.

Update: Pulling the plug from the chromecast and google home mini and plugging them back in don’t make them appear either in HA.

Update 2: I’ve tried

pip3 install --upgrade --force-reinstall zeroconf==0.25.1
hass --skip-pip

On my local development version of HA. The devices still do not appear, so I guess my problem is different then the problem described here 😦

Update 3: Restarted a single router. Problem solved. -> add curse words here <- Sorry for hijacking this issue 😦

I’ll give it a run tomorrow!

@hmmbob thanks for confirming. As you say, all chromecasts are discovered in both logs. The difference is that the call to zconf.get_service_info(typ, name) fails In the 0.26.1 log, zeroconf repeatedly sends queries until pychromecast gives up. In the 0.25.1 log, it succeeds immediately.

From the log it seems like there are replies to the queries, but the incoming messages are not printed in a very helpful way. https://github.com/jstasiak/python-zeroconf/pull/254 attempts to improve the readability. If you have time, can you collect logs again with https://github.com/jstasiak/python-zeroconf/pull/254 + the previous change to enable logs, again with both 0.25.1 and 0.26.1?

zeroconf 26.0 added jstasiak/python-zeroconf#239, this is highly likely to be a side effect of that.

@hmmbob Would you mind testing again with zeroconf 0.25.1 and 0.26.0, and in both cases remove these lines from zeroconf/__init__py:

if log.level == logging.NOTSET:
    log.setLevel(logging.WARN)

This will dump all data sent and received by zeroconf, hopefully it can shed some light on what’s going on.

Note: There’s confusingly a stale zeroconf.py installed directly under site_packages which is not the right one.

@hmmbob can you try to instead change zeroconf version in homeassistant/package_constraints.txt?

mDNS needs to work directions ways for discovery to work correctly:

  • Home Assistant must send mDNS queries with help of zeroconf, and those queries must make it to the Cast devices
  • Cast devices must send mDNS announcements, and those announcements must be received by Home Assistant’s zeroconf client and then make it to the cast integration

Both directions rely on multicast UDP.

By restarting the AP or the cast devices, the cast devices will announce themselves once they’re back on the network. I think this points to mDNS queries sent by Home Assistant not making it to the cast devices, or no requests are sent in the first place.

@emontnemery Verified cast changes are in 0.111 only so thats not it

Not a duplicate, this might be a side effect of mDNS changes in 0.110