Migrate MyStrom to has entity name (#96540)

pull/96872/head
Joost Lekkerkerker 2023-07-18 20:53:37 +02:00 committed by GitHub
parent 0ff8371953
commit 1ceb536dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -83,6 +83,8 @@ async def async_setup_platform(
class MyStromLight(LightEntity):
"""Representation of the myStrom WiFi bulb."""
_attr_has_entity_name = True
_attr_name = None
_attr_color_mode = ColorMode.HS
_attr_supported_color_modes = {ColorMode.HS}
_attr_supported_features = LightEntityFeature.EFFECT | LightEntityFeature.FLASH
@ -91,7 +93,6 @@ class MyStromLight(LightEntity):
def __init__(self, bulb, name, mac):
"""Initialize the light."""
self._bulb = bulb
self._attr_name = name
self._attr_available = False
self._attr_unique_id = mac
self._attr_hs_color = 0, 0

View File

@ -70,10 +70,12 @@ async def async_setup_platform(
class MyStromSwitch(SwitchEntity):
"""Representation of a myStrom switch/plug."""
_attr_has_entity_name = True
_attr_name = None
def __init__(self, plug, name):
"""Initialize the myStrom switch/plug."""
self.plug = plug
self._attr_name = name
self._attr_unique_id = self.plug.mac
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, self.plug.mac)},