Skip to content

Commit

Permalink
[ skip ci ] attempt to solve tibber websocket unrecovered failures
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaDodds committed Dec 12, 2024
1 parent 1ae628b commit aefaa7c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/tibber_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from lib.domoticz_updater import domoticz_update
from lib.clients.mqtt_client_factory import VictronClient
from gql.transport.exceptions import TransportClosed
from websockets.exceptions import ConnectionClosedError

logging.getLogger("gql.transport").setLevel(logging.ERROR)

Expand Down Expand Up @@ -58,9 +59,9 @@ async def log_accumulated(data):
logging.info(f"Tibber: Live measurements starting...")
try:
home.start_live_feed(user_agent=f"cerbomoticzgx/{dotenv_config('VERSION')}",
retries=1800,
retry_interval=30)
except TransportClosed as e:
retries=20,
retry_interval=10)
except (TransportClosed, ConnectionClosedError) as e:
logging.info(f"Tibber Error: {e} It seems we have a network/connectivity issue. Attempting a service restart...")
# this will trigger event_handler to restart the whole service
client.publish("Cerbomoticzgx/system/shutdown", payload=f"{{\"value\": \"True\"}}", retain=True)
Expand Down

0 comments on commit aefaa7c

Please sign in to comment.