mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Use ColorMode enum in crownstone (#70432)
This commit is contained in:
parent
cc3d6aa247
commit
56921a41bf
@ -9,12 +9,7 @@ from crownstone_cloud.const import DIMMING_ABILITY
|
|||||||
from crownstone_cloud.exceptions import CrownstoneAbilityError
|
from crownstone_cloud.exceptions import CrownstoneAbilityError
|
||||||
from crownstone_uart import CrownstoneUart
|
from crownstone_uart import CrownstoneUart
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
||||||
ATTR_BRIGHTNESS,
|
|
||||||
COLOR_MODE_BRIGHTNESS,
|
|
||||||
COLOR_MODE_ONOFF,
|
|
||||||
LightEntity,
|
|
||||||
)
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
@ -102,8 +97,8 @@ class CrownstoneEntity(CrownstoneBaseEntity, LightEntity):
|
|||||||
def color_mode(self) -> str:
|
def color_mode(self) -> str:
|
||||||
"""Return the color mode of the light."""
|
"""Return the color mode of the light."""
|
||||||
if self.device.abilities.get(DIMMING_ABILITY).is_enabled:
|
if self.device.abilities.get(DIMMING_ABILITY).is_enabled:
|
||||||
return COLOR_MODE_BRIGHTNESS
|
return ColorMode.BRIGHTNESS
|
||||||
return COLOR_MODE_ONOFF
|
return ColorMode.ONOFF
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_color_modes(self) -> set[str] | None:
|
def supported_color_modes(self) -> set[str] | None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user