Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Philips TV goes to Off status #88264

Closed
andrewjswan opened this issue Feb 16, 2023 · 60 comments · Fixed by #117881
Closed

Philips TV goes to Off status #88264

andrewjswan opened this issue Feb 16, 2023 · 60 comments · Fixed by #117881

Comments

@andrewjswan
Copy link

andrewjswan commented Feb 16, 2023

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
Copy link

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
Copy link
Contributor

elupus commented Feb 16, 2023

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

@andrewjswan
Copy link
Author

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
Copy link
Author

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
Copy link
Contributor

elupus commented Feb 17, 2023

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

@andrewjswan
Copy link
Author

~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
Copy link
Author

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
Copy link

consma5 commented Feb 21, 2023

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

@andrewjswan
Copy link
Author

No :(

@elupus
Copy link
Contributor

elupus commented Feb 21, 2023

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
Copy link
Author

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
Copy link
Contributor

elupus commented Feb 21, 2023

@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
Copy link

consma5 commented Feb 21, 2023

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
Copy link
Author

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

@elupus
Copy link
Contributor

elupus commented Feb 21, 2023

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

2023.05 - No change, everything is the same.

@jonalbr
Copy link

jonalbr commented Jun 3, 2023

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
Copy link
Contributor

elupus commented Jun 3, 2023

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

@andrewjswan
Copy link
Author

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

@issue-triage-workflows
Copy link

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
Copy link
Author

2023.8 the some

@github-actions github-actions bot removed the stale label Sep 2, 2023
@5a2v0
Copy link

5a2v0 commented Sep 2, 2023

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
Copy link

5a2v0 commented Sep 5, 2023

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
Copy link
Author

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.

@Sdahl1234
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

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

@andrewjswan
Copy link
Author

Copy the haphilipsjs folder to your config folder.

/config/haphilipsjs

or

/config/custom_components/haphilipsjs

?

@Sdahl1234
Copy link
Contributor

/config/haphilipsjs

@elupus
Copy link
Contributor

elupus commented Jan 9, 2024

Eh. This wont have any effect at all

@Sdahl1234
Copy link
Contributor

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
Copy link
Contributor

@elupus
Copy link
Contributor

elupus commented Jan 9, 2024

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
Copy link
Author

If you want to test:

Better, but still bad...
image

@Sdahl1234
Copy link
Contributor

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

@Sdahl1234
Copy link
Contributor

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

@elupus
Copy link
Contributor

elupus commented Jan 10, 2024

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
Copy link
Author

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?

@Sdahl1234
Copy link
Contributor

@andrewjswan
It is safe. "Kills" means I need to reboot TV to get the JointSpace server on the TV up and running again.

@elupus
Its seems the httpx.Limits call has the parameters wrong.
Documentations says param1: max connection, param2: max keepalive connections)

I have had the integration running 3 weeks now without any reboot on the TV only changing
line 260
from
limits = httpx.Limits(max_keepalive_connections=0, max_connections=3)
to
limits = httpx.Limits(max_connections=3, max_keepalive_connections=3)

Before:
1 TV worked
3 TV's lost connection after 5 minutes
After:
4 TV's works

After HA release 2024.2 you need to have haphilipsjs folder in the /config/deps/ folder if you want to test with your own TV's

523352c

@elupus
Copy link
Contributor

elupus commented Jan 30, 2024

@elupus Its seems the httpx.Limits call has the parameters wrong. Documentations says param1: max connection, param2: max keepalive connections)

I have had the integration running 3 weeks now without any reboot on the TV only changing line 260 from limits = httpx.Limits(max_keepalive_connections=0, max_connections=3) to limits = httpx.Limits(max_connections=3, max_keepalive_connections=3)

They are keyword parameters, so order does not matter.

The change you seem to have made is to allow keep alive. It could be beneficial in some cases IF the server supports it. Ie it would reduce connection load. My old (pre-android) TV's crashed hard with that enabled. I don't own that TV anymore sadly.

If you turn up debug logging on the httpx and httpcore i think you should get logs on reuses of connections. Please verify that you are actually getting re-uses.

I'm mostly fine with enabling keep alive, feel free to provide a patch for the lib to enable that. I think you could allow passing in a limits argument to the constructor. Then it's easier to tune this.

@Sdahl1234
Copy link
Contributor

@elupus
Thanks for the explanation of the parameters. I am not coding very much python.

I noticed some weird behavior with httpx. It does NOT respect the max_connections if max keepalive connections is 0
If I use max_connections=3 and max_keepalive connections=0 then the number of connections increases beyond 3. My TV crashes when I hit about 25 connections (5 minutes after the first connection every time)
If i use the max keepalive connection=3 it will stay with max 2 connections and the TV keeps working.

I have no clue why I get more that 3 connections and I sadly does not have the time to debug more at the moment....

@elupus
Copy link
Contributor

elupus commented Jan 30, 2024

@Sdahl1234 That is a very interesting find! Maybe we expose a bug in httpx here.

@issue-triage-workflows
Copy link

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
Copy link
Author

Still relevant

@huberten9111
Copy link

I still get this , unavailable when powered on , off when powered off

@elupus
Copy link
Contributor

elupus commented May 27, 2024

You are of 2024.5.5 release? If so please turn on debug for the integration and reproduce issue. Then turn off and post log here

@andrewjswan
Copy link
Author

It got a little better, but still not completely.
image

@huberten9111
Copy link

Core 2024.5.5
Supervisor 2024.05.1
Operating System 12.3
Frontend 20240501.1

Added file here if that works?
home-assistant_philips_js_2024-05-27T20-23-23.125Z.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants