Migrate pilight light to color_mode (#69531)

This commit is contained in:
epenet 2022-04-07 09:08:41 +02:00 committed by GitHub
parent 8cba371318
commit a10a1794d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,8 +5,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_LIGHTS
@ -49,6 +49,9 @@ def setup_platform(
class PilightLight(PilightBaseDevice, LightEntity):
"""Representation of a Pilight switch."""
_attr_color_mode = COLOR_MODE_BRIGHTNESS
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
def __init__(self, hass, name, config):
"""Initialize a switch."""
super().__init__(hass, name, config)
@ -60,11 +63,6 @@ class PilightLight(PilightBaseDevice, LightEntity):
"""Return the brightness."""
return self._brightness
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS
def turn_on(self, **kwargs):
"""Turn the switch on by calling pilight.send service with on code."""
# Update brightness only if provided as an argument.