core
core copied to clipboard
Philips TV integration quickly looses track of TV
The problem
I have been trying to use the Philips TV integration with my (rather old...) 55PUK7150/12. The integration works if the TV (or the ambilight) are switched on with the original remote, but then (after a minute or two) home assistant stops being able to communicate with the TV and the only ways to make it work again are:
- Change again something with the TV remote, or
- Send (possibly a few times) a wakeonlan (WoL) packet to the TV, which will then resume responding to the integration.
One solution (in case that's not already happening - I didn't find anything related in the code, but I might have missed it), would be to try and send WoL packets (possibly a couple retries) whenever the user tries to make any change (e.g., open the ambilight configuration) in home assistant. Hopefully, that would make sure that the webserver handling the communication on the TV side would wake up and respond appropriately..
There could also be a periodic (every minute or so? even every several minutes) WoL packet being sent in order to update the status.
What version of Home Assistant Core has the issue?
Home Assistant 2022.8.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/
Diagnostics information
Log when trying to change something in the home assistant UI while the TV cannot be reached:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 553, in async_handle_light_on_service
await light.async_turn_on(**filter_turn_on_params(light, params))
File "/usr/src/homeassistant/homeassistant/components/philips_js/light.py", line 347, in async_turn_on
raise Exception("TV is not available")
Exception: TV is not available
Example YAML snippet
No response
Anything in the logs that might be useful for us?
This is the debug message being shown when the TV is not reachable:
2022-08-09 20:39:17.180 DEBUG (MainThread) [haphilipsjs] TV not available: ConnectionFailure(ConnectError('All connection attempts failed'))
2022-08-09 20:39:47.196 DEBUG (MainThread) [haphilipsjs] TV not available: ConnectionFailure(ConnectError('All connection attempts failed'))
2022-08-09 20:40:17.180 DEBUG (MainThread) [haphilipsjs] TV not available: ConnectionFailure(ConnectError('All connection attempts failed'))
...
So, apparently, there is already polling every 30 seconds going on, but it does not manage to contact the TV.. Being able to configure this polling period would also be great BTW (is it possible?).
Additional information
No response
philips_js documentation philips_js source (message by IssueLinks)
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!
(message by CodeOwnersMention)
Still having the same problem with the latest HA version. Is this integration being actively maintained?
Somewhat. Buy the TV:s are not, and they tend to be buggy. If its an android TV, you can install wakelock apps.
WOL packets only work on ethernet as far as i know, so its not really a complete solution.
Thanks @elupus for replying :-)
Yes, it is an Android TV.. I have seen suggestions for a wakelock app (and I have not tried that yet). My concern with that solution is that idle power will go up (I am not sure by how much, though).
Re. WoL - I do use Ethernet, so it should work for my case. If you could help pointing to the right part of the code to modify in order to send WoL packets before trying to execute any action, I could try that myself and contribute it back if it works well.
Well, you can hook up a turn on device action. If you do, it will execute that if you press ON. Its not hooked up for all actions.
Looks like I have the same issue. I turn on TV. It is become available and I can control it from HA. But after a minute it sis become unavailable
I will close this for now. I don't think this is an issue anymore.
@elupus Hm, white it is not an issue anymore? My TV still becomes unavailable after 5 minutes