Default naming for sensors

This commit is contained in:
Mark Hannon
2025-05-13 21:31:13 +00:00
parent eaf19b63c5
commit a6059ad0c9
2 changed files with 6 additions and 3 deletions

View File

@@ -21,7 +21,9 @@ class ZimiEntity(Entity):
_attr_should_poll = False
_attr_has_entity_name = True
def __init__(self, device: ControlPointDevice, api: ControlPoint) -> None:
def __init__(
self, device: ControlPointDevice, api: ControlPoint, use_device_name=True
) -> None:
"""Initialize an HA Entity which is a ZimiDevice."""
self._device = device
@@ -36,7 +38,8 @@ class ZimiEntity(Entity):
suggested_area=device.room,
via_device=(DOMAIN, api.mac),
)
self._attr_name = device.name.strip()
if use_device_name:
self._attr_name = device.name.strip()
self._attr_suggested_area = device.room
@property

View File

@@ -94,7 +94,7 @@ class ZimiSensor(ZimiEntity, SensorEntity):
) -> None:
"""Initialize an ZimiSensor with specified type."""
super().__init__(device, api)
super().__init__(device, api, use_device_name=False)
self.entity_description = description
self._attr_unique_id = device.identifier + "." + self.entity_description.key