diff --git a/homeassistant/components/tessie/const.py b/homeassistant/components/tessie/const.py index bdb20193613..90862eff969 100644 --- a/homeassistant/components/tessie/const.py +++ b/homeassistant/components/tessie/const.py @@ -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.""" diff --git a/homeassistant/components/tessie/manifest.json b/homeassistant/components/tessie/manifest.json index 493feeaa77e..81d10eb4ef7 100644 --- a/homeassistant/components/tessie/manifest.json +++ b/homeassistant/components/tessie/manifest.json @@ -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"] } diff --git a/homeassistant/components/tessie/select.py b/homeassistant/components/tessie/select.py index 90e00084f15..1d02d07a741 100644 --- a/homeassistant/components/tessie/select.py +++ b/homeassistant/components/tessie/select.py @@ -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.""" diff --git a/homeassistant/components/tessie/strings.json b/homeassistant/components/tessie/strings.json index 72f72558792..873c8ba055e 100644 --- a/homeassistant/components/tessie/strings.json +++ b/homeassistant/components/tessie/strings.json @@ -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": { diff --git a/requirements_all.txt b/requirements_all.txt index 398508325ec..3f5b1b757c2 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index a71b2577321..1c4b384e902 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -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