mirror of
https://github.com/home-assistant/core.git
synced 2026-12-04 12:50:45 -04:00
Use icon translations for the evohome controller and reset buttons (#194069)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cbf5957cc1
commit
378d4f308b
@@ -71,6 +71,7 @@ class EvoResetButtonBase(CoordinatorEntity[EvoLocationCoordinator], ButtonEntity
|
||||
class EvoSystemResetButton(EvoResetButtonBase):
|
||||
"""Button entity for system reset."""
|
||||
|
||||
_attr_translation_key = "reset_system_mode"
|
||||
_evo_device: evo.ControlSystem
|
||||
|
||||
@property
|
||||
@@ -83,6 +84,7 @@ class EvoSystemResetButton(EvoResetButtonBase):
|
||||
class EvoDhwResetButton(EvoResetButtonBase):
|
||||
"""Button entity for DHW override reset."""
|
||||
|
||||
_attr_translation_key = "clear_dhw_override"
|
||||
_evo_device: evo.HotWater
|
||||
|
||||
@property
|
||||
@@ -95,6 +97,7 @@ class EvoDhwResetButton(EvoResetButtonBase):
|
||||
class EvoZoneResetButton(EvoResetButtonBase):
|
||||
"""Button entity for zone override reset."""
|
||||
|
||||
_attr_translation_key = "clear_zone_override"
|
||||
_evo_device: evo.Zone
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -319,7 +319,7 @@ class EvoController(EvoClimateEntity):
|
||||
It is assumed there is only one TCS per location, and they are thus synonymous.
|
||||
"""
|
||||
|
||||
_attr_icon = "mdi:thermostat-box"
|
||||
_attr_translation_key = "controller"
|
||||
_attr_precision = PRECISION_TENTHS
|
||||
|
||||
_evo_device: evo.ControlSystem
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
"reset_system_mode": {
|
||||
"default": "mdi:thermostat-box-auto"
|
||||
}
|
||||
},
|
||||
"climate": {
|
||||
"controller": {
|
||||
"default": "mdi:thermostat-box"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
|
||||
@@ -844,7 +844,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: 'eco',
|
||||
@@ -883,7 +882,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: 'eco',
|
||||
@@ -1330,7 +1328,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: 'eco',
|
||||
@@ -1677,7 +1674,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: 'eco',
|
||||
@@ -1760,7 +1756,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
'status': dict({
|
||||
@@ -1836,7 +1831,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: None,
|
||||
@@ -2053,7 +2047,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: None,
|
||||
@@ -2222,7 +2215,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: None,
|
||||
@@ -2393,7 +2385,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: 'eco',
|
||||
@@ -2432,7 +2423,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: 'away',
|
||||
@@ -2570,7 +2560,6 @@
|
||||
<HVACMode.OFF: 'off'>,
|
||||
<HVACMode.HEAT: 'heat'>,
|
||||
]),
|
||||
<EntityStateAttribute.ICON: 'icon'>: 'mdi:thermostat-box',
|
||||
<ClimateEntityCapabilityAttribute.MAX_TEMP: 'max_temp'>: 35,
|
||||
<ClimateEntityCapabilityAttribute.MIN_TEMP: 'min_temp'>: 7,
|
||||
<ClimateEntityStateAttribute.PRESET_MODE: 'preset_mode'>: 'eco',
|
||||
|
||||
@@ -153,3 +153,26 @@ async def test_button_press_api_call_failed(
|
||||
)
|
||||
|
||||
assert exc_info.value.translation_key == "api_request_failed"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("install", ["default"])
|
||||
@pytest.mark.parametrize(
|
||||
("button_fixture", "translation_key"),
|
||||
[
|
||||
pytest.param("system_button_id", "reset_system_mode", id="system"),
|
||||
pytest.param("dhw_button_id", "clear_dhw_override", id="dhw"),
|
||||
pytest.param("zone_button_id", "clear_zone_override", id="zone"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("evohome")
|
||||
async def test_reset_button_translation_key(
|
||||
entity_registry: er.EntityRegistry,
|
||||
request: pytest.FixtureRequest,
|
||||
button_fixture: str,
|
||||
translation_key: str,
|
||||
) -> None:
|
||||
"""Test each reset button has the translation_key that its icon is keyed by."""
|
||||
|
||||
entry = entity_registry.async_get(request.getfixturevalue(button_fixture))
|
||||
assert entry is not None
|
||||
assert entry.translation_key == translation_key
|
||||
|
||||
@@ -21,6 +21,7 @@ from homeassistant.components.climate import (
|
||||
from homeassistant.const import TargetKey
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .conftest import setup_evohome
|
||||
from .const import TEST_INSTALLS
|
||||
@@ -491,3 +492,16 @@ async def test_zone_turn_on(
|
||||
)
|
||||
|
||||
mock_fcn.assert_awaited_once_with()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("install", ["default"])
|
||||
@pytest.mark.usefixtures("evohome")
|
||||
async def test_ctl_translation_key(
|
||||
entity_registry: er.EntityRegistry,
|
||||
ctl_id: str,
|
||||
) -> None:
|
||||
"""Test the controller has the translation_key that its icon is keyed by."""
|
||||
|
||||
entry = entity_registry.async_get(ctl_id)
|
||||
assert entry is not None
|
||||
assert entry.translation_key == "controller"
|
||||
|
||||
Reference in New Issue
Block a user