mirror of
https://github.com/home-assistant/core.git
synced 2025-08-06 14:15:12 +02:00
airzone: select: make options translatable
This was a late comment when the select platform was introduced. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
@@ -41,14 +41,14 @@ class AirzoneSelectDescription(SelectEntityDescription, AirzoneSelectDescription
|
|||||||
|
|
||||||
|
|
||||||
GRILLE_ANGLE_DICT: Final[dict[str, int]] = {
|
GRILLE_ANGLE_DICT: Final[dict[str, int]] = {
|
||||||
"90º": GrilleAngle.DEG_90,
|
"90deg": GrilleAngle.DEG_90,
|
||||||
"50º": GrilleAngle.DEG_50,
|
"50deg": GrilleAngle.DEG_50,
|
||||||
"45º": GrilleAngle.DEG_45,
|
"45deg": GrilleAngle.DEG_45,
|
||||||
"40º": GrilleAngle.DEG_40,
|
"40deg": GrilleAngle.DEG_40,
|
||||||
}
|
}
|
||||||
|
|
||||||
SLEEP_DICT: Final[dict[str, int]] = {
|
SLEEP_DICT: Final[dict[str, int]] = {
|
||||||
"Off": SleepTimeout.SLEEP_OFF,
|
"off": SleepTimeout.SLEEP_OFF,
|
||||||
"30m": SleepTimeout.SLEEP_30,
|
"30m": SleepTimeout.SLEEP_30,
|
||||||
"60m": SleepTimeout.SLEEP_60,
|
"60m": SleepTimeout.SLEEP_60,
|
||||||
"90m": SleepTimeout.SLEEP_90,
|
"90m": SleepTimeout.SLEEP_90,
|
||||||
@@ -62,6 +62,7 @@ ZONE_SELECT_TYPES: Final[tuple[AirzoneSelectDescription, ...]] = (
|
|||||||
key=AZD_COLD_ANGLE,
|
key=AZD_COLD_ANGLE,
|
||||||
name="Cold Angle",
|
name="Cold Angle",
|
||||||
options_dict=GRILLE_ANGLE_DICT,
|
options_dict=GRILLE_ANGLE_DICT,
|
||||||
|
translation_key="grille_angles",
|
||||||
),
|
),
|
||||||
AirzoneSelectDescription(
|
AirzoneSelectDescription(
|
||||||
api_param=API_HEAT_ANGLE,
|
api_param=API_HEAT_ANGLE,
|
||||||
@@ -69,6 +70,7 @@ ZONE_SELECT_TYPES: Final[tuple[AirzoneSelectDescription, ...]] = (
|
|||||||
key=AZD_HEAT_ANGLE,
|
key=AZD_HEAT_ANGLE,
|
||||||
name="Heat Angle",
|
name="Heat Angle",
|
||||||
options_dict=GRILLE_ANGLE_DICT,
|
options_dict=GRILLE_ANGLE_DICT,
|
||||||
|
translation_key="grille_angles",
|
||||||
),
|
),
|
||||||
AirzoneSelectDescription(
|
AirzoneSelectDescription(
|
||||||
api_param=API_SLEEP,
|
api_param=API_SLEEP,
|
||||||
@@ -76,6 +78,7 @@ ZONE_SELECT_TYPES: Final[tuple[AirzoneSelectDescription, ...]] = (
|
|||||||
key=AZD_SLEEP,
|
key=AZD_SLEEP,
|
||||||
name="Sleep",
|
name="Sleep",
|
||||||
options_dict=SLEEP_DICT,
|
options_dict=SLEEP_DICT,
|
||||||
|
translation_key="sleep_times",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,49 +25,49 @@ async def test_airzone_create_selects(hass: HomeAssistant) -> None:
|
|||||||
await async_init_integration(hass)
|
await async_init_integration(hass)
|
||||||
|
|
||||||
state = hass.states.get("select.despacho_cold_angle")
|
state = hass.states.get("select.despacho_cold_angle")
|
||||||
assert state.state == "90º"
|
assert state.state == "90deg"
|
||||||
|
|
||||||
state = hass.states.get("select.despacho_heat_angle")
|
state = hass.states.get("select.despacho_heat_angle")
|
||||||
assert state.state == "90º"
|
assert state.state == "90deg"
|
||||||
|
|
||||||
state = hass.states.get("select.despacho_sleep")
|
state = hass.states.get("select.despacho_sleep")
|
||||||
assert state.state == "Off"
|
assert state.state == "off"
|
||||||
|
|
||||||
state = hass.states.get("select.dorm_1_cold_angle")
|
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")
|
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")
|
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")
|
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")
|
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")
|
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")
|
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")
|
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")
|
state = hass.states.get("select.dorm_ppal_sleep")
|
||||||
assert state.state == "30m"
|
assert state.state == "30m"
|
||||||
|
|
||||||
state = hass.states.get("select.salon_cold_angle")
|
state = hass.states.get("select.salon_cold_angle")
|
||||||
assert state.state == "90º"
|
assert state.state == "90deg"
|
||||||
|
|
||||||
state = hass.states.get("select.salon_heat_angle")
|
state = hass.states.get("select.salon_heat_angle")
|
||||||
assert state.state == "90º"
|
assert state.state == "90deg"
|
||||||
|
|
||||||
state = hass.states.get("select.salon_sleep")
|
state = hass.states.get("select.salon_sleep")
|
||||||
assert state.state == "Off"
|
assert state.state == "off"
|
||||||
|
|
||||||
|
|
||||||
async def test_airzone_select_sleep(hass: HomeAssistant) -> None:
|
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,
|
SERVICE_SELECT_OPTION,
|
||||||
{
|
{
|
||||||
ATTR_ENTITY_ID: "select.dorm_1_cold_angle",
|
ATTR_ENTITY_ID: "select.dorm_1_cold_angle",
|
||||||
ATTR_OPTION: "50º",
|
ATTR_OPTION: "50deg",
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = hass.states.get("select.dorm_1_cold_angle")
|
state = hass.states.get("select.dorm_1_cold_angle")
|
||||||
assert state.state == "50º"
|
assert state.state == "50deg"
|
||||||
|
|
||||||
# Heat Angle
|
# Heat Angle
|
||||||
|
|
||||||
@@ -168,10 +168,10 @@ async def test_airzone_select_grille_angle(hass: HomeAssistant) -> None:
|
|||||||
SERVICE_SELECT_OPTION,
|
SERVICE_SELECT_OPTION,
|
||||||
{
|
{
|
||||||
ATTR_ENTITY_ID: "select.dorm_1_heat_angle",
|
ATTR_ENTITY_ID: "select.dorm_1_heat_angle",
|
||||||
ATTR_OPTION: "45º",
|
ATTR_OPTION: "45deg",
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = hass.states.get("select.dorm_1_heat_angle")
|
state = hass.states.get("select.dorm_1_heat_angle")
|
||||||
assert state.state == "45º"
|
assert state.state == "45deg"
|
||||||
|
Reference in New Issue
Block a user