mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Migrate elkm1 light to color_mode (#69179)
This commit is contained in:
parent
522a9bb6b1
commit
b38ca5ddd6
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
SUPPORT_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -30,6 +30,9 @@ async def async_setup_entry(
|
|||||||
class ElkLight(ElkEntity, LightEntity):
|
class ElkLight(ElkEntity, LightEntity):
|
||||||
"""Representation of an Elk lighting device."""
|
"""Representation of an Elk lighting device."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
|
||||||
def __init__(self, element, elk, elk_data):
|
def __init__(self, element, elk, elk_data):
|
||||||
"""Initialize the Elk light."""
|
"""Initialize the Elk light."""
|
||||||
super().__init__(element, elk, elk_data)
|
super().__init__(element, elk, elk_data)
|
||||||
@ -40,11 +43,6 @@ class ElkLight(ElkEntity, LightEntity):
|
|||||||
"""Get the brightness."""
|
"""Get the brightness."""
|
||||||
return self._brightness
|
return self._brightness
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Get the current brightness."""
|
"""Get the current brightness."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user