-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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_js: Unstable behaviour in every way #48839
Comments
philips_js documentation |
This mainly looks like a buggy tv. They are notoriously bad and crash prone. Especially if you send many commands (volume is easy to hammer the key). If you just leave it be, does it stay online and display things like current channel? |
https://i.imgur.com/dPXd3Gx.png It seems to stay on, I can see all the apps etc. When it worked, I was able to switch the TV to youtube, but it took about a minute to do. |
How is it behaving after the .4 point release? It should not be as prone to go offline anymore. It may still fail commands. |
I readded the integration and it seems a liiitle bit better, but when I click around all the options it still crashes and I have to restart the TV. I managed to open the Kodi app once, which I was quite pleased with. |
A small observation from my own PoV on the component behaviour. Previously I used another component for my TV (https://github.com/nstrelow/ha_philips_android_tv). This worked like a charm. I then tried to chang to philips_js, and all of a sudden I experienced that my flows (nodeRED) occasionally stopped with API errors when calling services. The only way to resolve the API error would be to power cycle of my TV. Upon investigation, I saw that when API errors occurred that:
When the port failed, NMAP showed the port as still open which then lead to a check with WireShark. This showed the initial TCP handshake failed in the last step (the TV did not react to Home Assistant sending ACK as a reply to TV SYN/ACK). The result was that the TLS handshake failed (it was started by Home Assistant while the TV was still stuck in the TCP handshake doing retransmission of SYN/ACK). The solution for me was to reinstall my TV (take a note of your TVs setting before doing such as everything is reset). Despite hammering the TV with commands (on / off / source change / channel change) I have now run for two days without any failures. ---EDIT 2021-04-18--- |
Right. Yes this component is a bit more heavy on access to the tv. I may have to allow turning of the notification system. It will be slower to update, but maybe more stable. |
Guys. are you running the TV's on wifi or lan? I just noticed that my TV which is on WIFI, keeps disconnecting from wifi all the time. If this timing wise coincides with a request from home assistant, the TV goes offline in HA. This would easily explain issues with notification/events features since it will be running LONG queries. Which very likely will be in an open state when the TV looses wifi. It might fail to do proper clean-up then. |
I run solely on LAN. Would it be possible to share the queries sent to the TV? That way I could easily check the power off / queries thesis (and also provide Philips with a PoC of how to trigger a fault of the HTTPS server in the TV. |
Just turn on debug for the components.
|
Those are the long running. |
My TV is on wifi, but I will put it on lan pretty soon. I will see if that does anything. |
@elupus, for me to understand you correct; the 8 GET commands listed are the long running queries you are referring to? |
No. Only the post of notifyChange |
For reference.. hass will issue a http post request to the tv. It will just hang not returning anything untill something changes. At which point it will start writing data to the connection that was opened a long time ago. |
Ok, got it. Messing around with the remote while watching the log exposed a "...[haphilipsjs] Post succeded: {'notification':...". -> Thanks for that revelation! :) From my understanding (and a little more WireSharking), the TV is queried with a http://ip_of_tv:1925/6/system, when I restart Home Assistant. The first part of my TVs reply is '{"notifyChange":"http","menulanguage":", and this is the last communication on port 1925 & the last http communication; changing channels (via remote) on the TV shows the "Post succeeded", however, there are no post requests (in WireShark) on port 1925. Wouldn't it be better to run the notifychange on 1925? |
I tried. I thought it would be possible |
Hmmm...this is interesting (and a bit worrying that Philips is so inconsistent). For me, running the notifychange command (with curl) on either port 1925 or 1926 result in the exact same reply; a reply that only consists of activities/tv (with the two subsets of channel and channellist). I also (based on the log) seem only to be able to trigger the "...[haphilipsjs] Post succeded: {'notification':..." if I change the channel / source. |
Next to that this component does most often not work at all (same problems), it also does not allow to activate the ambilight as long the TV component is off. My TV is also connected via WLAN, but will connect it via LAN next week and report if this helps. |
@lweberru are you running 2021.7 release? if you can't active ambilight when TV is off. Your TV is likely fully turned off. Or buggy as usual. |
I have upgraded to 2021.7. My conclusion so far is that the integration works far better now since notifications are turned of by default (I checked and did not have to change any setting there). However, after a weeks use (which is more than twice in previous best case scenarios), the problem reemerged and the TV became unresponsive. I have reverted back to a deprecated version which, despite lacking a number of features found in the official integration, for some reason does not trigger the TV to crash port 1926. |
Yes running 2021.7.2. and TV is not fully off, i can use the philips_js webcalls for example. Just the component brings a popup „TV is not available“. |
Well if you get that error it can't access the tv. Maybe it has crashed? Can you fully reboot it an test. Physical unplug or the reboot option in menus if this is an Android tv. |
Ok, i now connected the tv via lan. But the result is the same as when connected via wlan. I can only bind the home assistant once per restart of the tv, the control via home assistant is just a random result, changing the ambilight neither possible while tv is on nor while it is off. |
@lweberru Not sure what you mean by "bind once"? What type of errors do you get in log. What model tv is this? |
The TV is a 49PUS7502/12 Binding error:
|
The error using this component looks like this:
|
@lweberru if you get connect timeout, you TV (the https endpoint) has crashed and need to be completely restarted before anything at all work again. What triggers the crash is unknown. |
Might be, that these TVs have some bugs, but the old ambilight and ambilight+hue component worked like a charm, so it should be possible somehow that this component is a bit more fault tolerant or probably has some issues with caching information or so. |
Unfortunately I think it is the Philips JS component that is crashing my TV. I would get lock ups, random app quits and general instability every 2-3 days before I disabled the component - now it has been working without issue for over 2 weeks |
@aegjoyce it definitely is the component that causes the crash. But it's a bug in the tv that it crashes. Sadly I've not been able to pinpoint what causes the crash. It does so much more than the old custom component. So it's not a valid comparison. But if anybody can pinpoint/reproduce it in a reliable way we can possibly work around it. |
Will see what I can do. Only thing I've noticed so far is that after a restart it works fine, only ever had problems after the TV has been in standby for a while |
My issue is this one: |
It can't be fixed that way. 1925 does not provide all data. Only some data is available there. |
Can u tell me an example api call, what you think is not available? I will test… |
I mentioned at least three in the other issue. |
Can be added i know this is the case since i have dissasembled source code for the android server software. |
@elupus Can I just check with you how you found the Jointspace commands that this component uses? Only reason for asking is that I've been rewriting one of the old custom components for Ambilight as a temporary workaround for the TV crashes which was using commands from the pylips repository, a lot of which no longer work. I have been sniffing the https requests from the Philips TV Remote app which are very different to most of what I see listed on pylips. Could using older (pylips) JS commands be causing the API (and TV) to hang and crash? EDIT: repository is here: https://github.com/aegjoyce/ambilights - I have it set to poll every 30s and it hasn't caused any TV crashes (yet!) |
Yes any commands can cause it to crash. My component doesn't do anything different than pylips. Might just be working the apis harder. You can grab the xtv Android apk from an android tv. Then use an online disassembler to extract the source code. |
Well. Actually it does one thing different. It's using httpx instead of requests library to talk to the server. |
Don't know if this is helpful but here is a sample POST request from the Philips app - includes details of their auth:
|
Sure, will keep an eye out for when it gets pushed in an update and will test |
Any news here? |
Do you happen to have more captured requests and could you share those? That would save me some time getting captures myself. |
I'm going to close this in favor of its twin: #49801 . It's likely not resolved. But I don't know what triggers the fault yet, and i think it's better to keep to one issue. |
The problem
I'm sorry the title is not very descriptive, but there's no way I can get all my issues in the title.
When I visit http://IP_ADDRESS_OF_TV:1925/system, I get the correct page and my api_version is 6.
When I first set it up I changed the volume and it worked. Now everytime I try to change something from the media_player card, a message pops up saying failed to call service: media_player.turn_off or set_volume or volume up, and the card then shows the TV is off. It will turn on if I turn the actual TV off, wait a minute and turn it on again.
I will also mention, I tried to add this integration in a previous HA version, but I experienced the same instabilities. I hoped the new update would help some of it, but unfortunately not :(
My TV is the Philips 55PUS7181/12
What is version of Home Assistant Core has the issue?
core-2021.4.0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
philips_js
Link to integration documentation on our website
https://www.home-assistant.io/integrations/philips_js/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
List of errors I get: https://i.imgur.com/nQgobWk.png + example from one of the errors. If a specific error is needed I can provide it as well.
`Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/httpcore/_backends/asyncio.py", line 233, in acquire await asyncio.wait_for(self.semaphore.acquire(), timeout) File "/usr/local/lib/python3.8/asyncio/tasks.py", line 501, in wait_for raise exceptions.TimeoutError() asyncio.exceptions.TimeoutError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/httpx/_exceptions.py", line 326, in map_exceptions yield File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1492, in _send_single_request (status_code, headers, stream, ext) = await transport.arequest( File "/usr/local/lib/python3.8/site-packages/httpx/_transports/default.py", line 169, in arequest return await self._pool.arequest( File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 213, in arequest await self._add_to_pool(connection, timeout=timeout) File "/usr/local/lib/python3.8/site-packages/httpcore/_async/connection_pool.py", line 345, in _add_to_pool await self._connection_semaphore.acquire(timeout=timeout.get("pool", None)) File "/usr/local/lib/python3.8/site-packages/httpcore/_backends/asyncio.py", line 235, in acquire raise self.exc_class() httpcore.PoolTimeout The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/haphilipsjs/__init__.py", line 311, in _postReq resp = await self.session.post(self._url(path), json=data, timeout=timeout) File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1624, in post return await self.request( File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1361, in request response = await self.send( File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1396, in send response = await self._send_handling_auth( File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1434, in _send_handling_auth response = await self._send_handling_redirects( File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1466, in _send_handling_redirects response = await self._send_single_request(request, timeout) File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 1492, in _send_single_request (status_code, headers, stream, ext) = await transport.arequest( File "/usr/local/lib/python3.8/contextlib.py", line 131, in __exit__ self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.8/site-packages/httpx/_exceptions.py", line 343, in map_exceptions raise mapped_exc(message, **kwargs) from exc # type: ignore httpx.PoolTimeout The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 206, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 649, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 692, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/philips_js/media_player.py", line 221, in async_volume_up await self._tv.sendKey("VolumeUp") File "/usr/local/lib/python3.8/site-packages/haphilipsjs/__init__.py", line 735, in sendKey res = await self._postReq('input/key', {'key': key}) is not None File "/usr/local/lib/python3.8/site-packages/haphilipsjs/__init__.py", line 329, in _postReq raise GeneralFailure(err) from err haphilipsjs.GeneralFailure `
The text was updated successfully, but these errors were encountered: