home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.65k stars 30.79k forks source link

Philips TV goes to Off status #88264

Closed andrewjswan closed 5 months ago

andrewjswan commented 1 year ago

The problem

I turn on the TV (connected via Lan, the address is static), the media player in HA turns on, and after a while it turns off. Turned on the debugging in the log, I do not see anything special. But in the previous log there were warnings.

What version of Home Assistant Core has the issue?

core-2023.2.5

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

Philips TV

Link to integration documentation on our website

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

Diagnostics information

{"notifyChange":"http","menulanguage":"Ukrainian","name":"55PFL7008","country":"Ukraine","serialnumber_encrypted":"...","softwareversion_encrypted":"...","model_encrypted":"...","deviceid_encrypted":"...","nettvversion":"8.1.0","epgsource":"one","api_version":{"Major":6,"Minor":2,"Patch":0},"featuring":{"jsonfeatures":{"editfavorites":["TVChannels","SatChannels"],"recordings":["List","Schedule","Manage"],"ambilight":["LoungeLight","Hue","Ambilight"],"menuitems":["Setup_Menu"],"textentry":["context_based","initial_string_available","editor_info_available"],"applications":["TV_Apps","TV_Games","TV_Settings"],"pointer":["not_available"],"inputkey":["key"],"activities":["intent"],"channels":["preset_string"],"mappings":["server_mapping"]},"systemfeatures":{"tvtype":"consumer","content":["dmr","dms_tad"],"tvsearch":"intent","pairing_type":"digest_auth_pairing","secured_transport":"true"}}}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2023-02-16 19:48:04.117 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
2023-02-16 19:48:04.207 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
2023-02-16 19:48:04.228 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
2023-02-16 19:48:09.129 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
2023-02-16 19:48:09.216 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
2023-02-16 19:48:09.248 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
... A lot of lines like this ...
2023-02-16 19:49:19.584 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
2023-02-16 19:49:24.338 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
2023-02-16 19:49:24.341 WARNING (MainThread) [homeassistant.components.philips_js] Failed to fetch image
...
2023-02-16 19:52:39.220 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.553 seconds (success: True)
2023-02-16 19:52:44.197 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 8.528 seconds (success: True)
2023-02-16 19:53:12.447 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.095 seconds (success: True)
... A lot of lines like this ...
2023-02-16 19:57:06.386 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 5.030 seconds (success: True)
2023-02-16 19:57:37.528 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 4.175 seconds (success: True)
2023-02-16 19:57:42.543 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 5.048 seconds (success: True)
2023-02-16 19:58:05.286 ERROR (Thread-9) [pychromecast.socket_client] [55PFL7008(192.X.X.X):8009] Failed to connect to service ServiceInfo(type='mdns', data='QM164E-fc539c268d1a8889d09eafcb0ba6e200._googlecast._tcp.local.'), retrying in 5.0s
2023-02-16 19:58:10.431 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.060 seconds (success: True)
2023-02-16 19:58:16.447 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 4.088 seconds (success: True)
2023-02-16 19:58:43.454 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.101 seconds (success: True)
... A lot of lines like this ...
2023-02-16 20:04:10.654 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.302 seconds (success: True)
2023-02-16 20:04:13.439 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.086 seconds (success: True)
2023-02-16 20:04:41.034 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 0.682 seconds (success: True)
2023-02-16 20:04:46.462 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.110 seconds (success: True)
2023-02-16 20:05:12.016 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 0.661 seconds (success: True)
2023-02-16 20:05:19.422 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.070 seconds (success: True)
2023-02-16 20:05:43.103 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 0.752 seconds (success: True)
2023-02-16 20:05:52.446 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.095 seconds (success: True)
2023-02-16 20:06:14.013 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 0.662 seconds (success: True)
2023-02-16 20:06:25.407 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.055 seconds (success: True)
2023-02-16 20:06:45.485 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 1.133 seconds (success: True)
2023-02-16 20:06:58.430 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.079 seconds (success: True)
2023-02-16 20:07:16.042 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 0.679 seconds (success: True)
2023-02-16 20:07:31.454 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.102 seconds (success: True)
2023-02-16 20:07:51.887 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 5.535 seconds (success: True)
2023-02-16 20:08:04.418 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.067 seconds (success: True)
2023-02-16 20:08:26.405 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 5.045 seconds (success: True)
... A lot of lines like this ...
2023-02-16 20:14:16.371 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 5.010 seconds (success: True)
2023-02-16 20:14:40.447 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.096 seconds (success: True)
2023-02-16 20:14:51.364 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 5.013 seconds (success: True)
2023-02-16 20:15:13.407 DEBUG (MainThread) [homeassistant.components.philips_js] Finished fetching philips_js data in 3.055 seconds (success: True)

Additional information

image

home-assistant[bot] commented 1 year ago

Hey there @elupus, mind taking a look at this issue as it has been labeled with an integration (philips_js) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `philips_js` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign philips_js` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


philips_js documentation philips_js source (message by IssueLinks)

elupus commented 1 year ago

It could be going into sleep on the network i suppose. How long does it stay on?

andrewjswan commented 1 year ago

TV is working, in touch, ping is on. I can get information as above. But in HA it is off. Android TV integration is configured, it works without problems.

andrewjswan commented 1 year ago

The TV is in the status on for a couple of minutes, that's all. The log above and the screenshot of the story confirm this.

elupus commented 1 year ago

Can you please post debug info file that you can get from the integration config entry screen.

andrewjswan commented 1 year ago

~13:33 - I turn On TV ~13:34 - media_player Turn On. All Ok ~13:38 - media_player Turned Off. :( TV work, Android TV on this TV work ... image image In log no error or warning ... Debug info: config_entry-philips_js-cea04c589d04d4f6e073ef3c5b7986f0.json.txt

andrewjswan commented 1 year ago

After i turn off TV in log:

2023-02-17 13:42:24.397 WARNING (Thread-95) [pychromecast.socket_client] [55PFL7008(192.X.X.X):8009] Heartbeat timeout, resetting connection
2023-02-17 13:42:27.309 ERROR (MainThread) [homeassistant.components.androidtv.media_player] Failed to execute an ADB command. ADB connection re-establishing attempt in the next update. Error: Reading from 192.X.X.X:5555 timed out (9.0 seconds)
2023-02-17 13:42:29.291 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn't connect to 192.X.X.X:5555.  TcpTimeoutException: Connecting to 192.X.X.X:5555 timed out (1.0 seconds)
2023-02-17 13:42:54.432 ERROR (Thread-95) [pychromecast.socket_client] [55PFL7008(192.X.X.X):8009] Failed to connect to service ServiceInfo(type='host', data=('192.X.X.X', 8009)), retrying in 5.0s
consma5 commented 1 year ago

I have the same issue, the tv worked just fine for a few days. Did you fixed it?

andrewjswan commented 1 year ago

No :(

elupus commented 1 year ago

Do you guys have "Use events.." setting turned on in integration options for the config entry of philips?

@andrewjswan those logs are not from the philips intehration. Looks to be from the androidrv one. Are you using both?

andrewjswan commented 1 year ago

Yes, Use event used...

@elupus homeassistant.components.philips_js - not Philips integration? Yes i use both, since this integration does not work, and I need to understand the status of the TV.

elupus commented 1 year ago

@andrewjswan can you try turning that event feature off to test if problem persists. Also disable the android integration and dlna (if enabled) temporarily.

consma5 commented 1 year ago

I unplug and plug again the TV but with HA turned off and the tv responds again to its Ip:1925/system. When I turn on the HA, the TV turns off on network, maybe a script/command puts the TV into sleep on network. I'm gonna reinstall HA because i do not have too much things

andrewjswan commented 1 year ago

I tried, the same thing, but you can’t turn off the TV yet, there is no button.

elupus commented 1 year ago

If you can't reach the /system endpoint the TV has crashed/locked up. You can try and restarting HA att that point. And see if it recovers temporarily.

Maybe there is some http connection leak in HA that has cropped up.

andrewjswan commented 1 year ago

At the time of turning off the essence in, I tried to go to the address http://ip_address_of_tv:1925/system, the answer from TV was. I tried to monitor this answer at the time of the transition, as well as the answer from TV was always. I thought that there are problems with the connection of TV and the network since it was connected by WiFi, but by switching to the Lan nothing changed. TV on the router does not drop the time of the session.

andrewjswan commented 1 year ago

If I make a HA restart, then TV does not always receive the status in HA, but if you turn off the TV and turn it on, then if my memory does not fail me, it turns on. Since android TV integration works on the same TV, it is always in touch for now the TV is on, there are no breaks. If you need, I can give additional information.

andrewjswan commented 1 year ago

2023.05 - No change, everything is the same.

jonalbr commented 1 year ago

I enabled the following option in the TV settings: “Turn on with Wi-Fi”, which is supposed to keep the TV online while standby. Checking my network with HA shows that the TV is at least always connected to the Wi-Fi network as intended. However, after usually a couple of seconds, the TV becomes unavailable as a media player, so turning on is not possible.

elupus commented 1 year ago

You likely need to have some wakelock app for your tv. You see in your log that adb also disconnects.

andrewjswan commented 1 year ago

I switch TV from WiFi to Lan, the some... ADB work, but TV mediaplayer turn off after some minutes...

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

andrewjswan commented 1 year ago

2023.8 the some

5a2v0 commented 1 year ago

2023.8.4 same problem here.

TV goes on if i switch on through HA but after a few minutes, in HA the TV appears as off.

Static ip, ping ok

5a2v0 commented 1 year ago

I did several test and I found my specific problem. Isn't a integration problem but an IP's problem that I can't understand but i solved it with a workaround. I'll write here only for suggest other user with same problem to check this behaviour.

Previously my philips tv was set to static IP and as i wrote before, the ip was correct ! Ping ok... At first switch on the tv mantain the ip... after switch it to off, the tv maintain the IP...

From the second switch on the problem appears: the ping stops to respond to the static ip setted and tv get an ip from DHCP server! In the option menu the tv still setted to static ip but it use the dynamic one got from dhcp.

So the static ip configuration on tv doesn't work good, i solved setting up an static lease on my router for the tv's mac address.


However it is possible to add a configuration menu for the integration that permits to change device's ip? Once it's setted, if tv's ip change, user have to delete integration and then reinstall it to set the new host/ip!

andrewjswan commented 1 year ago

My IP does not change, if it changed, then Google TV did not work on this TV, but it works. And when you start the TV for a few minutes Online in HA then goes offline. But it is on the lan.

5a2v0 commented 1 year ago

I don't know how works your Google TV config but are you sure that with another valid local ip doesn't work?

Because when my tv change its ip, internet still and works great every smart apps as YouTube / prime video ...

Only Ha stop to see It because Ha search for It at previously static ip.

andrewjswan commented 1 year ago

The log above is there, I turn on the TV, it turns on in HA, also in HA turns on Google TV, which is on this TV, after a while TV has the status off, but Google TV is still on. If I turn off the TV, Google TV will also be turned off.

5a2v0 commented 1 year ago

Maybe Google TV checks only TV's internet connection that works with every ip It used. Ha check only with the one ip you set, so when you switch on, the TV change local ip and doesn't replay to Ha anymore.

Do your test, check which local ip is using your TV, launch a ping to this ip, then turn off TV , wait some seconda and turn It on again.. meanwhile check ping reply and be sure that ping doesn't stops to reply.

andrewjswan commented 1 year ago

Once again, TV and Google TV in HA have the same IP address, and since the status in HA changes, the address does not change, if the address changed, both entities would fall off.

issue-triage-workflows[bot] commented 11 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

marcinwasilewski commented 11 months ago

I had this issue, and as far as I remember the notification service was causing the philips tv to crash and become intermittently unavailable. I solved it by turning off "allow notification service" (the option to disable it appears after clicking "configure" inside your philips tv integration). It also says in the description of this option: "Allow the usage of data notification service on TV instead of periodic polling. This allows faster reaction to state changes on the TV, however, some TV's will stop responding with this activated due to firmware bugs."

Sdahl1234 commented 10 months ago

I have 4 android philips TV's and only 1 works with the build-in integration with or without use of notification service. Same issue has been reported before https://github.com/home-assistant/core/issues/64359

The 3 none working TV's works fine with this integration: https://github.com/nstrelow/ha_philips_android_tv

elupus commented 10 months ago

Its annoying. But short of somebody with such a tv debugging the code to figure out what crashes them. Not much we can do.

Sdahl1234 commented 10 months ago

@elupus I might have good news about this issue. I have been debugging and testing and got something working. In haphilipsjs init.py Line 260: limits = httpx.Limits(max_keepalive_connections=0, max_connections=3)

httpx.Limits first parameter is Max connections and second is Max keepalive

It seems to be reversed unless 0 means unlimited.

I canged it to: limits = httpx.Limits(max_connections=3, max_keepalive_connections=3)

The integrations has not crashed the JointSpace server on my TV (running for 16 hours now) and its only using 3 connections. Before it crashed after 5 minutes.

Sdahl1234 commented 10 months ago

Just a follow up.... Lost connection after 17 hours. Needed to reboot TV. Now im trying with max_connections=1 and max_keepalive connections=1. I have https://github.com/nstrelow/ha_philips_android_tv integration running and connected to the same TV in my HA production. It might influence the stability of the test.

Sdahl1234 commented 10 months ago

Another follow up... I have all my 4 philips TV's running in my HA production, without any TV crashes since my last follow up.. I'm using Max Connection=3 and Max keepalive = 3

If you want to test: Download this repository https://github.com/danielperna84/ha-philipsjs. Change Line 260 in init_py from: limits = httpx.Limits(max_keepalive_connections=0, max_connections=3) To: limits = httpx.Limits(max_connections=3, max_keepalive_connections=3) Copy the haphilipsjs folder to your config folder. Restart HA.

Please report back.

andrewjswan commented 10 months ago

If you want to test:

Does the integration out of the box use this library? Or do I need to reconfigure the TV in the HA?

Sdahl1234 commented 10 months ago

It uses the library out of the box. No need to reconfigure the TV

andrewjswan commented 10 months ago

Copy the haphilipsjs folder to your config folder.

/config/haphilipsjs

or

/config/custom_components/haphilipsjs

?

Sdahl1234 commented 10 months ago

/config/haphilipsjs

elupus commented 10 months ago

Eh. This wont have any effect at all

Sdahl1234 commented 10 months ago

You can add a dummy Log entry in async def getReq function to be sure its using the right library LOG.debug("Using local lib haphilipsjs")

You might have to reboot your TV if the JointSpace server has crashed

Sdahl1234 commented 10 months ago

https://community.home-assistant.io/t/custom-component-for-library-file/334614

elupus commented 10 months ago

https://community.home-assistant.io/t/custom-component-for-library-file/334614

Weirdness. I need to check that internally with the team. That should not work.

andrewjswan commented 10 months ago

If you want to test:

Better, but still bad... image

Sdahl1234 commented 10 months ago

Does it kill you server on the TV or does it reconnect again without rebooting your TV?

Sdahl1234 commented 10 months ago

And is "Allow notification service" on? This kills my 3 "bad" TV's

elupus commented 10 months ago

https://community.home-assistant.io/t/custom-component-for-library-file/334614

Weirdness. I need to check that internally with the team. That should not work.

So.. Yes it does work. But please place them in a deps/ subfolder of your config directory instead, which should work too. Getting them from root of config will go away if i figure out how.

andrewjswan commented 10 months ago

Does it kill you server on the TV or does it reconnect again without rebooting your TV?

I haven’t seen any reboots, but the status is still incorrect, the TV is working, but the status is Off (you can see it from the Android TV line installed on the same TV).

And is "Allow notification service" on?

Off

This kills my 3 "bad" TV's

What does it mean it kills? It is not safe?

So.. Yes it does work. But please place them in a deps/ subfolder of your config directory instead, which should work too. Getting them from root of config will go away if i figure out how.

/config/deps/haphilipsjs ? Or?

Those. wait for the integration update? Should I remove haphilipsjs after updating? Or will he still be needed?