core icon indicating copy to clipboard operation
core copied to clipboard

Android TV integration - TV unavailable when turned of.

Open n3on4s opened this issue 1 year ago • 9 comments

The problem

So I encoutered problem with my Android TV (TCL), where whenver I shutdown TV, it becomes unavailable in HA:

image

I did some debuging, and narrowed down problem to android TV itself.

When TV is on, NMAP results:

nmap 192.168.0.82
Starting Nmap 7.80 ( https://nmap.org ) at 2024-01-09 14:42 FLE Standard Time
Nmap scan report for 192.168.0.82
Host is up (0.0017s latency).
Not shown: 995 closed ports
PORT     STATE SERVICE
5555/tcp open  freeciv
8008/tcp open  http
8009/tcp open  ajp13
8443/tcp open  https-alt
9000/tcp open  cslistener
MAC Address: XX:XX:XX:XX:XX:XX

After TV gets shutdown, by any way remote/HA/auto sleep:

nmap 192.168.0.82
Starting Nmap 7.80 ( https://nmap.org ) at 2024-01-09 14:47 FLE Standard Time
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 1.02 seconds

I tried to change every tipe of settings in Android TV and nothing helped.

After some time I tried to wake up TV with WakeOnLan option and at first seems like TV had'nt woke up, however, nmap started responding with OK results, and TV become available (visible as turned off again) in HA again:

image

nmap 192.168.0.82
Starting Nmap 7.80 ( https://nmap.org ) at 2024-01-09 14:53 FLE Standard Time
Nmap scan report for 192.168.0.82
Host is up (0.00017s latency).
Not shown: 995 closed ports
PORT     STATE SERVICE
5555/tcp open  freeciv
8008/tcp open  http
8009/tcp open  ajp13
8443/tcp open  https-alt
9000/tcp open  cslistener
MAC Address:

I know this happend not to all android TVs, however maybe you could add configuration option to enable, automaticaly resending WakeUpOnLan command, before the Heartbeat request, if tv is in Off/unavailable state?

What version of Home Assistant Core has the issue?

core-2024.1.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Android TV Remote

Link to integration documentation on our website

https://www.home-assistant.io/integrations/androidtv_remote/

Diagnostics information

config_entry-androidtv_remote-369036337b86e55921657a6ff3d5d5b9.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

[Living Room TV(192.168.0.82):8009] Heartbeat timeout, resetting connection
2:43:35 PM – (WARNING) /usr/local/lib/python3.11/site-packages/pychromecast/socket_client.py - message first occurred at 1:28:34 PM and shows up 25 times
Disconnected from Living Room TV at 192.168.0.82
2:38:41 PM – (WARNING) Android TV Remote - message first occurred at 1:28:30 PM and shows up 47 times
[Living Room TV(192.168.0.82):8009] Failed to connect to service ServiceInfo(type='mdns', data='Smart-TV-Pro-6e0231880edf1cc85f26ad05671960b1._googlecast._tcp.local.'), retrying in 5.0s
2:20:49 PM – (ERROR) /usr/local/lib/python3.11/site-packages/pychromecast/socket_client.py - message first occurred at 1:29:04 PM and shows up 14 times

Additional information

For anyone looking for fast fix, setting automation every 10s. to send magic wakeup packet, to TV's MAC when TV is off/unavailable fixed the issue for me.

n3on4s avatar Jan 09 '24 13:01 n3on4s

Hello, Just follow doc (https://www.home-assistant.io/integrations/androidtv_remote) : Some devices, like TCL, become unavailable after they are turned off, unless you activate the Screenless service. To activate it, go to Settings > System > Power and energy > Screenless service, and activate it.

It's work for me,

Regards,

vvince62550 avatar Jan 16 '24 10:01 vvince62550

Hi,

Same issue with 50PUS8807/12.

In Google Home the TV was also unavailable when off, but that resolved with these settings. Instellingen - Draadloos en netwerken - Met kabel of Wi-Fi - Inschakelen met Wi-Fi (WoLAN) -> Aan Instellingen - Draadloos en netwerken - Met kabel of Wi-Fi - Inschakelen met Chromecast -> Aan

Below the stats from the integration. Still Google Home can turn the TV on. 22 Philips UHD Android TV became unavailable 3:32:12 PM - 1 second ago 22 Philips UHD Android TV became unavailable 3:32:12 PM - 1 second ago 22 Philips UHD Android TV turned off 3:29:00 PM - 3 minutes ago 22 Philips UHD Android TV turned off 3:29:00 PM - 3 minutes ago 22 Philips UHD Android TV turned on 3:28:13 PM - 4 minutes ago 22 Philips UHD Android TV turned on 3:28:13 PM - 4 minutes ago

Sjuulh avatar Jan 16 '24 14:01 Sjuulh

Hello, Just follow doc (https://www.home-assistant.io/integrations/androidtv_remote) : Some devices, like TCL, become unavailable after they are turned off, unless you activate the Screenless service. To activate it, go to Settings > System > Power and energy > Screenless service, and activate it.

It's work for me,

Regards,

Hello, I did tried it, however, My TV has no such (Screenless service) setting.

n3on4s avatar Jan 17 '24 09:01 n3on4s

Hello, Just follow doc (https://www.home-assistant.io/integrations/androidtv_remote) : Some devices, like TCL, become unavailable after they are turned off, unless you activate the Screenless service. To activate it, go to Settings > System > Power and energy > Screenless service, and activate it.

It's work for me,

Regards,

I have the same issue with my TCL Android TV. It doesn't even have such a setting.

BalassaMarton avatar Jan 25 '24 21:01 BalassaMarton

Such a setting is not available for the Philips 50PUS8807/12. After doing the settings mentioned above, the Google Home is able to turn the TV from off to on at any time. Also after these settings and when the TV is off, the integration keeps switching between off and unavailable.

January 26, 2024 Turned off 9:11:19 AM - 9 minutes ago Became unavailable 9:11:03 AM - 9 minutes ago Turned off 9:09:47 AM - 10 minutes ago Became unavailable 9:09:15 AM - 11 minutes ago Turned off 9:08:14 AM - 12 minutes ago Became unavailable 9:07:43 AM - 12 minutes ago Turned off 9:06:36 AM - 13 minutes ago Became unavailable 9:06:04 AM - 14 minutes ago Turned off 9:00:06 AM - 20 minutes ago Became unavailable 8:59:34 AM - 20 minutes ago Turned off 8:49:19 AM - 31 minutes ago Became unavailable 8:49:19 AM - 31 minutes ago Turned off 8:47:37 AM - 32 minutes ago Became unavailable 8:47:36 AM - 32 minutes ago Turned off 8:44:23 AM - 36 minutes ago Became unavailable 8:44:23 AM - 36 minutes ago

Sjuulh avatar Jan 26 '24 08:01 Sjuulh

Having the same issue with my TCL tv.

Screen less service setting sometimes shows but other times not.

Keen to see if anyone solves this.

rutj87 avatar Jan 26 '24 10:01 rutj87

Such a setting is not available for the Philips 50PUS8807/12. After doing the settings mentioned above, the Google Home is able to turn the TV from off to on at any time. Also after these settings and when the TV is off, the integration keeps switching between off and unavailable.

January 26, 2024 Turned off 9:11:19 AM - 9 minutes ago Became unavailable 9:11:03 AM - 9 minutes ago Turned off 9:09:47 AM - 10 minutes ago Became unavailable 9:09:15 AM - 11 minutes ago Turned off 9:08:14 AM - 12 minutes ago Became unavailable 9:07:43 AM - 12 minutes ago Turned off 9:06:36 AM - 13 minutes ago Became unavailable 9:06:04 AM - 14 minutes ago Turned off 9:00:06 AM - 20 minutes ago Became unavailable 8:59:34 AM - 20 minutes ago Turned off 8:49:19 AM - 31 minutes ago Became unavailable 8:49:19 AM - 31 minutes ago Turned off 8:47:37 AM - 32 minutes ago Became unavailable 8:47:36 AM - 32 minutes ago Turned off 8:44:23 AM - 36 minutes ago Became unavailable 8:44:23 AM - 36 minutes ago

Hi, You can increase ping frequency to 5 seconds, that should keep tv available, however for me that is enough atleat it allows to turn on tv.

n3on4s avatar Jan 26 '24 14:01 n3on4s

Such a setting is not available for the Philips 50PUS8807/12. After doing the settings mentioned above, the Google Home is able to turn the TV from off to on at any time. Also after these settings and when the TV is off, the integration keeps switching between off and unavailable. January 26, 2024 Turned off 9:11:19 AM - 9 minutes ago Became unavailable 9:11:03 AM - 9 minutes ago Turned off 9:09:47 AM - 10 minutes ago Became unavailable 9:09:15 AM - 11 minutes ago Turned off 9:08:14 AM - 12 minutes ago Became unavailable 9:07:43 AM - 12 minutes ago Turned off 9:06:36 AM - 13 minutes ago Became unavailable 9:06:04 AM - 14 minutes ago Turned off 9:00:06 AM - 20 minutes ago Became unavailable 8:59:34 AM - 20 minutes ago Turned off 8:49:19 AM - 31 minutes ago Became unavailable 8:49:19 AM - 31 minutes ago Turned off 8:47:37 AM - 32 minutes ago Became unavailable 8:47:36 AM - 32 minutes ago Turned off 8:44:23 AM - 36 minutes ago Became unavailable 8:44:23 AM - 36 minutes ago

Hi, You can increase ping frequency to 5 seconds, that should keep tv available, however for me that is enough atleat it allows to turn on tv.

Hi good afternoon, i have the same issue with my Philips TV, you said something to change the ping frequency. Could you explain where we can change this setting? Just a hand full of user like me experience this behavior and cant get run this integration without the "Became unavailable" issue. Hopefully waiting for a solution orthe final note.

saschachina avatar Feb 05 '24 15:02 saschachina

having the same issue, and the device eventually became unavailable. Has anyone found any workaround or alternative ?

IMG_2016

robinhood-code avatar Feb 09 '24 00:02 robinhood-code

I have the same problem with my TCL 75C631.

Yllelder avatar Feb 09 '24 09:02 Yllelder

I have the same problem with my TCL 75C631.

Hi, did you saw the poste from @vvince62550? https://github.com/home-assistant/core/issues/107649#issuecomment-1893516159

saschachina avatar Feb 09 '24 17:02 saschachina

January 26, 2024 Turned off 9:11:19 AM - 9 minutes ago Became unavailable 9:11:03 AM - 9 minutes ago Turned off 9:09:47 AM - 10 minutes ago Became unavailable 9:09:15 AM - 11 minutes ago Turned off 9:08:14 AM - 12 minutes ago Became unavailable 9:07:43 AM - 12 minutes ago Turned off 9:06:36 AM - 13 minutes ago Became unavailable 9:06:04 AM - 14 minutes ago Turned off 9:00:06 AM - 20 minutes ago Became unavailable 8:59:34 AM - 20 minutes ago Turned off 8:49:19 AM - 31 minutes ago Became unavailable 8:49:19 AM - 31 minutes ago Turned off 8:47:37 AM - 32 minutes ago Became unavailable 8:47:36 AM - 32 minutes ago Turned off 8:44:23 AM - 36 minutes ago Became unavailable 8:44:23 AM - 36 minutes ago

exactly this with my MiTv4s. This is recent behaviour, wasn't always like that

ptrnmgr avatar Feb 13 '24 10:02 ptrnmgr

I solved this problem with my TCL Android TV by activating the following option hidden far away here:

Settings -> System -> Network & Internet -> activate checkbox “Network Standby”

istefy92 avatar Feb 20 '24 14:02 istefy92

I already have that turned on and am still having the same problem

On Wed, 21 Feb 2024 at 1:26 am, Stefan Marty Schmieder < @.***> wrote:

I solved this problem with my TCL Android TV by activating the following option hidden far away here:

Settings -> System -> Network & Internet -> activate checkbox “Network Standby”

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/107649#issuecomment-1954329233, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARVUAIT7SPPBRFIWNOLPRILYUSXCBAVCNFSM6AAAAABBTCVLTGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJUGMZDSMRTGM . You are receiving this because you commented.Message ID: @.***>

rutj87 avatar Feb 21 '24 11:02 rutj87

Same here on Philips and xiaomi TV

LinkXX92 avatar Feb 24 '24 07:02 LinkXX92

This affects the 2019 Shield TVs also. Any other ideas? There is no "Screenless service" to toggle.

andrewjmetzger avatar Feb 24 '24 10:02 andrewjmetzger

Interestingly, the Cast power controls can turn on the Android TV listed under the "Google Cast" integration, even though they can't turn it off.

If you press the Cast power button again, the Cast interface stops, and the Android TV screen appears.

Then, you can do anything, and use the normal Android TV integration's power switch to turn the Android TV off again.

[!NOTE] Make sure you are using the correct device name for each integration.

The Shield that I tested this with had two different names: for the Android TV service device, and the Google Cast service "device". It may be helpful to rename these, e.g., to My Shield TV and My Shield TV Cast.

When I tried with Developer Tools > Services, this worked. These are three separate service calls, but maybe you can adapt it into a toggle button.

# Power on
service: media_player.turn_on
data: {}
target: # Android TV device
  entity_id: media_player.my_shield_tv

# Go to Android TV (exit the Cast interface)
service: media_player.turn_off
data: {}
target: # Android TV device
  entity_id: media_player.my_shield_tv

# Power off
service: media_player.turn_off
data: {}
target: # Cast device
  entity_id: media_player.my_shield_tv_cast

If you have HDMI CEC enabled, these will probably handle your actual TV at the same time. It's a usability mess, since there are two power buttons, but it works. :)

andrewjmetzger avatar Feb 24 '24 11:02 andrewjmetzger

Interestingly, the Cast power controls can turn on the Android TV listed under the "Google Cast" integration, even though they can't turn it off.

If you press the Cast power button again, the Cast interface stops, and the Android TV screen appears.

Then, you can do anything, and use the normal Android TV integration's power switch to turn the Android TV off again.

Note

Make sure you are using the correct device name for each integration.

The Shield that I tested this with had two different names: for the Android TV service device, and the Google Cast service "device". It may be helpful to rename these, e.g., to My Shield TV and My Shield TV Cast.

When I tried with Developer Tools > Services, this worked. These are three separate service calls, but maybe you can adapt it into a toggle button.

# Power on
service: media_player.turn_on
data: {}
target: # Android TV device
  entity_id: media_player.my_shield_tv

# Go to Android TV (exit the Cast interface)
service: media_player.turn_off
data: {}
target: # Android TV device
  entity_id: media_player.my_shield_tv

# Power off
service: media_player.turn_off
data: {}
target: # Cast device
  entity_id: media_player.my_shield_tv_cast

If you have HDMI CEC enabled, these will probably handle your actual TV at the same time. It's a usability mess, since there are two power buttons, but it works. :)

Thanks for it, i just give them a try, unfortunately the same problem with the "Goggle Cast" integration, "Became unavailable" as well

Bildschirmfoto 2024-02-24 um 15 31 55

saschachina avatar Feb 24 '24 14:02 saschachina

google cast doesn’t help

IMG_2158

robinhood-code avatar Feb 24 '24 14:02 robinhood-code

Hi @tronikos , ist there any activity? Any solution in sight?

saschachina avatar Mar 01 '24 17:03 saschachina

I don't think there is anything the integration can do. This is up to your specific TV to provide settings to not fully turn off the device and keep the network active.

tronikos avatar Mar 02 '24 22:03 tronikos

I don't think there is anything the integration can do. This is up to your specific TV to provide settings to not fully turn off the device and keep the network active.

would there be any work around / alternative ways to keep the TV woken if there is nothing we can do on the TV side? thanks.

robinhood-code avatar Mar 02 '24 23:03 robinhood-code

No I don't think so

tronikos avatar Mar 03 '24 08:03 tronikos

I have this both on my Xiaomi Android TV (known issue) and Chromecast 4k. Is there a way to keep the Chromecast stick available?

proohit avatar Mar 18 '24 20:03 proohit

@proohit How do you power the Chromecast 4k?

tronikos avatar Mar 18 '24 20:03 tronikos

Via an external power supply. It's not hooked to the TV other than HDMI.

proohit avatar Mar 18 '24 20:03 proohit

Can the official Google TV or Google Home app connect to it when off? Does the device respond to ping when off? If not, there is no issue with the integration.

tronikos avatar Mar 18 '24 21:03 tronikos

Yes Google Home from a phone and the remote work without problems.

proohit avatar Mar 18 '24 21:03 proohit

I found this article while troubleshooting my junk TCL Android TV that kept going unavailable in HA.

I changed the IP address of the TV temporarily for testing before changing it back, but both IPs were still active on the network. In HA I was able to see Chromecast on the correct IP, but the Android TV Remote integration was still seeing its service at the temp IP.

I realized Chromecast is natively built in to the TCL Android OS (which is why it always works), but Android TV Remote is an app. I updated the app in the Play Store on the TCL and it improved functionality a bit, but it's still pretty unreliable. The TV now alternates between available/unavailable every couple minutes when off, but seems to always work when the TV is on.

The TCL Android implementation is pretty dodgy, I have a feeling it's aggressively memory managing when in standby and killing the Android Remote app.

There's no way I could find to exclude apps from having their service stopped in the TCL's settings, like you usually can in Android.

I wouldn't hold my breath waiting for the budget Chinese TV manufacturers to update Android.

automaticquality avatar Mar 28 '24 05:03 automaticquality

Hi! I don't use HA and doesn't know anything about code, but I known this issue for over 3 years now. Is it up to the developers of Android TV or the manufacturer to fix this? Is this still an issue on new models with Android TV 12?

ChrisAhlund avatar Mar 28 '24 12:03 ChrisAhlund