Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use the correct location for vehicle_config. (#462) (#463) #464

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions teslajsonpy/car.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading