diff --git a/custom_components/battery_notes/sensor.py b/custom_components/battery_notes/sensor.py index c7f78b5ef..04167af4e 100644 --- a/custom_components/battery_notes/sensor.py +++ b/custom_components/battery_notes/sensor.py @@ -69,6 +69,7 @@ ATTR_BATTERY_LAST_REPORTED, ATTR_BATTERY_LAST_REPORTED_LEVEL, ATTR_DEVICE_ID, + ATTR_DEVICE_NAME, ) from .common import isfloat @@ -492,6 +493,7 @@ def extra_state_attributes(self) -> dict[str, str] | None: # Other attributes that should follow battery, attribute list is unsorted attrs[ATTR_DEVICE_ID] = self.coordinator.device_id + attrs[ATTR_DEVICE_NAME] = self.coordinator.device_name super_attrs = super().extra_state_attributes if super_attrs: diff --git a/docs/entities.md b/docs/entities.md index e110a8814..d67036de7 100644 --- a/docs/entities.md +++ b/docs/entities.md @@ -22,6 +22,7 @@ See how to use this entity in the [community contributions](./community.md) | `battery_last_reported` | `datetime` | The datetime when the battery level was last reported | | `battery_last_reported_level` | `float` | The level when the battery was last reported | | `device_id` | `string` | The device_id of the device | +| `device_name` | `string` | The name of the device | ## Battery Type `sensor.{{device_name}}_battery_type`