Skip to content

Commit

Permalink
fix: catch keyerror for missing seatwarmers
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Apr 3, 2021
1 parent e9b149a commit 9436684
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions teslajsonpy/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,11 @@ def _add_components(self, car):
self.__components.append(TrunkLock(car, self))
self.__components.append(FrunkLock(car, self))
self.__components.append(UpdateSensor(car, self))
self.__components.append(HeatedSeatSwitch(car, self, 'left'))
self.__components.append(HeatedSeatSwitch(car, self, 'right'))
self.__components.append(HeatedSeatSwitch(car, self, 'rear_left'))
self.__components.append(HeatedSeatSwitch(car, self, 'rear_center'))
self.__components.append(HeatedSeatSwitch(car, self, 'rear_right'))
for seat in ['left', 'right', 'rear_left', 'rear_center', 'rear_right']:
try:
self.__components.append(HeatedSeatSwitch(car, self, seat))
except KeyError:
_LOGGER.debug("Seat warmer %s not detected", seat)

async def _wake_up(self, car_id):
car_vin = self._id_to_vin(car_id)
Expand Down

0 comments on commit 9436684

Please sign in to comment.