Migrate HomeWizard to new entity naming style (#74958)
This commit is contained in:
parent
7283d1b7fb
commit
5fdae0fc5b
4 changed files with 50 additions and 66 deletions
|
@ -36,6 +36,8 @@ class HWEnergySwitchEntity(
|
|||
):
|
||||
"""Representation switchable entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: HWEnergyDeviceUpdateCoordinator,
|
||||
|
@ -65,9 +67,6 @@ class HWEnergyMainSwitchEntity(HWEnergySwitchEntity):
|
|||
"""Initialize the switch."""
|
||||
super().__init__(coordinator, entry, "power_on")
|
||||
|
||||
# Config attributes
|
||||
self._attr_name = f"{entry.title} Switch"
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch on."""
|
||||
await self.coordinator.api.state_set(power_on=True)
|
||||
|
@ -101,6 +100,7 @@ class HWEnergySwitchLockEntity(HWEnergySwitchEntity):
|
|||
It disables any method that can turn of the relay.
|
||||
"""
|
||||
|
||||
_attr_name = "Switch lock"
|
||||
_attr_device_class = SwitchDeviceClass.SWITCH
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
|
||||
|
@ -110,9 +110,6 @@ class HWEnergySwitchLockEntity(HWEnergySwitchEntity):
|
|||
"""Initialize the switch."""
|
||||
super().__init__(coordinator, entry, "switch_lock")
|
||||
|
||||
# Config attributes
|
||||
self._attr_name = f"{entry.title} Switch Lock"
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn switch-lock on."""
|
||||
await self.coordinator.api.state_set(switch_lock=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue