From 41de6879ea8c343c325401f3dff905ac8f766836 Mon Sep 17 00:00:00 2001 From: "B. van Wetten" Date: Sat, 9 Nov 2024 16:14:54 +0100 Subject: [PATCH] Updated entity attributes and attribute translations - Added `entity_registry_enabled_default` and `entity_category` attributes to binary and regular sensors. - Updated translation strings in German, English, French, and Dutch. --- custom_components/haefele_connect_mesh/binary_sensor.py | 3 +++ custom_components/haefele_connect_mesh/sensor.py | 3 +++ custom_components/haefele_connect_mesh/translations/de.json | 4 ++-- custom_components/haefele_connect_mesh/translations/en.json | 4 ++-- custom_components/haefele_connect_mesh/translations/fr.json | 2 +- custom_components/haefele_connect_mesh/translations/nl.json | 4 ++-- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/custom_components/haefele_connect_mesh/binary_sensor.py b/custom_components/haefele_connect_mesh/binary_sensor.py index 1f346fd..884e9a5 100644 --- a/custom_components/haefele_connect_mesh/binary_sensor.py +++ b/custom_components/haefele_connect_mesh/binary_sensor.py @@ -13,6 +13,7 @@ from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity +from homeassistant.const import EntityCategory from .const import DOMAIN from .coordinator import HafeleUpdateCoordinator @@ -58,6 +59,8 @@ def __init__( self._attr_unique_id = f"{device.id}_last_update_success" self._attr_has_entity_name = True self._attr_device_class = BinarySensorDeviceClass.CONNECTIVITY + self._attr_entity_registry_enabled_default = False + self._attr_entity_category = EntityCategory.DIAGNOSTIC async def _handle_coordinator_update(self) -> None: """Handle updated data from the coordinator.""" diff --git a/custom_components/haefele_connect_mesh/sensor.py b/custom_components/haefele_connect_mesh/sensor.py index 70e5cd4..41252b0 100644 --- a/custom_components/haefele_connect_mesh/sensor.py +++ b/custom_components/haefele_connect_mesh/sensor.py @@ -14,6 +14,7 @@ from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity +from homeassistant.const import EntityCategory from .const import DOMAIN from .coordinator import HafeleUpdateCoordinator @@ -49,6 +50,8 @@ class HaefeleLastUpdateSensor(CoordinatorEntity, SensorEntity): _attr_has_entity_name = True _attr_device_class = SensorDeviceClass.TIMESTAMP _attr_translation_key = "last_update" + _attr_entity_registry_enabled_default = False + _attr_entity_category = EntityCategory.DIAGNOSTIC def __init__( self, diff --git a/custom_components/haefele_connect_mesh/translations/de.json b/custom_components/haefele_connect_mesh/translations/de.json index 134c538..171fe83 100644 --- a/custom_components/haefele_connect_mesh/translations/de.json +++ b/custom_components/haefele_connect_mesh/translations/de.json @@ -26,7 +26,7 @@ "entity": { "binary_sensor": { "last_update_success": { - "name": "Letztes Update", + "name": "Aktuellster Aktualisierungsstatus", "state": { "on": "Erfolgreich", "off": "Fehlgeschlagen" @@ -35,7 +35,7 @@ }, "sensor": { "last_update": { - "name": "Letztes Update" + "name": "Aktuellste Aktualisierung" } } } diff --git a/custom_components/haefele_connect_mesh/translations/en.json b/custom_components/haefele_connect_mesh/translations/en.json index 25d5e48..230f4c2 100644 --- a/custom_components/haefele_connect_mesh/translations/en.json +++ b/custom_components/haefele_connect_mesh/translations/en.json @@ -26,7 +26,7 @@ "entity": { "binary_sensor": { "last_update_success": { - "name": "Last update", + "name": "Most recent update status", "state": { "on": "Success", "off": "Failed" @@ -35,7 +35,7 @@ }, "sensor": { "last_update": { - "name": "Last update" + "name": "Most recent update" } } } diff --git a/custom_components/haefele_connect_mesh/translations/fr.json b/custom_components/haefele_connect_mesh/translations/fr.json index d077f3f..21d2e99 100644 --- a/custom_components/haefele_connect_mesh/translations/fr.json +++ b/custom_components/haefele_connect_mesh/translations/fr.json @@ -26,7 +26,7 @@ "entity": { "binary_sensor": { "last_update_success": { - "name": "Dernière mise à jour", + "name": "Statut de la mise à jour la plus récente", "state": { "on": "Réussie", "off": "Échouée" diff --git a/custom_components/haefele_connect_mesh/translations/nl.json b/custom_components/haefele_connect_mesh/translations/nl.json index f00c65a..133ad08 100644 --- a/custom_components/haefele_connect_mesh/translations/nl.json +++ b/custom_components/haefele_connect_mesh/translations/nl.json @@ -26,7 +26,7 @@ "entity": { "binary_sensor": { "last_update_success": { - "name": "Laatste update", + "name": "Meest recente update status", "state": { "on": "Geslaagd", "off": "Mislukt" @@ -35,7 +35,7 @@ }, "sensor": { "last_update": { - "name": "Laatste update" + "name": "Meest recente update" } } }