mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Use ColorMode enum in overkiz (#70528)
This commit is contained in:
parent
1d5096638e
commit
4a276d90b0
@ -8,9 +8,7 @@ from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState
|
|||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_RGB_COLOR,
|
ATTR_RGB_COLOR,
|
||||||
COLOR_MODE_BRIGHTNESS,
|
ColorMode,
|
||||||
COLOR_MODE_ONOFF,
|
|
||||||
COLOR_MODE_RGB,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -50,11 +48,11 @@ class OverkizLight(OverkizEntity, LightEntity):
|
|||||||
self._attr_supported_color_modes = set()
|
self._attr_supported_color_modes = set()
|
||||||
|
|
||||||
if self.executor.has_command(OverkizCommand.SET_RGB):
|
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):
|
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:
|
if not self.supported_color_modes:
|
||||||
self._attr_supported_color_modes = {COLOR_MODE_ONOFF}
|
self._attr_supported_color_modes = {ColorMode.ONOFF}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user