Google Cast devices showing status as Restored?

I am running Home Assistant in Docker on a Raspberry Pi 4. I recently noticed that all my Google Casts entities are showing their statuses as Restored and the devices themselves seem unavailable.

I’ve seen many posts about Google Cast issues with Home Assistant in Docker but mine seems to be a bit different, I think. Home Assistant discovers the devices but they are unusable. I am not sure when this started happening but I can confirm the entities were working earlier.

This is my docker-compose.yml for Home Assistant:

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: homeassistant/raspberrypi4-homeassistant:stable
    volumes:
      - "/home/pi/Docker/Home Assistant/config:/config"
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    network_mode: host

I can confirm that mDNS is work (or else the devices would be discovered in Home Assistant) and have also tried solutions from posts like this this but haven’t been able to fix the issue yet.

Does anyone have any idea how to solve this issue?

is your Pi on the same network as the cast devices? I had that issue when I created a different wifi network for my IoT devices and lost access to my cast devices. I also needed to make some changes to my router specifically around the mDNS settings (this is what I used in my personal situation)

Yes, all devices in my home are on the same home network.

I use a TP-Link Archer C6 router. Any ideas on which section I should check for the mDNS settings? Can’t find any documentation about this anywhere.

I’m sorry I have no idea about TP-Lin routers…

Thanks. I’ve written to TP-Link support for help.

So after almost giving up, I’ve got it all working again.

It turns out that it was a problem with my OS while running pyChromecast. I am running Home Assistant in Docker on a Raspberry Pi 4.

When I tried running the following command on my Raspberry Pi 4:

python3 -c "import pychromecast; print(pychromecast.get_listed_chromecasts(friendly_names=['Living Room TV']))"

I got the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.../pychromecast/pychromecast/discovery.py", line 506, in discover_chromecasts
    zconf = zeroconf_instance or zeroconf.Zeroconf()
  File "/.../.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2493, in __init__
    self._listen_socket, self._respond_sockets = create_sockets(
  File "/.../.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2328, in create_sockets
    respond_socket = add_multicast_member(cast(socket.socket, listen_socket), i, apple_p2p=apple_p2p)
  File "/.../.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2273, in add_multicast_member
    listen_socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, _value)
OSError: [Errno 105] No buffer space available

After a lot of Googling, I found a solution that worked.

First, take a backup of /etc/sysctl.conf.

Next, replace the contents of the file with:

# Bigger buffers (to make 40Gb more practical). These are maximums, but the default is unaffected.
net.core.wmem_max=268435456
net.core.rmem_max=268435456
net.core.netdev_max_backlog=10000

# Avoids problems with multicast traffic arriving on non-default interfaces
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.all.rp_filter=0

# Force IGMP v2 (required by CBF switch)
net.ipv4.conf.all.force_igmp_version=2
net.ipv4.conf.default.force_igmp_version=2

# Increase the ARP cache table
net.ipv4.neigh.default.gc_thresh3=4096
net.ipv4.neigh.default.gc_thresh2=2048
net.ipv4.neigh.default.gc_thresh1=1024

# Increase number of multicast groups permitted
net.ipv4.igmp_max_memberships=1024

Note: I don’t know what else could fail because of this but everything is working fine for me so far.

Finally, reload the configuration file using sudo sysctl -p or reboot the system.

Source: Mpho Mphego
Source: Correlator-Beamforming Tests (GitHub)

All Google Cast devices should now show up in Home Assistant and are controllable! :slight_smile: