Switchbot Cloud: Fixed light mode settings error (#164723)

This commit is contained in:
Samuel Xiao
2026-03-09 22:50:02 +08:00
committed by GitHub
parent a25300b8e1
commit ce6154839e

View File

@@ -58,6 +58,8 @@ class SwitchBotCloudLight(SwitchBotCloudEntity, LightEntity):
"""Return the default color mode."""
if not self.supported_color_modes:
return ColorMode.UNKNOWN
if ColorMode.BRIGHTNESS in self.supported_color_modes:
return ColorMode.BRIGHTNESS
if ColorMode.RGB in self.supported_color_modes:
return ColorMode.RGB
if ColorMode.COLOR_TEMP in self.supported_color_modes:
@@ -136,6 +138,7 @@ class SwitchBotCloudCandleWarmerLamp(SwitchBotCloudLight):
# Brightness adjustment
_attr_supported_color_modes = {ColorMode.BRIGHTNESS}
_attr_color_mode = ColorMode.BRIGHTNESS
class SwitchBotCloudStripLight(SwitchBotCloudLight):
@@ -145,6 +148,7 @@ class SwitchBotCloudStripLight(SwitchBotCloudLight):
# RGB color control
_attr_supported_color_modes = {ColorMode.RGB}
_attr_color_mode = ColorMode.RGB
class SwitchBotCloudRGBICLight(SwitchBotCloudLight):
@@ -154,6 +158,7 @@ class SwitchBotCloudRGBICLight(SwitchBotCloudLight):
# RGB color control
_attr_supported_color_modes = {ColorMode.RGB}
_attr_color_mode = ColorMode.RGB
async def _send_rgb_color_command(self, rgb_color: tuple) -> None:
"""Send an RGB command."""
@@ -174,6 +179,7 @@ class SwitchBotCloudRGBWWLight(SwitchBotCloudLight):
_attr_min_color_temp_kelvin = 2700
_attr_supported_color_modes = {ColorMode.RGB, ColorMode.COLOR_TEMP}
_attr_color_mode = ColorMode.RGB
async def _send_brightness_command(self, brightness: int) -> None:
"""Send a brightness command."""
@@ -200,6 +206,7 @@ class SwitchBotCloudCeilingLight(SwitchBotCloudLight):
_attr_min_color_temp_kelvin = 2700
_attr_supported_color_modes = {ColorMode.COLOR_TEMP}
_attr_color_mode = ColorMode.COLOR_TEMP
async def _send_brightness_command(self, brightness: int) -> None:
"""Send a brightness command."""