Add entity translations to radiotherm (#96745)

pull/96764/head
Joost Lekkerkerker 2023-07-17 14:54:26 +02:00 committed by GitHub
parent 98e166f795
commit 34f1b2b71d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 2 deletions

View File

@ -105,11 +105,11 @@ class RadioThermostat(RadioThermostatEntity, ClimateEntity):
_attr_hvac_modes = OPERATION_LIST
_attr_temperature_unit = UnitOfTemperature.FAHRENHEIT
_attr_precision = PRECISION_HALVES
_attr_name = None
def __init__(self, coordinator: RadioThermUpdateCoordinator) -> None:
"""Initialize the thermostat."""
super().__init__(coordinator)
self._attr_name = self.init_data.name
self._attr_unique_id = self.init_data.mac
self._attr_fan_modes = CT30_FAN_OPERATION_LIST
self._attr_supported_features = (

View File

@ -14,6 +14,8 @@ from .data import RadioThermUpdate
class RadioThermostatEntity(CoordinatorEntity[RadioThermUpdateCoordinator]):
"""Base class for radiotherm entities."""
_attr_has_entity_name = True
def __init__(self, coordinator: RadioThermUpdateCoordinator) -> None:
"""Initialize the entity."""
super().__init__(coordinator)

View File

@ -27,5 +27,12 @@
}
}
}
},
"entity": {
"switch": {
"hold": {
"name": "Hold"
}
}
}
}

View File

@ -28,10 +28,11 @@ async def async_setup_entry(
class RadioThermHoldSwitch(RadioThermostatEntity, SwitchEntity):
"""Provides radiotherm hold switch support."""
_attr_translation_key = "hold"
def __init__(self, coordinator: RadioThermUpdateCoordinator) -> None:
"""Initialize the hold mode switch."""
super().__init__(coordinator)
self._attr_name = f"{coordinator.init_data.name} Hold"
self._attr_unique_id = f"{coordinator.init_data.mac}_hold"
@property