Migrate elkm1 light to color_mode (#69179)

This commit is contained in:
Erik Montnemery 2022-04-03 13:56:46 +02:00 committed by GitHub
parent 522a9bb6b1
commit b38ca5ddd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@ from __future__ import annotations
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
@ -30,6 +30,9 @@ async def async_setup_entry(
class ElkLight(ElkEntity, LightEntity):
"""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):
"""Initialize the Elk light."""
super().__init__(element, elk, elk_data)
@ -40,11 +43,6 @@ class ElkLight(ElkEntity, LightEntity):
"""Get the brightness."""
return self._brightness
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS
@property
def is_on(self) -> bool:
"""Get the current brightness."""