Skip to content

Commit

Permalink
Merge pull request #81 from zabuldon/dev
Browse files Browse the repository at this point in the history
fix: add retry to get_vehicles
  • Loading branch information
alandtse authored May 31, 2020
2 parents 62a4bd9 + 9c440c8 commit aeaeb04
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions teslajsonpy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import backoff
import wrapt
from aiohttp import ClientConnectorError

from teslajsonpy.battery_sensor import Battery, Range
from teslajsonpy.binary_sensor import (
Expand Down Expand Up @@ -344,6 +345,7 @@ def register_websocket_callback(self, callback) -> int:
self.__websocket_listeners.append(callback)
return len(self.__websocket_listeners) - 1

@backoff.on_exception(min_expo, ClientConnectorError, max_time=10, logger=__name__)
async def get_vehicles(self):
"""Get vehicles json from TeslaAPI."""
return (await self.__connection.get("vehicles"))["response"]
Expand Down

0 comments on commit aeaeb04

Please sign in to comment.