Add entity translations to Nexia (#98803)

This commit is contained in:
Joost Lekkerkerker 2023-08-22 14:41:15 +02:00 committed by GitHub
parent 09efd1c972
commit 097c7fbfef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 90 additions and 45 deletions

View file

@ -31,21 +31,20 @@ class NexiaEntity(CoordinatorEntity[NexiaDataUpdateCoordinator]):
_attr_attribution = ATTRIBUTION
def __init__(
self, coordinator: NexiaDataUpdateCoordinator, name: str, unique_id: str
) -> None:
def __init__(self, coordinator: NexiaDataUpdateCoordinator, unique_id: str) -> None:
"""Initialize the entity."""
super().__init__(coordinator)
self._attr_unique_id = unique_id
self._attr_name = name
class NexiaThermostatEntity(NexiaEntity):
"""Base class for nexia devices attached to a thermostat."""
def __init__(self, coordinator, thermostat, name, unique_id):
_attr_has_entity_name = True
def __init__(self, coordinator, thermostat, unique_id):
"""Initialize the entity."""
super().__init__(coordinator, name, unique_id)
super().__init__(coordinator, unique_id)
self._thermostat: NexiaThermostat = thermostat
self._attr_device_info = DeviceInfo(
configuration_url=self.coordinator.nexia_home.root_url,
@ -89,9 +88,9 @@ class NexiaThermostatEntity(NexiaEntity):
class NexiaThermostatZoneEntity(NexiaThermostatEntity):
"""Base class for nexia devices attached to a thermostat."""
def __init__(self, coordinator, zone, name, unique_id):
def __init__(self, coordinator, zone, unique_id):
"""Initialize the entity."""
super().__init__(coordinator, zone.thermostat, name, unique_id)
super().__init__(coordinator, zone.thermostat, unique_id)
self._zone: NexiaThermostatZone = zone
zone_name = self._zone.get_name()
self._attr_device_info |= {