mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Use ColorMode enum in hive (#70501)
This commit is contained in:
parent
033445721d
commit
648c973785
@ -7,10 +7,7 @@ from homeassistant.components.light import (
|
|||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_COLOR_TEMP,
|
ATTR_COLOR_TEMP,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
COLOR_MODE_BRIGHTNESS,
|
ColorMode,
|
||||||
COLOR_MODE_COLOR_TEMP,
|
|
||||||
COLOR_MODE_HS,
|
|
||||||
COLOR_MODE_ONOFF,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -144,25 +141,25 @@ class HiveDeviceLight(HiveEntity, 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["hiveType"] == "warmwhitelight":
|
if self.device["hiveType"] == "warmwhitelight":
|
||||||
return COLOR_MODE_BRIGHTNESS
|
return ColorMode.BRIGHTNESS
|
||||||
if self.device["hiveType"] == "tuneablelight":
|
if self.device["hiveType"] == "tuneablelight":
|
||||||
return COLOR_MODE_COLOR_TEMP
|
return ColorMode.COLOR_TEMP
|
||||||
if self.device["hiveType"] == "colourtuneablelight":
|
if self.device["hiveType"] == "colourtuneablelight":
|
||||||
if self.device["status"]["mode"] == "COLOUR":
|
if self.device["status"]["mode"] == "COLOUR":
|
||||||
return COLOR_MODE_HS
|
return ColorMode.HS
|
||||||
return COLOR_MODE_COLOR_TEMP
|
return ColorMode.COLOR_TEMP
|
||||||
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:
|
||||||
"""Flag supported color modes."""
|
"""Flag supported color modes."""
|
||||||
if self.device["hiveType"] == "warmwhitelight":
|
if self.device["hiveType"] == "warmwhitelight":
|
||||||
return {COLOR_MODE_BRIGHTNESS}
|
return {ColorMode.BRIGHTNESS}
|
||||||
if self.device["hiveType"] == "tuneablelight":
|
if self.device["hiveType"] == "tuneablelight":
|
||||||
return {COLOR_MODE_COLOR_TEMP}
|
return {ColorMode.COLOR_TEMP}
|
||||||
if self.device["hiveType"] == "colourtuneablelight":
|
if self.device["hiveType"] == "colourtuneablelight":
|
||||||
return {COLOR_MODE_COLOR_TEMP, COLOR_MODE_HS}
|
return {ColorMode.COLOR_TEMP, ColorMode.HS}
|
||||||
return {COLOR_MODE_ONOFF}
|
return {ColorMode.ONOFF}
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update all Node data from Hive."""
|
"""Update all Node data from Hive."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user