Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for RGBW/RGBWW Devices in Light Entity Configuration #449

Merged
merged 10 commits into from
Jan 6, 2025
Prev Previous commit
Next Next commit
changed supported_color_modes slightly for better readability
geforcefan committed Jan 5, 2025
commit 6e6105f5d74c4539da2634acd7802a9881ec4e03
17 changes: 8 additions & 9 deletions custom_components/localtuya/light.py
Original file line number Diff line number Diff line change
@@ -297,17 +297,16 @@ def supported_color_modes(self) -> set[ColorMode] | set[str] | None:
"""Flag supported color modes."""
color_modes: set[ColorMode] = set()

if self.has_config(CONF_COLOR_TEMP):
color_modes.add(ColorMode.COLOR_TEMP)
if self.has_config(CONF_BRIGHTNESS):
if self.has_config(CONF_COLOR_TEMP):
color_modes.add(ColorMode.COLOR_TEMP)
else:
color_modes.add(ColorMode.WHITE)

if self.has_config(CONF_COLOR):
color_modes.add(ColorMode.HS)
if (
self.has_config(CONF_COLOR)
and self.has_config(CONF_BRIGHTNESS)
and not self.has_config(CONF_COLOR_TEMP)
):
return {ColorMode.HS, ColorMode.WHITE}
if not color_modes and self.has_config(CONF_BRIGHTNESS):

if color_modes == {ColorMode.WHITE}:
return {ColorMode.BRIGHTNESS}

if not color_modes: