Migrate enocean light to color_mode (#69180)

This commit is contained in:
Erik Montnemery 2022-04-03 13:44:38 +02:00 committed by GitHub
parent 24754c31ca
commit 9335b9a52e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,8 +7,8 @@ import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.const import CONF_ID, CONF_NAME
@ -22,7 +22,6 @@ from .device import EnOceanEntity
CONF_SENDER_ID = "sender_id"
DEFAULT_NAME = "EnOcean Light"
SUPPORT_ENOCEAN = SUPPORT_BRIGHTNESS
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
@ -50,6 +49,9 @@ def setup_platform(
class EnOceanLight(EnOceanEntity, LightEntity):
"""Representation of an EnOcean light source."""
_attr_color_mode = COLOR_MODE_BRIGHTNESS
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
def __init__(self, sender_id, dev_id, dev_name):
"""Initialize the EnOcean light source."""
super().__init__(dev_id, dev_name)
@ -76,11 +78,6 @@ class EnOceanLight(EnOceanEntity, LightEntity):
"""If light is on."""
return self._on_state
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_ENOCEAN
def turn_on(self, **kwargs):
"""Turn the light source on or sets a specific dimmer value."""
if (brightness := kwargs.get(ATTR_BRIGHTNESS)) is not None: