Skip to content

Commit

Permalink
Merge pull request #89 from alandtse/#ha37340
Browse files Browse the repository at this point in the history
fix: use max of update_interval and SLEEP_INTERVAL
  • Loading branch information
alandtse committed Jul 3, 2020
2 parents 228dd89 + f34df60 commit 0033c27
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions teslajsonpy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,15 +584,16 @@ def _calculate_next_interval(vin: Text) -> int:
):
if self.__update_state[vin] != "trying_to_sleep":
self.__update_state[vin] = "trying_to_sleep"
sleep_interval = max(SLEEP_INTERVAL, self.update_interval)
_LOGGER.debug(
"%s trying to sleep; scan throttled to %s seconds and will ignore updates for %s seconds",
vin[-5:],
SLEEP_INTERVAL,
sleep_interval,
round(
SLEEP_INTERVAL + self._last_update_time[vin] - cur_time, 2
sleep_interval + self._last_update_time[vin] - cur_time, 2,
),
)
return SLEEP_INTERVAL
return sleep_interval
if self.__update_state[vin] != "normal":
self.__update_state[vin] = "normal"
_LOGGER.debug(
Expand Down

0 comments on commit 0033c27

Please sign in to comment.