Add entity translations to Fjaraskupan (#95341)

This commit is contained in:
Joost Lekkerkerker 2023-06-27 12:38:32 +02:00 committed by GitHub
parent c225c46853
commit a80862f3db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 9 deletions

View File

@ -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,
),

View File

@ -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,

View File

@ -32,6 +32,7 @@ class Light(CoordinatorEntity[Coordinator], LightEntity):
"""Light device."""
_attr_has_entity_name = True
_attr_name = None
def __init__(
self,

View File

@ -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:

View File

@ -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:

View File

@ -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"
}
}
}
}