mirror of
https://github.com/home-assistant/core.git
synced 2025-08-09 23:55:07 +02:00
Default naming for sensors
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user