From 56921a41bf919a2f11615e1db91fdcafea40641c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 22 Apr 2022 16:25:20 +0200 Subject: [PATCH] Use ColorMode enum in crownstone (#70432) --- homeassistant/components/crownstone/light.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/crownstone/light.py b/homeassistant/components/crownstone/light.py index de35ad3d508..a046a39cd62 100644 --- a/homeassistant/components/crownstone/light.py +++ b/homeassistant/components/crownstone/light.py @@ -9,12 +9,7 @@ from crownstone_cloud.const import DIMMING_ABILITY from crownstone_cloud.exceptions import CrownstoneAbilityError from crownstone_uart import CrownstoneUart -from homeassistant.components.light import ( - ATTR_BRIGHTNESS, - COLOR_MODE_BRIGHTNESS, - COLOR_MODE_ONOFF, - LightEntity, -) +from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError @@ -102,8 +97,8 @@ class CrownstoneEntity(CrownstoneBaseEntity, LightEntity): def color_mode(self) -> str: """Return the color mode of the light.""" if self.device.abilities.get(DIMMING_ABILITY).is_enabled: - return COLOR_MODE_BRIGHTNESS - return COLOR_MODE_ONOFF + return ColorMode.BRIGHTNESS + return ColorMode.ONOFF @property def supported_color_modes(self) -> set[str] | None: