Migrate Home plus control to has entity name (#96596)
This commit is contained in:
parent
8d048c4cfa
commit
9b29cbd71c
1 changed files with 4 additions and 6 deletions
|
@ -66,17 +66,15 @@ class HomeControlSwitchEntity(CoordinatorEntity, SwitchEntity):
|
||||||
consumption methods and state attributes.
|
consumption methods and state attributes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, coordinator, idx):
|
def __init__(self, coordinator, idx):
|
||||||
"""Pass coordinator to CoordinatorEntity."""
|
"""Pass coordinator to CoordinatorEntity."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self.idx = idx
|
self.idx = idx
|
||||||
self.module = self.coordinator.data[self.idx]
|
self.module = self.coordinator.data[self.idx]
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Name of the device."""
|
|
||||||
return self.module.name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""ID (unique) of the device."""
|
"""ID (unique) of the device."""
|
||||||
|
@ -92,7 +90,7 @@ class HomeControlSwitchEntity(CoordinatorEntity, SwitchEntity):
|
||||||
},
|
},
|
||||||
manufacturer="Legrand",
|
manufacturer="Legrand",
|
||||||
model=HW_TYPE.get(self.module.hw_type),
|
model=HW_TYPE.get(self.module.hw_type),
|
||||||
name=self.name,
|
name=self.module.name,
|
||||||
sw_version=self.module.fw,
|
sw_version=self.module.fw,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue