Migrate Home plus control to has entity name (#96596)

pull/96818/head
Joost Lekkerkerker 2023-07-18 09:44:47 +02:00 committed by GitHub
parent 8d048c4cfa
commit 9b29cbd71c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -66,17 +66,15 @@ class HomeControlSwitchEntity(CoordinatorEntity, SwitchEntity):
consumption methods and state attributes.
"""
_attr_has_entity_name = True
_attr_name = None
def __init__(self, coordinator, idx):
"""Pass coordinator to CoordinatorEntity."""
super().__init__(coordinator)
self.idx = idx
self.module = self.coordinator.data[self.idx]
@property
def name(self):
"""Name of the device."""
return self.module.name
@property
def unique_id(self):
"""ID (unique) of the device."""
@ -92,7 +90,7 @@ class HomeControlSwitchEntity(CoordinatorEntity, SwitchEntity):
},
manufacturer="Legrand",
model=HW_TYPE.get(self.module.hw_type),
name=self.name,
name=self.module.name,
sw_version=self.module.fw,
)