Skip to content

Commit

Permalink
Log on level info, if no points are found (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhaus authored Oct 28, 2020
1 parent 2ff921b commit 63ee979
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/tractive/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

CONF_MAX_GPS_ACCURACY = "max_gps_accuracy"

LAST_HOURS = 6

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
Expand Down Expand Up @@ -160,7 +161,7 @@ async def _fetch_tracker_data(self, tracker_id):
pass

now = datetime.timestamp(datetime.now())
time_from = now - 3600 * 6
time_from = now - 3600 * LAST_HOURS

try:
with async_timeout.timeout(self._timeout):
Expand Down Expand Up @@ -199,7 +200,7 @@ async def _async_update(self, now=None):

points = result[0]
if not points:
_LOGGER.error("No points")
_LOGGER.info(f"No points found for the last {LAST_HOURS} hours")
continue
_LOGGER.debug("points %s", points)
point = points[-1]
Expand Down

0 comments on commit 63ee979

Please sign in to comment.