Fix Auto Seat Heater in Tesla Fleet (#141539)

Fix Auto Seat Heater
This commit is contained in:
Brett Adams 2025-03-27 10:55:34 +10:00 committed by GitHub
parent d51070c99b
commit 66c03713b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 9 deletions

View File

@ -7,7 +7,7 @@ from dataclasses import dataclass
from itertools import chain
from typing import Any
from tesla_fleet_api.const import Scope, Seat
from tesla_fleet_api.const import AutoSeat, Scope, Seat
from homeassistant.components.switch import (
SwitchDeviceClass,
@ -46,7 +46,9 @@ VEHICLE_DESCRIPTIONS: tuple[TeslaFleetSwitchEntityDescription, ...] = (
),
TeslaFleetSwitchEntityDescription(
key="climate_state_auto_seat_climate_left",
on_func=lambda api: api.remote_auto_seat_climate_request(Seat.FRONT_LEFT, True),
on_func=lambda api: api.remote_auto_seat_climate_request(
AutoSeat.FRONT_LEFT, True
),
off_func=lambda api: api.remote_auto_seat_climate_request(
Seat.FRONT_LEFT, False
),
@ -55,10 +57,10 @@ VEHICLE_DESCRIPTIONS: tuple[TeslaFleetSwitchEntityDescription, ...] = (
TeslaFleetSwitchEntityDescription(
key="climate_state_auto_seat_climate_right",
on_func=lambda api: api.remote_auto_seat_climate_request(
Seat.FRONT_RIGHT, True
AutoSeat.FRONT_RIGHT, True
),
off_func=lambda api: api.remote_auto_seat_climate_request(
Seat.FRONT_RIGHT, False
AutoSeat.FRONT_RIGHT, False
),
scopes=[Scope.VEHICLE_CMDS],
),

View File

@ -7,7 +7,7 @@ from dataclasses import dataclass
from itertools import chain
from typing import Any
from tesla_fleet_api.const import Scope
from tesla_fleet_api.const import AutoSeat, Scope
from teslemetry_stream import TeslemetryStreamVehicle
from homeassistant.components.switch import (
@ -62,15 +62,23 @@ VEHICLE_DESCRIPTIONS: tuple[TeslemetrySwitchEntityDescription, ...] = (
TeslemetrySwitchEntityDescription(
key="climate_state_auto_seat_climate_left",
streaming_listener=lambda x, y: x.listen_AutoSeatClimateLeft(y),
on_func=lambda api: api.remote_auto_seat_climate_request(1, True),
off_func=lambda api: api.remote_auto_seat_climate_request(1, False),
on_func=lambda api: api.remote_auto_seat_climate_request(
AutoSeat.FRONT_LEFT, True
),
off_func=lambda api: api.remote_auto_seat_climate_request(
AutoSeat.FRONT_LEFT, False
),
scopes=[Scope.VEHICLE_CMDS],
),
TeslemetrySwitchEntityDescription(
key="climate_state_auto_seat_climate_right",
streaming_listener=lambda x, y: x.listen_AutoSeatClimateRight(y),
on_func=lambda api: api.remote_auto_seat_climate_request(2, True),
off_func=lambda api: api.remote_auto_seat_climate_request(2, False),
on_func=lambda api: api.remote_auto_seat_climate_request(
AutoSeat.FRONT_RIGHT, True
),
off_func=lambda api: api.remote_auto_seat_climate_request(
AutoSeat.FRONT_RIGHT, False
),
scopes=[Scope.VEHICLE_CMDS],
),
TeslemetrySwitchEntityDescription(