Hi
Can anyone help me troubleshoot the connection from HA (HA OS on generic x86/x64) to any google cast device ?
Home assistant correctly discovered Google Cast devices on my network, but the related media player entitis are always “Unavailable”.
In the logs I’ve found:
Registratore: pychromecast.socket_client
Fonte: /usr/local/lib/python3.12/site-packages/pychromecast/socket_client.py:416
Prima occorrenza: 1 dicembre 2024 alle ore 19:17:36 (3 occorrenze)
Ultima registrazione: 1 dicembre 2024 alle ore 20:07:48
[Soggiorno(192.168.1.87):8009] Failed to connect to service MDNSServiceInfo(name='Chromecast-912f2a76b9cd6c2bc96b8e9f13d04c18._googlecast._tcp.local.'), retrying in 5.0s
[Ingresso(192.168.1.29):8009] Failed to connect to service MDNSServiceInfo(name='Google-Nest-Hub-eb0e0a34e9e8127c0c8802b2c2b638bc._googlecast._tcp.local.'), retrying in 5.0s
[Cucina(192.168.1.61):8009] Failed to connect to service MDNSServiceInfo(name='Chromecast-326f1bdf868502ebcb8d425d2a131242._googlecast._tcp.local.'), retrying in 5.0s
I’ve then installed the SSH Addon to home assistant, and executed: docker exec -it homeassistant bash
then in that context, python3
then import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect_ex(('192.168.1.29',8009))
and it outputs 0, as if the socket do get opened.
What else can I try ?
The google devices and the home assistant server are connected to the same network, although, if it matters, internet to that LAN comes to a wireless bridge made of ubiquity antennas.
Interestingly enough, if I spin another home assistant instance (home assistant core) on my work pc, that is across that wifi bridge, it works.
I’m no expert in fixing these things, but heard a few things. MDNS addressing can be hit and miss, depending how your router has implemented it, so good thing to avoid (Addressing using .local).
For any casting or TTS the cloud host has to be able to talk to the local HA securely, and you cannot use a self-signed cert as google and others will not accept it.
Hi @Sir_Goodenough,
tjanks for your help.
How can I address MDNS problem ? I have the suspect that my network is somehow involved, but can’t understand how to diagnose it. Is it possible that home assistant is somehow internally using MDNS and this is the issue ?
As per https, internet access is ok (static ip from provider) and certificate is valid (letsencript).
Home assistant is connected to a (managed) switch and to the same switch is connected an access point (ubiquiti uap-ac-lr) that provide very good wifi signal to the google device (one of them is in liine of sight!)
Internet is provided through a WiFi L2 bridge but I’m not sure this matter
The MDNS work around is to use the IP address instead of the .local stuff.
Specifics, don’t know. But to address your HA instance it would be http://192.168.xx.xx:8123 instead of homeassistant.local:8123 as an example.
Got it, thanks, already tried that, it makes no difference.
But you maybe pointed me in the right direction.
In Python I’ve tried to connect to 8009 using ipaddress, while the library use that long generated name _googlecast._tcp.local
I should probably try to test if the mDNS resolution work in that home assistant container. Time to refresh some python skill, I’ll keep posted if I found something