Use ColorMode enum in blebox (#70426)

This commit is contained in:
epenet 2022-04-23 07:49:39 +02:00 committed by GitHub
parent 72b31ca51a
commit 643d04a717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -6,9 +6,7 @@ from blebox_uniapi.error import BadOnValueError
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_RGBW_COLOR,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_ONOFF,
COLOR_MODE_RGBW,
ColorMode,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
@ -55,10 +53,10 @@ class BleBoxLightEntity(BleBoxEntity, LightEntity):
def color_mode(self):
"""Return the color mode."""
if self._feature.supports_white and self._feature.supports_color:
return COLOR_MODE_RGBW
return ColorMode.RGBW
if self._feature.supports_brightness:
return COLOR_MODE_BRIGHTNESS
return COLOR_MODE_ONOFF
return ColorMode.BRIGHTNESS
return ColorMode.ONOFF
@property
def rgbw_color(self):