diff --git a/homeassistant/components/airzone/select.py b/homeassistant/components/airzone/select.py index 023015121d7..1a0d577bb35 100644 --- a/homeassistant/components/airzone/select.py +++ b/homeassistant/components/airzone/select.py @@ -1,7 +1,7 @@ """Support for the Airzone sensors.""" from __future__ import annotations -from dataclasses import dataclass, replace +from dataclasses import dataclass from typing import Any, Final from aioairzone.common import GrilleAngle, SleepTimeout @@ -41,14 +41,14 @@ class AirzoneSelectDescription(SelectEntityDescription, AirzoneSelectDescription GRILLE_ANGLE_DICT: Final[dict[str, int]] = { - "90º": GrilleAngle.DEG_90, - "50º": GrilleAngle.DEG_50, - "45º": GrilleAngle.DEG_45, - "40º": GrilleAngle.DEG_40, + "90deg": GrilleAngle.DEG_90, + "50deg": GrilleAngle.DEG_50, + "45deg": GrilleAngle.DEG_45, + "40deg": GrilleAngle.DEG_40, } SLEEP_DICT: Final[dict[str, int]] = { - "Off": SleepTimeout.SLEEP_OFF, + "off": SleepTimeout.SLEEP_OFF, "30m": SleepTimeout.SLEEP_30, "60m": SleepTimeout.SLEEP_60, "90m": SleepTimeout.SLEEP_90, @@ -61,21 +61,27 @@ ZONE_SELECT_TYPES: Final[tuple[AirzoneSelectDescription, ...]] = ( entity_category=EntityCategory.CONFIG, key=AZD_COLD_ANGLE, name="Cold Angle", + options=list(GRILLE_ANGLE_DICT), options_dict=GRILLE_ANGLE_DICT, + translation_key="grille_angles", ), AirzoneSelectDescription( api_param=API_HEAT_ANGLE, entity_category=EntityCategory.CONFIG, key=AZD_HEAT_ANGLE, name="Heat Angle", + options=list(GRILLE_ANGLE_DICT), options_dict=GRILLE_ANGLE_DICT, + translation_key="grille_angles", ), AirzoneSelectDescription( api_param=API_SLEEP, entity_category=EntityCategory.CONFIG, key=AZD_SLEEP, name="Sleep", + options=list(SLEEP_DICT), options_dict=SLEEP_DICT, + translation_key="sleep_times", ), ) @@ -91,14 +97,10 @@ async def async_setup_entry( for system_zone_id, zone_data in coordinator.data[AZD_ZONES].items(): for description in ZONE_SELECT_TYPES: if description.key in zone_data: - _desc = replace( - description, - options=list(description.options_dict.keys()), - ) entities.append( AirzoneZoneSelect( coordinator, - _desc, + description, entry, system_zone_id, zone_data, diff --git a/homeassistant/components/airzone/strings.json b/homeassistant/components/airzone/strings.json index 306e63da36c..037ebe52d78 100644 --- a/homeassistant/components/airzone/strings.json +++ b/homeassistant/components/airzone/strings.json @@ -23,5 +23,25 @@ } } } + }, + "entity": { + "select": { + "grille_angles": { + "state": { + "90deg": "90°", + "50deg": "50°", + "45deg": "45°", + "40deg": "40°" + } + }, + "sleep_times": { + "state": { + "off": "[%key:common::state::off%]", + "30m": "30 minutes", + "60m": "60 minutes", + "90m": "90 minutes" + } + } + } } } diff --git a/tests/components/airzone/test_select.py b/tests/components/airzone/test_select.py index 545a45508de..c7c32022123 100644 --- a/tests/components/airzone/test_select.py +++ b/tests/components/airzone/test_select.py @@ -25,49 +25,49 @@ async def test_airzone_create_selects(hass: HomeAssistant) -> None: await async_init_integration(hass) state = hass.states.get("select.despacho_cold_angle") - assert state.state == "90º" + assert state.state == "90deg" state = hass.states.get("select.despacho_heat_angle") - assert state.state == "90º" + assert state.state == "90deg" state = hass.states.get("select.despacho_sleep") - assert state.state == "Off" + assert state.state == "off" state = hass.states.get("select.dorm_1_cold_angle") - assert state.state == "90º" + assert state.state == "90deg" state = hass.states.get("select.dorm_1_heat_angle") - assert state.state == "90º" + assert state.state == "90deg" state = hass.states.get("select.dorm_1_sleep") - assert state.state == "Off" + assert state.state == "off" state = hass.states.get("select.dorm_2_cold_angle") - assert state.state == "90º" + assert state.state == "90deg" state = hass.states.get("select.dorm_2_heat_angle") - assert state.state == "90º" + assert state.state == "90deg" state = hass.states.get("select.dorm_2_sleep") - assert state.state == "Off" + assert state.state == "off" state = hass.states.get("select.dorm_ppal_cold_angle") - assert state.state == "45º" + assert state.state == "45deg" state = hass.states.get("select.dorm_ppal_heat_angle") - assert state.state == "50º" + assert state.state == "50deg" state = hass.states.get("select.dorm_ppal_sleep") assert state.state == "30m" state = hass.states.get("select.salon_cold_angle") - assert state.state == "90º" + assert state.state == "90deg" state = hass.states.get("select.salon_heat_angle") - assert state.state == "90º" + assert state.state == "90deg" state = hass.states.get("select.salon_sleep") - assert state.state == "Off" + assert state.state == "off" async def test_airzone_select_sleep(hass: HomeAssistant) -> None: @@ -140,13 +140,13 @@ async def test_airzone_select_grille_angle(hass: HomeAssistant) -> None: SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.dorm_1_cold_angle", - ATTR_OPTION: "50º", + ATTR_OPTION: "50deg", }, blocking=True, ) state = hass.states.get("select.dorm_1_cold_angle") - assert state.state == "50º" + assert state.state == "50deg" # Heat Angle @@ -168,10 +168,10 @@ async def test_airzone_select_grille_angle(hass: HomeAssistant) -> None: SERVICE_SELECT_OPTION, { ATTR_ENTITY_ID: "select.dorm_1_heat_angle", - ATTR_OPTION: "45º", + ATTR_OPTION: "45deg", }, blocking=True, ) state = hass.states.get("select.dorm_1_heat_angle") - assert state.state == "45º" + assert state.state == "45deg"