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
Chromecast and Home-mini not detected after HA restart #35922
Comments
I am seeing similar behavior. With 0.109, I had to run an Avahi reflector on my host to get mDNS working again (I am running a docker based setup without --net=host; yes that is not according to install instructions). That worked great, but with 0.110 I am seeing weird behavior: Upon HA reboot, all Cast devices show as unavailable - every reboot again. The fix? Rebooting my WiFi access points, which probably triggers another advertise or so by the Chromecasts. If I do this, they show up one-by-one in HA again without me touching HA - confirming that mDNS works.... Strange.... |
Duplicate of #35735 |
Not a duplicate, this might be a side effect of mDNS changes in 0.110 |
@bdraco do you think could be related to zeroconf changes in 0.110? |
I don’t think so as I’m pretty sure the cast changes didn’t make 0.110. Will double check when I’m back to my desk |
Do all the affected systems have multiple network interfaces ? |
I'm running in docker on a pi. The cast devices are in the same lan as eth0 connects to. The HA docker is in a docker network called "homeassistant" (together with some other containers), Avahi is set up to reflect between eth0 and br-..... (whatever the bridge name is of the homeassistant network, don't know it by heart). Based on the fact that the devices do appear as soon the WiFi AP is reset so they reconnect to the network I have reason to believe the actual mDNS forwarding is working. |
I'm seeing the same issue. Cast devices do not show up on restart of Home Assistant. Restarting Home Assistant or Avahi doesn't do anything, but restarting the access point or cast devices makes them show up immediately. Edit: Restarting the cast device itself DOES NOT make it show up. I have a similar setup to @hmmbob; Home Assistant is in a Docker network with Avahi reflecting the mDNS packets to it. That was working perfectly in 0.109. |
@emontnemery Verified cast changes are in 0.111 only so thats not it |
mDNS needs to work directions ways for discovery to work correctly:
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. |
Unfortunately, I can't reproduce the issue on my side.
May help bring some light. Log setup:
@bdraco |
I've had to remove this from zeroconf's |
Sharp thinking - seems logical and is along the lines where I was looking for the issue. I'll try to run the container with the debug logging. Did that earlier today and can't remember to have gotten results that helped me further, but I might have missed a sign. |
Log file dump of reboot with failed recovery to be found here (copy-paste would make it a long post). I cut out everything that wasn't related. Upon reboot all Cast devices showed as Funny enough, esphome (which also relies on mDNS based on Avahi-browse) is setting up just fine. -- |
@hmmbob I don't think these lines look normal: Can you check if you get the same prints in Home Assistant 0.109? |
Ok, restarting with 0.109.6, let's what that brings. You'll have to tell me how to do the 2nd test :) edit: first observation with 0.109 is that I already see a lot of cast and zeroconf debug messages while HA isn't still fully started yet, opposite to 0.110. Will post log shortly. |
@hmmbob I think you can do:
|
cast documentation |
I can't reliably do this - in the docker I can't kill the running HA and when running |
@hmmbob can you try to instead change zeroconf version in |
That worked. 0.110.0 with zeroconf 0.25.1 does not have this problem. Logs here: 110.0.zeroconf_0.25.1.log Even though the log says |
@emontnemery, I have the same setup and the same issue as described above. I set zeroconf to 0.25.1 in the docker container, installing it manually and changing the package constraint, otherwise HA will install 0.26.1 on startup. Now running with 0.25.1 I see the same pattern in the logging Installed yesterday, one device status stayed connected, others lost connection after a while: So it is better with 0.25.1, but not perfect. Also tried the dev build. Same issue. |
@hmmbob Nice! Can you try also with zeroconf 0.26.0? |
Tried 0.109.6, Seems to be the same behaviour as with 0.110.1 and zeroconf 0.25.1. Still seeing: So it looks to me these two setups show the same behaviour. I just changed the mDNS setup with avahi-daemon on the host machine just before updating from 0.109.6 to 0.110.1 and therefore have no reference to a stable working setup. edit: 0.109.6 with zeroconf 0.26.1 Breaks as well |
0.26.0 has the issue too - none of the devices show up. Logs here: 110.0.zeroconf_0.26.0.log |
There are no exceptions in the log though, can that bug be triggered silently? Edit: #35832 causes UDP broadcasts to not be sent as you explain in the fix, donor would certainly explain this issue.. This call is failing in logs from @hmmbob https://github.com/home-assistant-libs/pychromecast/blob/c95db5b49ab0a9824f50a4ca59d583134772c206/pychromecast/discovery.py#L52 0.26.0 includes python-zeroconf/python-zeroconf#239, could it break or change the behaviour of |
zeroconf 0.26.2 did not fix this issue for me (we probably weren't aiming for a fix here - I just wanted to test). Logs look similar - won't be uploading them unless really needed. |
@hmmbob Would you mind testing again with zeroconf 0.25.1 and 0.26.0, and in both cases remove these lines from
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 |
@hmmbob, @rickh18 if you could try testing with additional logs as suggested here: #35922 (comment) that would be highly appreciated |
Will definitely do so, but haven't found time yet ;) |
Running HassOS on VirtualBox (not using Docker) and they become unavailable on a shutdown as I have my PC go to sleep from 2-7am every night. The only way to get them to be found is by removing the integration and the devices, restart HA, then reinstall the integration. What do I need to do for my setup to help you guys out in getting more logs? This same issue is also happening with myq (garage) integration. |
@emontnemery tests done. Logs: 110-25.1-zeroconf_debug.log Might be helpful in debugging: in the 0.26.1 run 1 device got connected - it's called "studeerkamer". All other cast devices did not get connected (even though i see their messages passing by in the logs) |
@hmmbob Awesome! Can you double check that the logs are the right ones? |
Yeah, it always prints that but I verified each run with I used the package_constraints.txt trick from above. @emontnemery I just digged through both logs as well, and in the 25.1 one I see "connected" printed for all my devices: The 26.1 log just prints "connected" for one device ( |
@hmmbob thanks for confirming. From the log it seems like there are replies to the queries, but the incoming messages are not printed in a very helpful way. zeroconf 26.0 added python-zeroconf/python-zeroconf#239, this is highly likely to be a side effect of that. |
I'll give it a run tomorrow! |
FWIW this conditional |
Ah, that's fair, I didn't know about this. |
@emontnemery Is it possible that new ones are coming in via |
@bdraco Yeah that's one theory to be tested: python-zeroconf/python-zeroconf#255 (comment) By the way, with the singleton zeroconf changes in 0.111, are service browsers also shared or only the main zeroconf instance? |
Browsers are not shared. Only the main instance. |
I removed both lines. I ran 0.26.1 first, then 0.25.1. However, with logging enabled, 0.26.1 was suddenly working correctly (all chromecasts showed up. I ran 0.26.1 without logging and restarted it twice, both time it was not working. I then enabled logging again after which it was all working as expected. Only after restarting again, it was broken again. HA 0.110.1 zeroconf 0.26.1 Working (Why?): HA 0.110.1 zeroconf 0.25.1: HA 0.110.1 zeroconf 0.26.1 Broken Seems to me like some kind of timing issue? |
Seems like there is a race condition going on here. I'm thinking it has something to do with it being in the cache before the listener sees it. |
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
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 <- |
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 |
On the PS. I can testify to the dedication and patience of everyone involved. |
@jstasiak I don't understand how you want to change |
Yeah, sorry, should've said explicitly by "we" I meant "zeroconf". Warn in case of missing listener methods as you already found out. :) (python-zeroconf/python-zeroconf#259 for others reading this thread) |
This all sounds to familiar, seeing the exact same in my logs since 0.110 and casting is close to impossible. My challenge is just I'm using Supervised Hass, how could I get zeroconf 0.25.1 in too that one? Is there some hidden trick I didnt find yet? I prefer to not ending up with building my own containers again. Thanks in advance! |
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
Problem-relevant
configuration.yaml
Traceback/Error logs
mDNS messages coming into HA network
The text was updated successfully, but these errors were encountered: