Migrate Laundrify to has entity name (#96703)

This commit is contained in:
Joost Lekkerkerker 2023-07-17 09:11:02 +02:00 committed by GitHub
parent 13140830a0
commit 13ac8d00f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,6 +42,8 @@ class LaundrifyPowerPlug(
_attr_device_class = BinarySensorDeviceClass.RUNNING
_attr_icon = "mdi:washing-machine"
_attr_unique_id: str
_attr_has_entity_name = True
_attr_name = None
def __init__(
self, coordinator: LaundrifyUpdateCoordinator, device: LaundrifyDevice
@ -56,7 +58,7 @@ class LaundrifyPowerPlug(
"""Configure the Device of this Entity."""
return DeviceInfo(
identifiers={(DOMAIN, self._device["_id"])},
name=self.name,
name=self._device["name"],
manufacturer=MANUFACTURER,
model=MODEL,
sw_version=self._device["firmwareVersion"],
@ -70,11 +72,6 @@ class LaundrifyPowerPlug(
and self.coordinator.last_update_success
)
@property
def name(self) -> str:
"""Name of the entity."""
return self._device["name"]
@property
def is_on(self) -> bool:
"""Return entity state."""