Migrate insteon light to color_mode ()

This commit is contained in:
Erik Montnemery 2022-04-04 18:25:40 +02:00 committed by GitHub
parent fe65804de1
commit 25d9d14bd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,8 +3,8 @@ from pyinsteon.extended_property import ON_LEVEL
from homeassistant.components.light import ( from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
DOMAIN as LIGHT_DOMAIN, DOMAIN as LIGHT_DOMAIN,
SUPPORT_BRIGHTNESS,
LightEntity, LightEntity,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
@ -41,6 +41,9 @@ async def async_setup_entry(
class InsteonDimmerEntity(InsteonEntity, LightEntity): class InsteonDimmerEntity(InsteonEntity, LightEntity):
"""A Class for an Insteon light entity.""" """A Class for an Insteon light entity."""
_attr_color_mode = COLOR_MODE_BRIGHTNESS
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
@property @property
def brightness(self): def brightness(self):
"""Return the brightness of this light between 0..255.""" """Return the brightness of this light between 0..255."""
@ -51,11 +54,6 @@ class InsteonDimmerEntity(InsteonEntity, LightEntity):
"""Return the boolean response if the node is on.""" """Return the boolean response if the node is on."""
return bool(self.brightness) return bool(self.brightness)
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS
async def async_turn_on(self, **kwargs): async def async_turn_on(self, **kwargs):
"""Turn light on.""" """Turn light on."""
if ATTR_BRIGHTNESS in kwargs: if ATTR_BRIGHTNESS in kwargs: