Skip to content

Commit

Permalink
add color mode to bulbs
Browse files Browse the repository at this point in the history
  • Loading branch information
brg468 committed May 15, 2023
1 parent 13aa005 commit 2b5af7e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion custom_components/wyzeapi/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
SUPPORT_COLOR,
COLOR_MODE_ONOFF,
SUPPORT_EFFECT,
LightEntity
LightEntity,
ColorMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ATTRIBUTION
Expand Down Expand Up @@ -209,6 +210,16 @@ async def async_turn_off(self, **kwargs: Any) -> None:
self._just_updated = True
self.async_schedule_update_ha_state()

@property
def supported_color_modes(self):
if self._bulb.type in [DeviceTypes.MESH_LIGHT, DeviceTypes.LIGHTSTRIP]:
return {ColorMode.COLOR_TEMP, ColorMode.HS}
return {ColorMode.COLOR_TEMP}

@property
def color_mode(self):
return ColorMode.COLOR_TEMP if self._bulb.color_mode == "2" else ColorMode.HS

@property
def name(self):
"""Return the display name of this light."""
Expand Down

0 comments on commit 2b5af7e

Please sign in to comment.