Set has_entity_name in freedompro (#94603)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Erik Montnemery 2023-06-14 21:42:51 +02:00 committed by GitHub
parent c48afebbfc
commit fa9c31d3db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 16 deletions

View file

@ -46,12 +46,14 @@ async def async_setup_entry(
class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], BinarySensorEntity):
"""Representation of an Freedompro binary_sensor."""
_attr_has_entity_name = True
_attr_name = None
def __init__(
self, device: dict[str, Any], coordinator: FreedomproDataUpdateCoordinator
) -> None:
"""Initialize the Freedompro binary_sensor."""
super().__init__(coordinator)
self._attr_name = device["name"]
self._attr_unique_id = device["uid"]
self._type = device["type"]
self._attr_device_info = DeviceInfo(
@ -60,7 +62,7 @@ class Device(CoordinatorEntity[FreedomproDataUpdateCoordinator], BinarySensorEnt
},
manufacturer="Freedompro",
model=device["type"],
name=self.name,
name=device["name"],
)
self._attr_device_class = DEVICE_CLASS_MAP[device["type"]]