Skip to content

Commit

Permalink
fix: Use the correct location for vehicle_config. (#462) (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrint committed Mar 27, 2024
1 parent 9c55e4f commit 879b04e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions teslajsonpy/car.py
Expand Up @@ -451,7 +451,7 @@ def power(self) -> int:
@property
def powered_lift_gate(self) -> bool:
"""Return True if car has power lift gate."""
return self._car.get("vehicle_config", {}).get("plg")
return self._vehicle_data.get("vehicle_config", {}).get("plg")

@property
def rear_seat_heaters(self) -> int:
Expand All @@ -461,7 +461,7 @@ def rear_seat_heaters(self) -> int:
int: 0 (no rear heated seats), int: ? (rear heated seats)
"""
return self._car.get("vehicle_config", {}).get("rear_seat_heaters")
return self._vehicle_data.get("vehicle_config", {}).get("rear_seat_heaters")

@property
def sentry_mode(self) -> bool:
Expand Down Expand Up @@ -533,7 +533,7 @@ def third_row_seats(self) -> str:
str: None
"""
return self._car.get("vehicle_config", {}).get("third_row_seats")
return self._vehicle_data.get("vehicle_config", {}).get("third_row_seats")

@property
def time_to_full_charge(self) -> float:
Expand Down
6 changes: 4 additions & 2 deletions tests/unit_tests/test_car.py
Expand Up @@ -204,6 +204,8 @@ async def test_car_properties(monkeypatch):

assert _car.outside_temp == VEHICLE_DATA["climate_state"]["outside_temp"]

assert _car.powered_lift_gate == VEHICLE_DATA["vehicle_config"]["plg"]

assert _car.rear_seat_heaters == VEHICLE_DATA["vehicle_config"]["rear_seat_heaters"]

assert _car.sentry_mode == VEHICLE_DATA["vehicle_state"].get("sentry_mode")
Expand Down Expand Up @@ -241,7 +243,7 @@ async def test_car_properties(monkeypatch):
assert _car.pedestrian_speaker == ("P3WS" in VEHICLE_DATA["option_codes"])

assert _car.third_row_seats == str(
VEHICLE_DATA["vehicle_state"].get("third_row_seats")
VEHICLE_DATA["vehicle_config"].get("third_row_seats")
)

assert (
Expand Down Expand Up @@ -826,4 +828,4 @@ async def test_enable_remote_auto_steering_wheel_heat_climate_request(monkeypatc
await _controller.generate_car_objects()
_car = _controller.cars[VIN]

assert await _car.remote_auto_steering_wheel_heat_climate_request(True) is None
assert await _car.remote_auto_steering_wheel_heat_climate_request(True) is None

0 comments on commit 879b04e

Please sign in to comment.