From a80862f3db772102e35699442d0b2b9aaba21a1f Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 27 Jun 2023 12:38:32 +0200 Subject: [PATCH] Add entity translations to Fjaraskupan (#95341) --- .../components/fjaraskupan/binary_sensor.py | 4 ++-- homeassistant/components/fjaraskupan/fan.py | 1 + homeassistant/components/fjaraskupan/light.py | 1 + homeassistant/components/fjaraskupan/number.py | 2 +- homeassistant/components/fjaraskupan/sensor.py | 11 +++++------ homeassistant/components/fjaraskupan/strings.json | 15 +++++++++++++++ 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/fjaraskupan/binary_sensor.py b/homeassistant/components/fjaraskupan/binary_sensor.py index 0ea5c1669db..407bf663f70 100644 --- a/homeassistant/components/fjaraskupan/binary_sensor.py +++ b/homeassistant/components/fjaraskupan/binary_sensor.py @@ -30,13 +30,13 @@ class EntityDescription(BinarySensorEntityDescription): SENSORS = ( EntityDescription( key="grease-filter", - name="Grease filter", + translation_key="grease_filter", device_class=BinarySensorDeviceClass.PROBLEM, is_on=lambda state: state.grease_filter_full, ), EntityDescription( key="carbon-filter", - name="Carbon filter", + translation_key="carbon_filter", device_class=BinarySensorDeviceClass.PROBLEM, is_on=lambda state: state.carbon_filter_full, ), diff --git a/homeassistant/components/fjaraskupan/fan.py b/homeassistant/components/fjaraskupan/fan.py index c856a94fa07..c78214ad429 100644 --- a/homeassistant/components/fjaraskupan/fan.py +++ b/homeassistant/components/fjaraskupan/fan.py @@ -65,6 +65,7 @@ class Fan(CoordinatorEntity[Coordinator], FanEntity): _attr_supported_features = FanEntityFeature.SET_SPEED | FanEntityFeature.PRESET_MODE _attr_has_entity_name = True + _attr_name = None def __init__( self, diff --git a/homeassistant/components/fjaraskupan/light.py b/homeassistant/components/fjaraskupan/light.py index b6028e017d4..48d8936b49b 100644 --- a/homeassistant/components/fjaraskupan/light.py +++ b/homeassistant/components/fjaraskupan/light.py @@ -32,6 +32,7 @@ class Light(CoordinatorEntity[Coordinator], LightEntity): """Light device.""" _attr_has_entity_name = True + _attr_name = None def __init__( self, diff --git a/homeassistant/components/fjaraskupan/number.py b/homeassistant/components/fjaraskupan/number.py index a7f9226b57a..0659aea9f14 100644 --- a/homeassistant/components/fjaraskupan/number.py +++ b/homeassistant/components/fjaraskupan/number.py @@ -37,6 +37,7 @@ class PeriodicVentingTime(CoordinatorEntity[Coordinator], NumberEntity): _attr_native_step: float = 1 _attr_entity_category = EntityCategory.CONFIG _attr_native_unit_of_measurement = UnitOfTime.MINUTES + _attr_translation_key = "periodic_venting" def __init__( self, @@ -47,7 +48,6 @@ class PeriodicVentingTime(CoordinatorEntity[Coordinator], NumberEntity): super().__init__(coordinator) self._attr_unique_id = f"{coordinator.device.address}-periodic-venting" self._attr_device_info = device_info - self._attr_name = "Periodic venting" @property def native_value(self) -> float | None: diff --git a/homeassistant/components/fjaraskupan/sensor.py b/homeassistant/components/fjaraskupan/sensor.py index e06790bf9ac..0ffcfa9798b 100644 --- a/homeassistant/components/fjaraskupan/sensor.py +++ b/homeassistant/components/fjaraskupan/sensor.py @@ -36,6 +36,11 @@ class RssiSensor(CoordinatorEntity[Coordinator], SensorEntity): """Sensor device.""" _attr_has_entity_name = True + _attr_device_class = SensorDeviceClass.SIGNAL_STRENGTH + _attr_state_class = SensorStateClass.MEASUREMENT + _attr_native_unit_of_measurement = SIGNAL_STRENGTH_DECIBELS_MILLIWATT + _attr_entity_registry_enabled_default = False + _attr_entity_category = EntityCategory.DIAGNOSTIC def __init__( self, @@ -47,12 +52,6 @@ class RssiSensor(CoordinatorEntity[Coordinator], SensorEntity): super().__init__(coordinator) self._attr_unique_id = f"{device.address}-signal-strength" self._attr_device_info = device_info - self._attr_name = "Signal strength" - self._attr_device_class = SensorDeviceClass.SIGNAL_STRENGTH - self._attr_state_class = SensorStateClass.MEASUREMENT - self._attr_native_unit_of_measurement = SIGNAL_STRENGTH_DECIBELS_MILLIWATT - self._attr_entity_registry_enabled_default = False - self._attr_entity_category = EntityCategory.DIAGNOSTIC @property def native_value(self) -> StateType: diff --git a/homeassistant/components/fjaraskupan/strings.json b/homeassistant/components/fjaraskupan/strings.json index c6d5edd02d4..d91cc47dea1 100644 --- a/homeassistant/components/fjaraskupan/strings.json +++ b/homeassistant/components/fjaraskupan/strings.json @@ -9,5 +9,20 @@ "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]", "no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]" } + }, + "entity": { + "binary_sensor": { + "grease_filter": { + "name": "Grease filter" + }, + "carbon_filter": { + "name": "Carbon filter" + } + }, + "number": { + "periodic_venting": { + "name": "Periodic venting" + } + } } }