core: Philips TV crashes and shows unavailable

The problem

no longer recognizes the TV on

What is version of Home Assistant Core has the issue?

2021.4.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Philips TV

Link to integration documentation on our website

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.philips_js
Source: components/philips_js/__init__.py:175 
Integration: Philips TV (documentation, issues) 
First occurred: 26 aprile 2021, 8:41:24 (11 occurrences) 
Last logged: 7:16:47

Unexpected error fetching philips_js data: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_exceptions.py", line 326, in map_exceptions
    yield
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_client.py", line 1492, in _send_single_request
    (status_code, headers, stream, ext) = await transport.arequest(
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_transports/default.py", line 169, in arequest
    return await self._pool.arequest(
  File "/srv/homeassistant/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 218, in arequest
    response = await connection.arequest(
  File "/srv/homeassistant/lib/python3.9/site-packages/httpcore/_async/connection.py", line 106, in arequest
    return await self.connection.arequest(method, url, headers, stream, ext)
  File "/srv/homeassistant/lib/python3.9/site-packages/httpcore/_async/http11.py", line 72, in arequest
    ) = await self._receive_response(timeout)
  File "/srv/homeassistant/lib/python3.9/site-packages/httpcore/_async/http11.py", line 133, in _receive_response
    event = await self._receive_event(timeout)
  File "/srv/homeassistant/lib/python3.9/site-packages/httpcore/_async/http11.py", line 169, in _receive_event
    event = self.h11_state.next_event()
  File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/srv/homeassistant/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc) from None
httpcore.RemoteProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/haphilipsjs/__init__.py", line 462, in getReq
    resp = await self.session.get(self._url(path), timeout=TIMEOUT)
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_client.py", line 1539, in get
    return await self.request(
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_client.py", line 1361, in request
    response = await self.send(
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_client.py", line 1396, in send
    response = await self._send_handling_auth(
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_client.py", line 1434, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_client.py", line 1466, in _send_handling_redirects
    response = await self._send_single_request(request, timeout)
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_client.py", line 1492, in _send_single_request
    (status_code, headers, stream, ext) = await transport.arequest(
  File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/srv/homeassistant/lib/python3.9/site-packages/httpx/_exceptions.py", line 343, in map_exceptions
    raise mapped_exc(message, **kwargs) from exc  # type: ignore
httpx.RemoteProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/update_coordinator.py", line 173, in _async_refresh
    self.data = await self._async_update_data()
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/philips_js/__init__.py", line 175, in _async_update_data
    await self.api.update()
  File "/srv/homeassistant/lib/python3.9/site-packages/haphilipsjs/__init__.py", line 621, in update
    await self.getAmbilightMode()
  File "/srv/homeassistant/lib/python3.9/site-packages/haphilipsjs/__init__.py", line 946, in getAmbilightMode
    data = await self.getReq("ambilight/mode")
  File "/srv/homeassistant/lib/python3.9/site-packages/haphilipsjs/__init__.py", line 475, in getReq
    raise GeneralFailure(err) from err
haphilipsjs.GeneralFailure: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 66 (28 by maintainers)

Most upvoted comments

This is likely the background crash in the SSL engine on the TV: restlet/restlet-framework-java#852

I have a similar experience (that the SSL fails to work) as mentioned in the link. However, in my case the SSL already stops after the TV sends its SYN ACK, and fails to respond on the CLIENT HELLO (part of the SSL handshake). From WireShark it looks as if TV believes it has not received a CLIENT HELLO whereas the client awaits the SERVER HELLO. The interesting part here is that there is no pattern in when this occurs. Power cycling the TV will get things back online. Powering TV ON / OFF through Home Assistant may work for a number of times. Leaving the TV off for hours, then power it on could in some cases cause this behaviour. In other cases, leaving the TV running for hours (and using Home Assistant to change channels, volume etc.) would work, and then all of a sudden the SSL connection would start to act up (especially seen the TV had been turnoff).

Currently I have a support case running against Philips for this. Unfortunately the push-back I get is that ‘we do not really see the problem as the JointSpace queries only are defined for port 1925’ 😕

Ideas: Previously I have successfully used an unofficial component. The difference I note is that the Philips TV integration queries Ambilight. Question is if would be / is possible to make querying this optional? Secondly, I note that all states are still queried even if PowerState goes to Standby (ie. when I turn it off). Question is if this is on purpose, or if such should be avoided (to limit the ‘stress’ on the TV)?