Skip to content

Commit

Permalink
Merge pull request #80 from alandtse/retry_init
Browse files Browse the repository at this point in the history
fix: add retry to get_vehicles
  • Loading branch information
alandtse committed May 31, 2020
2 parents 142e44b + 1b6660d commit 9c440c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion teslajsonpy/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
https://github.com/zabuldon/teslajsonpy
"""

__version__ = "0.7.0"
__version__ = "0.8.0"
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 9c440c8

Please sign in to comment.