Skip to content

Commit

Permalink
refactor: only allow updates if car isn't offline
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Jan 28, 2020
1 parent 5cf5c17 commit 2c85b80
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion teslajsonpy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,9 @@ async def update(self, car_id=None, wake_if_asleep=False, force=False):
if car_vin and car_vin != vin:
continue
async with self.__lock[vin]:
car_state = self.raw_online_state[vin]
if (
(online or wake_if_asleep)
(online or (wake_if_asleep and car_state == "asleep"))
and ( # pylint: disable=too-many-boolean-expressions
self.__update.get(vin)
)
Expand Down

0 comments on commit 2c85b80

Please sign in to comment.