mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Add ability to control ventilated seats with Tessie integration (#121624)
This commit is contained in:
parent
417abda649
commit
90af40b5c4
@ -38,6 +38,15 @@ class TessieSeatHeaterOptions(StrEnum):
|
||||
HIGH = "high"
|
||||
|
||||
|
||||
class TessieSeatCoolerOptions(StrEnum):
|
||||
"""Tessie seat cooler options."""
|
||||
|
||||
OFF = "off"
|
||||
LOW = "low"
|
||||
MEDIUM = "medium"
|
||||
HIGH = "high"
|
||||
|
||||
|
||||
class TessieClimateKeeper(StrEnum):
|
||||
"""Tessie Climate Keeper Modes."""
|
||||
|
||||
|
@ -6,5 +6,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/tessie",
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["tessie"],
|
||||
"requirements": ["tessie-api==0.0.9", "tesla-fleet-api==0.6.2"]
|
||||
"requirements": ["tessie-api==0.1.1", "tesla-fleet-api==0.6.2"]
|
||||
}
|
||||
|
@ -5,14 +5,14 @@ from __future__ import annotations
|
||||
from itertools import chain
|
||||
|
||||
from tesla_fleet_api.const import EnergyExportMode, EnergyOperationMode
|
||||
from tessie_api import set_seat_heat
|
||||
from tessie_api import set_seat_cool, set_seat_heat
|
||||
|
||||
from homeassistant.components.select import SelectEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import TessieConfigEntry
|
||||
from .const import TessieSeatHeaterOptions
|
||||
from .const import TessieSeatCoolerOptions, TessieSeatHeaterOptions
|
||||
from .entity import TessieEnergyEntity, TessieEntity
|
||||
from .helpers import handle_command
|
||||
from .models import TessieEnergyData
|
||||
@ -27,6 +27,11 @@ SEAT_HEATERS = {
|
||||
"climate_state_seat_heater_third_row_right": "third_row_right",
|
||||
}
|
||||
|
||||
SEAT_COOLERS = {
|
||||
"climate_state_seat_fan_front_left": "front_left",
|
||||
"climate_state_seat_fan_front_right": "front_right",
|
||||
}
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
@ -44,6 +49,13 @@ async def async_setup_entry(
|
||||
if key
|
||||
in vehicle.data_coordinator.data # not all vehicles have rear center or third row
|
||||
),
|
||||
(
|
||||
TessieSeatCoolerSelectEntity(vehicle, key)
|
||||
for vehicle in entry.runtime_data.vehicles
|
||||
for key in SEAT_COOLERS
|
||||
if key
|
||||
in vehicle.data_coordinator.data # not all vehicles have ventilated seats
|
||||
),
|
||||
(
|
||||
TessieOperationSelectEntity(energysite)
|
||||
for energysite in entry.runtime_data.energysites
|
||||
@ -81,6 +93,28 @@ class TessieSeatHeaterSelectEntity(TessieEntity, SelectEntity):
|
||||
self.set((self.key, level))
|
||||
|
||||
|
||||
class TessieSeatCoolerSelectEntity(TessieEntity, SelectEntity):
|
||||
"""Select entity for cooled seat."""
|
||||
|
||||
_attr_options = [
|
||||
TessieSeatCoolerOptions.OFF,
|
||||
TessieSeatCoolerOptions.LOW,
|
||||
TessieSeatCoolerOptions.MEDIUM,
|
||||
TessieSeatCoolerOptions.HIGH,
|
||||
]
|
||||
|
||||
@property
|
||||
def current_option(self) -> str | None:
|
||||
"""Return the current selected option."""
|
||||
return self._attr_options[self._value]
|
||||
|
||||
async def async_select_option(self, option: str) -> None:
|
||||
"""Change the selected option."""
|
||||
level = self._attr_options.index(option)
|
||||
await self.run(set_seat_cool, seat=SEAT_COOLERS[self.key], level=level)
|
||||
self.set((self.key, level))
|
||||
|
||||
|
||||
class TessieOperationSelectEntity(TessieEnergyEntity, SelectEntity):
|
||||
"""Select entity for operation mode select entities."""
|
||||
|
||||
|
@ -301,6 +301,24 @@
|
||||
"high": "[%key:component::tessie::entity::select::climate_state_seat_heater_left::state::high%]"
|
||||
}
|
||||
},
|
||||
"climate_state_seat_fan_front_left": {
|
||||
"name": "Seat cooler left",
|
||||
"state": {
|
||||
"off": "[%key:common::state::off%]",
|
||||
"low": "[%key:component::tessie::entity::select::climate_state_seat_heater_left::state::low%]",
|
||||
"medium": "[%key:component::tessie::entity::select::climate_state_seat_heater_left::state::medium%]",
|
||||
"high": "[%key:component::tessie::entity::select::climate_state_seat_heater_left::state::high%]"
|
||||
}
|
||||
},
|
||||
"climate_state_seat_fan_front_right": {
|
||||
"name": "Seat cooler right",
|
||||
"state": {
|
||||
"off": "[%key:common::state::off%]",
|
||||
"low": "[%key:component::tessie::entity::select::climate_state_seat_heater_left::state::low%]",
|
||||
"medium": "[%key:component::tessie::entity::select::climate_state_seat_heater_left::state::medium%]",
|
||||
"high": "[%key:component::tessie::entity::select::climate_state_seat_heater_left::state::high%]"
|
||||
}
|
||||
},
|
||||
"components_customer_preferred_export_rule": {
|
||||
"name": "Allow export",
|
||||
"state": {
|
||||
|
@ -2728,7 +2728,7 @@ tesla-powerwall==0.5.2
|
||||
tesla-wall-connector==1.0.2
|
||||
|
||||
# homeassistant.components.tessie
|
||||
tessie-api==0.0.9
|
||||
tessie-api==0.1.1
|
||||
|
||||
# homeassistant.components.tensorflow
|
||||
# tf-models-official==2.5.0
|
||||
|
@ -2126,7 +2126,7 @@ tesla-powerwall==0.5.2
|
||||
tesla-wall-connector==1.0.2
|
||||
|
||||
# homeassistant.components.tessie
|
||||
tessie-api==0.0.9
|
||||
tessie-api==0.1.1
|
||||
|
||||
# homeassistant.components.thermobeacon
|
||||
thermobeacon-ble==0.7.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user