Handle connection issues with Traccar (#78624)

This commit is contained in:
Joakim Sørensen 2022-09-17 10:26:59 +02:00 committed by GitHub
parent 98dd84f535
commit 0b4e4e81d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,7 @@ from pytraccar import (
GeofenceModel,
PositionModel,
TraccarAuthenticationException,
TraccarConnectionException,
TraccarException,
)
from stringcase import camelcase
@ -238,6 +239,9 @@ class TraccarScanner:
except TraccarAuthenticationException:
_LOGGER.error("Authentication for Traccar failed")
return False
except TraccarConnectionException as exception:
_LOGGER.error("Connection with Traccar failed - %s", exception)
return False
await self._async_update()
async_track_time_interval(self._hass, self._async_update, self._scan_interval)