Closed golles closed 1 year ago
Some kind of recover mechanism would indeed be very nice, at least it assures automations to keep working.
@golles I've added some recovery mechanism. in the latest version with some sliding interval of retry-attempts. Please let me know if you see improvement on this matter.
I'm not sure if this is related but got this yesterday:
2023-03-29 18:23:34.536 ERROR (Thread-3 (_thread_main)) [lghorizon.lghorizon_api] Could not handle status message
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.10/site-packages/urllib3/packages/six.py", line 769, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse
response.begin()
File "/usr/local/lib/python3.10/http/client.py", line 318, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/lghorizon/lghorizon_api.py", line 298, in _on_mqtt_message
self._handle_box_update(deviceId, message)
File "/usr/local/lib/python3.10/site-packages/lghorizon/lghorizon_api.py", line 331, in _handle_box_update
raw_replay_event = self._do_api_call(f"{self._country_settings['api_url']}/eng/web/linear-service/v2/replayEvent/{eventId}?returnLinearContent=true&language={self._country_settings['language']}")
File "/usr/local/lib/python3.10/site-packages/backoff/_sync.py", line 105, in retry
ret = target(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/lghorizon/lghorizon_api.py", line 360, in _do_api_call
api_response = self._session.get(url)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 547, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
2023-03-29 18:23:34.546 WARNING (Thread-3 (_thread_main)) [lghorizon.lghorizon_api] Full message: {'version': '1.3.18', 'type': 'CPE.uiStatus', 'source': '3C36E4-EOSSTB-003926772108', 'messageTimeStamp': 1680107013470, 'status': {'uiStatus': 'mainUI', 'playerState': {'sourceType': 'replay', 'speed': 1, 'lastSpeedChangeTime': 1680105779517, 'source': {'eventId': 'crid:~~2F~~2Fgn.tv~~2F24237772~~2FEP044303940147,imi:cf7dcac4de382211a0887b3dc845ee2c3383828b', 'prePadding': 300000, 'postPadding': 7200000, 'sessionStartTime': 1680106860000, 'sessionEndTime': 1680108900000}, 'relativePosition': 300280}, 'uiState': {}}}
Another thing I noticed is that sometimes fields become null
(very likely due to the above):
media_content_type: episode
entity_picture_local: null
play_mode: null
channel: null
title: null
image: null
recording_capacity: null
device_class: tv
friendly_name: Mediabox
supported_features: 154545
These are two different issues. The mqtt issue should be partially resolved by a retry mechanism. Does this work for you?
I haven't seen any issues recently
Ok, thanks for the feedback. I'm closing this right now. Feel free te reopen s issues reappear.
Describe the bug I've seen this handshake error 2 (or 3) times in the last couple of weeks. According to #37 this is related to an outage of the supplier.
To Reproduce N/A
Expected behavior Even though there isn't much you can do about the unavailability of the service, I believe the component should be able to recover from such a problem.
Screenshots N/A
Version of the component 0.4.3 (lghorizon>=0.5.12)
Logging
Additional context I'm now either reloading the component manually or restarting HA, which fixes the issue.