Migrate lutron light to color_mode (#69422)

This commit is contained in:
Erik Montnemery 2022-04-07 14:50:21 +02:00 committed by GitHub
parent e8852e0f30
commit 5110565488
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 ( from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS, COLOR_MODE_BRIGHTNESS,
LightEntity, LightEntity,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -41,16 +41,14 @@ def to_hass_level(level):
class LutronLight(LutronDevice, LightEntity): class LutronLight(LutronDevice, LightEntity):
"""Representation of a Lutron Light, including dimmable.""" """Representation of a Lutron Light, including dimmable."""
_attr_color_mode = COLOR_MODE_BRIGHTNESS
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
def __init__(self, area_name, lutron_device, controller): def __init__(self, area_name, lutron_device, controller):
"""Initialize the light.""" """Initialize the light."""
self._prev_brightness = None self._prev_brightness = None
super().__init__(area_name, lutron_device, controller) super().__init__(area_name, lutron_device, controller)
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS
@property @property
def brightness(self): def brightness(self):
"""Return the brightness of the light.""" """Return the brightness of the light."""