Skip to content

Commit

Permalink
Updated entity attributes and attribute translations
Browse files Browse the repository at this point in the history
 - Added `entity_registry_enabled_default` and `entity_category` attributes to binary and regular sensors.
 - Updated translation strings in German, English, French, and Dutch.
  • Loading branch information
QNimbus committed Nov 11, 2024
1 parent 8568f7b commit 41de687
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions custom_components/haefele_connect_mesh/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."""
Expand Down
3 changes: 3 additions & 0 deletions custom_components/haefele_connect_mesh/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions custom_components/haefele_connect_mesh/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"entity": {
"binary_sensor": {
"last_update_success": {
"name": "Letztes Update",
"name": "Aktuellster Aktualisierungsstatus",
"state": {
"on": "Erfolgreich",
"off": "Fehlgeschlagen"
Expand All @@ -35,7 +35,7 @@
},
"sensor": {
"last_update": {
"name": "Letztes Update"
"name": "Aktuellste Aktualisierung"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions custom_components/haefele_connect_mesh/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"entity": {
"binary_sensor": {
"last_update_success": {
"name": "Last update",
"name": "Most recent update status",
"state": {
"on": "Success",
"off": "Failed"
Expand All @@ -35,7 +35,7 @@
},
"sensor": {
"last_update": {
"name": "Last update"
"name": "Most recent update"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions custom_components/haefele_connect_mesh/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"entity": {
"binary_sensor": {
"last_update_success": {
"name": "Laatste update",
"name": "Meest recente update status",
"state": {
"on": "Geslaagd",
"off": "Mislukt"
Expand All @@ -35,7 +35,7 @@
},
"sensor": {
"last_update": {
"name": "Laatste update"
"name": "Meest recente update"
}
}
}
Expand Down

0 comments on commit 41de687

Please sign in to comment.