Skip to content

Commit

Permalink
Fix Color modes
Browse files Browse the repository at this point in the history
  • Loading branch information
theneweinstein authored Oct 21, 2023
1 parent e9a84a8 commit 7028899
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion custom_components/somneo/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ class SomneoLight(SomneoEntity, LightEntity):
"""Representation of an Somneo Light."""

_attr_should_poll = True
_attr_supported_color_modes = ColorMode.BRIGHTNESS
_attr_supported_color_modes: set[ColorMode| str] = {ColorMode.BRIGHTNESS}
_attr_translation_key = "normal_light"

@property
def color_mode(self) -> ColorMode:
"""Return the color mode of the light."""
return ColorMode.BRIGHTNESS

@callback
def _handle_coordinator_update(self) -> None:
self._attr_is_on = self.coordinator.data["light_is_on"]
Expand All @@ -66,8 +71,14 @@ class SomneoNightLight(SomneoEntity, LightEntity):
"""Representation of an Somneo Night light."""

_attr_should_poll = True
_attr_supported_color_modes: set[ColorMode| str] = {ColorMode.ONOFF}
_attr_translation_key = "night_light"

@property
def color_mode(self) -> ColorMode:
"""Return the color mode of the light."""
return ColorMode.ONOFF

@callback
def _handle_coordinator_update(self) -> None:
self._attr_is_on = self.coordinator.data["nightlight_is_on"]
Expand Down

0 comments on commit 7028899

Please sign in to comment.