Cast media player entity going unavailable every minute or so
See original GitHub issueThe problem
I noticed on my Lovelace UI and on my logbook that my Google TV (TCL 65S446) changes to unavailable every minute or so, just when it’s in standby mode. One important observation is that I have a Chromecast with TV and a Google Home mini speaker and this behavior doesn’t happen with them! It’s just the TV.
Here is a video showing the amount of entries created in the logbook by the entity from the Google Cast integration and this one from the Android TV integration.
Another important thing is that the TV was connected to Wi-Fi all the time.

What version of Home Assistant Core has the issue?
core-2022.4.0
What was the last working version of Home Assistant Core?
Don’t know exactly. But this happens since I bought the TV (few monhts ago).
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Google Cast, Android TV
Link to integration documentation on our website
https://www.home-assistant.io/integrations/cast https://www.home-assistant.io/integrations/androidtv/
Diagnostics information
{ “home_assistant”: { “installation_type”: “Home Assistant Container”, “version”: “2022.4.0”, “dev”: false, “hassio”: false, “virtualenv”: false, “python_version”: “3.9.9”, “docker”: true, “arch”: “x86_64”, “timezone”: “America/Chicago”, “os_name”: “Linux”, “os_version”: “5.15.30-Unraid”, “run_as_root”: true }, “custom_components”: { “frigate”: { “version”: “2.2.2”, “requirements”: [] }, “ledfx”: { “version”: “1.3.1”, “requirements”: [] }, “openrgb”: { “version”: “2.2”, “requirements”: [ “openrgb-python==0.2.10” ] }, “hacs”: { “version”: “1.24.3”, “requirements”: [ “aiogithubapi>=21.11.0” ] }, “ui_lovelace_minimalist”: { “version”: “v0.0.7-hotfix2”, “requirements”: [] } }, “integration_manifest”: { “domain”: “androidtv”, “name”: “Android TV”, “documentation”: “https://www.home-assistant.io/integrations/androidtv”, “requirements”: [ “adb-shell[async]==0.4.2”, “androidtv[async]==0.0.66”, “pure-python-adb[async]==0.3.0.dev0” ], “codeowners”: [ “@JeffLIrion”, “@ollo69” ], “config_flow”: true, “iot_class”: “local_polling”, “loggers”: [ “adb_shell”, “androidtv”, “pure_python_adb” ], “is_built_in”: true }, “data”: { “entry”: { “entry_id”: “4f00f83a6068069fbe903976c1e03b23”, “version”: 1, “domain”: “androidtv”, “title”: “Living room TV”, “data”: { “host”: “living-room-tv.home”, “device_class”: “androidtv”, “port”: 5555 }, “options”: {}, “pref_disable_new_entities”: false, “pref_disable_polling”: false, “source”: “user”, “unique_id”: “REDACTED”, “disabled_by”: null }, “device_properties”: { “device_class”: “androidtv”, “manufacturer”: “TCL”, “model”: “Smart TV”, “serialno”: “REDACTED”, “sw_version”: “11”, “ethmac”: “REDACTED”, “wifimac”: “REDACTED” }, “device”: { “area_id”: “living_room”, “config_entries”: [ “4f00f83a6068069fbe903976c1e03b23” ], “configuration_url”: null, “connections”: “REDACTED”, “disabled_by”: null, “entry_type”: null, “id”: “6db37f88b5a69e10d581743121046af1”, “identifiers”: “REDACTED”, “manufacturer”: “TCL”, “model”: “Smart TV (Android TV)”, “name_by_user”: “Living room TV”, “name”: “Android TV living-room-tv.home”, “suggested_area”: null, “sw_version”: “11”, “hw_version”: null, “via_device_id”: null, “is_new”: false, “entities”: { “media_player.living_room_tv”: { “unique_id”: “REDACTED”, “platform”: “androidtv”, “area_id”: null, “capabilities”: {}, “config_entry_id”: “4f00f83a6068069fbe903976c1e03b23”, “device_class”: null, “device_id”: “6db37f88b5a69e10d581743121046af1”, “domain”: “media_player”, “disabled_by”: null, “entity_category”: null, “hidden_by”: null, “icon”: null, “id”: “a333387c6be6fe7f0bcdcc2407944c5e”, “name”: “Living room TV”, “options”: {}, “original_device_class”: null, “original_icon”: null, “original_name”: “Android TV living-room-tv.home”, “supported_features”: 23997, “unit_of_measurement”: null, “state”: { “state”: “unavailable”, “attributes”: { “friendly_name”: “Living room TV”, “supported_features”: 23997 }, “last_changed”: “2022-04-11T04:18:38.705950+00:00”, “last_updated”: “2022-04-11T04:18:38.705950+00:00” } } } } } }
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.9/site-packages/pychromecast/socket_client.py:396
First occurred: April 7, 2022, 9:10:45 AM (241 occurrences)
Last logged: 9:37:35 PM
[Living room TV(192.168.1.136):8009] Failed to connect to service ServiceInfo(type='mdns', data='Smart-TV-d895cdd4cb150e32767c85fcb1123c2b._googlecast._tcp.local.'), retrying in 5.0s
[Bedroom Speaker(192.168.1.130):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.1.130', 8009)), retrying in 5.0s
[Living room TV(192.168.1.136):8009] Failed to connect to service ServiceInfo(type='host', data=('192.168.1.136', 8009)), retrying in 5.0s
Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.9/site-packages/pychromecast/socket_client.py:672
First occurred: April 7, 2022, 8:58:39 AM (445 occurrences)
Last logged: 9:37:05 PM
[Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.9/site-packages/pychromecast/socket_client.py:663
First occurred: 4:41:56 PM (1 occurrences)
Last logged: 4:41:56 PM
[Living room TV(192.168.1.136):8009] Error communicating with socket, resetting connection
Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.9/site-packages/pychromecast/socket_client.py:610
First occurred: 4:41:56 PM (1 occurrences)
Last logged: 4:41:56 PM
[Living room TV(192.168.1.136):8009] Error reading from socket.
2022-04-07 08:58:39 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:00:12 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:02:01 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:09:41 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:10:15 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:10:45 ERROR (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Failed to connect to service ServiceInfo(type='mdns', data='Smart-TV-d895cdd4cb150e32767c85fcb1123c2b._googlecast._tcp.local.'), retrying in 5.0s
2022-04-07 09:11:27 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:11:57 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:12:27 ERROR (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Failed to connect to service ServiceInfo(type='mdns', data='Smart-TV-d895cdd4cb150e32767c85fcb1123c2b._googlecast._tcp.local.'), retrying in 5.0s
2022-04-07 09:12:47 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:13:17 ERROR (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Failed to connect to service ServiceInfo(type='mdns', data='Smart-TV-d895cdd4cb150e32767c85fcb1123c2b._googlecast._tcp.local.'), retrying in 5.0s
2022-04-07 09:13:37 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:14:29 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:15:15 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:15:45 ERROR (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Failed to connect to service ServiceInfo(type='mdns', data='Smart-TV-d895cdd4cb150e32767c85fcb1123c2b._googlecast._tcp.local.'), retrying in 5.0s
2022-04-07 09:16:48 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:18:45 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:19:23 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:19:54 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:20:55 WARNING (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Heartbeat timeout, resetting connection
2022-04-07 09:21:25 ERROR (Thread-6) [pychromecast.socket_client] [Living room TV(192.168.1.136):8009] Failed to connect to service ServiceInfo(type='mdns', data='Smart-TV-d895cdd4cb150e32767c85fcb1123c2b._googlecast._tcp.local.'), retrying in 5.0s
Additional information
This problem DOESN’T happen when the TV is ON.
These options need to be ON then the TV will still be connected to the WI-FI when it’s off (standby), so I can cast anything (youtube video, photos or whatever) to the TV and wake it up when it’s off (standby).

Issue Analytics
- State:
- Created a year ago
- Comments:35 (6 by maintainers)

Top Related StackOverflow Question
@TarcisioMenezes thanks for your quick reaction. I will create a new issue about the state changes. I saw this also was mentoined in issue #69723.
Mine also has no ubiquiti devices in the network. It’s probably something on the firetv side disconnecting the integration (due to device sleeping, wifi down, etc) and not allowing to connect again.