Use ColorMode enum in overkiz (#70528)

This commit is contained in:
epenet 2022-04-23 21:25:47 +02:00 committed by GitHub
parent 1d5096638e
commit 4a276d90b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,9 +8,7 @@ from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_RGB_COLOR,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_ONOFF,
COLOR_MODE_RGB,
ColorMode,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
@ -50,11 +48,11 @@ class OverkizLight(OverkizEntity, LightEntity):
self._attr_supported_color_modes = set()
if self.executor.has_command(OverkizCommand.SET_RGB):
self._attr_supported_color_modes.add(COLOR_MODE_RGB)
self._attr_supported_color_modes.add(ColorMode.RGB)
if self.executor.has_command(OverkizCommand.SET_INTENSITY):
self._attr_supported_color_modes.add(COLOR_MODE_BRIGHTNESS)
self._attr_supported_color_modes.add(ColorMode.BRIGHTNESS)
if not self.supported_color_modes:
self._attr_supported_color_modes = {COLOR_MODE_ONOFF}
self._attr_supported_color_modes = {ColorMode.ONOFF}
@property
def is_on(self) -> bool: