-
Notifications
You must be signed in to change notification settings - Fork 2
Description
When running live feed stats for more than a day (usually between 16 and 36 hours), I am seeing a state that occurs where no reconnect is possible and a restart of the live feed is the only thing that will fix the issue shown in the logs before.
I am not sure if this is an issue with an underlying library (gql or another) or something that could be improved in tibber.py but an ideal scenario would be that these sort of frame and transport exceptions are handled and a full teardown and reconnect is done on the live feed thread.
Alternatively if you could recommend the best way i could catch such errors and initiate a reconnect myself that would also be helpful but I feel that it would improve tibber.py if such handling was built in.
Here are some logs of the issue that occurs. In this scenario i have an extremely high retry integer set with a 30 second retry interval:
2023-01-23 10:47:10 cerbomoticzGx: Backing off run_websocket_loop(...) for 0.1s (websockets.exceptions.ConnectionClosedError: no close frame received or sent) 2023-01-23 10:47:10 cerbomoticzGx: Retrying to subscribe with backoff. Running <bound method TibberHome.run_websocket_loop of <tibber.types.home.TibberHome object at 0xffff819234c0>> in 0.1 seconds after 1 tries. 2023-01-23 10:47:10 cerbomoticzGx: Updating home information to check if real time consumption is enabled. 2023-01-23 10:47:11 cerbomoticzGx: Subscribing to websocket. 2023-01-23 10:47:11 cerbomoticzGx: Backing off run_websocket_loop(...) for 1.7s (gql.transport.exceptions.TransportClosed: Transport is not connected) 2023-01-23 10:47:11 cerbomoticzGx: Retrying to subscribe with backoff. Running <bound method TibberHome.run_websocket_loop of <tibber.types.home.TibberHome object at 0xffff819234c0>> in 1.7 seconds after 2 tries. 2023-01-23 10:47:13 cerbomoticzGx: Updating home information to check if real time consumption is enabled. 2023-01-23 10:47:14 cerbomoticzGx: Backing off run_websocket_loop(...) for 2.0s (TypeError: catching classes that do not inherit from BaseException is not allowed) 2023-01-23 10:47:14 cerbomoticzGx: Retrying to subscribe with backoff. Running <bound method TibberHome.run_websocket_loop of <tibber.types.home.TibberHome object at 0xffff819234c0>> in 2.0 seconds after 3 tries.
(and many hours later after continuing with the retries, still no success... issue was immediately resolved by restarting the script which start the live feed and imports tibber.py...)
2023-01-23 13:25:50 cerbomoticzGx: Updating home information to check if real time consumption is enabled. 2023-01-23 13:25:51 cerbomoticzGx: Subscribing to websocket. 2023-01-23 13:25:51 cerbomoticzGx: Backing off run_websocket_loop(...) for 84.8s (gql.transport.exceptions.TransportClosed: Transport is not connected) 2023-01-23 13:25:51 cerbomoticzGx: Retrying to subscribe with backoff. Running <bound method TibberHome.run_websocket_loop of <tibber.types.home.TibberHome object at 0xffff819234c0>> in 84.8 seconds after 187 tries. 2023-01-23 13:27:16 cerbomoticzGx: Updating home information to check if real time consumption is enabled. 2023-01-23 13:27:16 cerbomoticzGx: Subscribing to websocket. 2023-01-23 13:27:17 cerbomoticzGx: Backing off run_websocket_loop(...) for 98.6s (gql.transport.exceptions.TransportClosed: Transport is not connected) 2023-01-23 13:27:17 cerbomoticzGx: Retrying to subscribe with backoff. Running <bound method TibberHome.run_websocket_loop of <tibber.types.home.TibberHome object at 0xffff819234c0>> in 98.6 seconds after 188 tries.