Set has_entity_name in freedompro (#94603)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
c48afebbfc
commit
fa9c31d3db
8 changed files with 31 additions and 16 deletions
|
@ -54,12 +54,14 @@ async def async_setup_entry(
|
|||
class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], SensorEntity):
|
||||
"""Representation of an Freedompro sensor."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = None
|
||||
|
||||
def __init__(
|
||||
self, device: dict[str, Any], coordinator: FreedomproDataUpdateCoordinator
|
||||
) -> None:
|
||||
"""Initialize the Freedompro sensor."""
|
||||
super().__init__(coordinator)
|
||||
self._attr_name = device["name"]
|
||||
self._attr_unique_id = device["uid"]
|
||||
self._type = device["type"]
|
||||
self._attr_device_info = DeviceInfo(
|
||||
|
@ -68,7 +70,7 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], SensorEntity):
|
|||
},
|
||||
manufacturer="Freedompro",
|
||||
model=device["type"],
|
||||
name=self.name,
|
||||
name=device["name"],
|
||||
)
|
||||
self._attr_device_class = DEVICE_CLASS_MAP[device["type"]]
|
||||
self._attr_state_class = STATE_CLASS_MAP[device["type"]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue