mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Migrate MyStrom to has entity name (#96540)
This commit is contained in:
parent
0ff8371953
commit
1ceb536dfb
@ -83,6 +83,8 @@ async def async_setup_platform(
|
|||||||
class MyStromLight(LightEntity):
|
class MyStromLight(LightEntity):
|
||||||
"""Representation of the myStrom WiFi bulb."""
|
"""Representation of the myStrom WiFi bulb."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
_attr_color_mode = ColorMode.HS
|
_attr_color_mode = ColorMode.HS
|
||||||
_attr_supported_color_modes = {ColorMode.HS}
|
_attr_supported_color_modes = {ColorMode.HS}
|
||||||
_attr_supported_features = LightEntityFeature.EFFECT | LightEntityFeature.FLASH
|
_attr_supported_features = LightEntityFeature.EFFECT | LightEntityFeature.FLASH
|
||||||
@ -91,7 +93,6 @@ class MyStromLight(LightEntity):
|
|||||||
def __init__(self, bulb, name, mac):
|
def __init__(self, bulb, name, mac):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
self._bulb = bulb
|
self._bulb = bulb
|
||||||
self._attr_name = name
|
|
||||||
self._attr_available = False
|
self._attr_available = False
|
||||||
self._attr_unique_id = mac
|
self._attr_unique_id = mac
|
||||||
self._attr_hs_color = 0, 0
|
self._attr_hs_color = 0, 0
|
||||||
|
@ -70,10 +70,12 @@ async def async_setup_platform(
|
|||||||
class MyStromSwitch(SwitchEntity):
|
class MyStromSwitch(SwitchEntity):
|
||||||
"""Representation of a myStrom switch/plug."""
|
"""Representation of a myStrom switch/plug."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, plug, name):
|
def __init__(self, plug, name):
|
||||||
"""Initialize the myStrom switch/plug."""
|
"""Initialize the myStrom switch/plug."""
|
||||||
self.plug = plug
|
self.plug = plug
|
||||||
self._attr_name = name
|
|
||||||
self._attr_unique_id = self.plug.mac
|
self._attr_unique_id = self.plug.mac
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(DOMAIN, self.plug.mac)},
|
identifiers={(DOMAIN, self.plug.mac)},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user