|
@@ -12,6 +12,7 @@ from switchbot.devices.device import SwitchbotOperationError
|
|
|
from . import (
|
|
from . import (
|
|
|
CANDLE_WARMER_LAMP_INFO,
|
|
CANDLE_WARMER_LAMP_INFO,
|
|
|
FLOOR_LAMP_INFO,
|
|
FLOOR_LAMP_INFO,
|
|
|
|
|
+ PERMANENT_OUTDOOR_LIGHT_INFO,
|
|
|
RGBIC_NEON_LIGHT_INFO,
|
|
RGBIC_NEON_LIGHT_INFO,
|
|
|
RGBICWW_FLOOR_LAMP_INFO,
|
|
RGBICWW_FLOOR_LAMP_INFO,
|
|
|
RGBICWW_STRIP_LIGHT_INFO,
|
|
RGBICWW_STRIP_LIGHT_INFO,
|
|
@@ -25,6 +26,7 @@ ALL_LIGHT_CASES = [
|
|
|
(CANDLE_WARMER_LAMP_INFO, light_strip.SwitchbotCandleWarmerLamp),
|
|
(CANDLE_WARMER_LAMP_INFO, light_strip.SwitchbotCandleWarmerLamp),
|
|
|
(RGBICWW_STRIP_LIGHT_INFO, light_strip.SwitchbotRgbicLight),
|
|
(RGBICWW_STRIP_LIGHT_INFO, light_strip.SwitchbotRgbicLight),
|
|
|
(RGBICWW_FLOOR_LAMP_INFO, light_strip.SwitchbotRgbicLight),
|
|
(RGBICWW_FLOOR_LAMP_INFO, light_strip.SwitchbotRgbicLight),
|
|
|
|
|
+ (PERMANENT_OUTDOOR_LIGHT_INFO, light_strip.SwitchbotPermanentOutdoorLight),
|
|
|
(RGBIC_NEON_LIGHT_INFO, light_strip.SwitchbotRgbicNeonLight),
|
|
(RGBIC_NEON_LIGHT_INFO, light_strip.SwitchbotRgbicNeonLight),
|
|
|
]
|
|
]
|
|
|
|
|
|
|
@@ -51,6 +53,7 @@ def expected_effects(device_case):
|
|
|
SwitchbotModel.FLOOR_LAMP: ("christmas", "halloween", "sunset"),
|
|
SwitchbotModel.FLOOR_LAMP: ("christmas", "halloween", "sunset"),
|
|
|
SwitchbotModel.RGBICWW_STRIP_LIGHT: ("romance", "energy", "heartbeat"),
|
|
SwitchbotModel.RGBICWW_STRIP_LIGHT: ("romance", "energy", "heartbeat"),
|
|
|
SwitchbotModel.RGBICWW_FLOOR_LAMP: ("romance", "energy", "heartbeat"),
|
|
SwitchbotModel.RGBICWW_FLOOR_LAMP: ("romance", "energy", "heartbeat"),
|
|
|
|
|
+ SwitchbotModel.PERMANENT_OUTDOOR_LIGHT: ("romance", "energy", "heartbeat"),
|
|
|
}
|
|
}
|
|
|
return EXPECTED[adv_info.modelName]
|
|
return EXPECTED[adv_info.modelName]
|
|
|
|
|
|
|
@@ -366,6 +369,10 @@ async def test_set_effect_normalizes_case(device_case):
|
|
|
[
|
|
[
|
|
|
(light_strip.SwitchbotStripLight3, SwitchbotModel.STRIP_LIGHT_3),
|
|
(light_strip.SwitchbotStripLight3, SwitchbotModel.STRIP_LIGHT_3),
|
|
|
(light_strip.SwitchbotRgbicLight, SwitchbotModel.RGBICWW_STRIP_LIGHT),
|
|
(light_strip.SwitchbotRgbicLight, SwitchbotModel.RGBICWW_STRIP_LIGHT),
|
|
|
|
|
+ (
|
|
|
|
|
+ light_strip.SwitchbotPermanentOutdoorLight,
|
|
|
|
|
+ SwitchbotModel.PERMANENT_OUTDOOR_LIGHT,
|
|
|
|
|
+ ),
|
|
|
(light_strip.SwitchbotRgbicNeonLight, SwitchbotModel.RGBIC_NEON_ROPE_LIGHT),
|
|
(light_strip.SwitchbotRgbicNeonLight, SwitchbotModel.RGBIC_NEON_ROPE_LIGHT),
|
|
|
(light_strip.SwitchbotCandleWarmerLamp, SwitchbotModel.CANDLE_WARMER_LAMP),
|
|
(light_strip.SwitchbotCandleWarmerLamp, SwitchbotModel.CANDLE_WARMER_LAMP),
|
|
|
],
|
|
],
|
|
@@ -440,3 +447,29 @@ async def test_exception_with_wrong_model():
|
|
|
match="Current device aa:bb:cc:dd:ee:ff does not support this functionality",
|
|
match="Current device aa:bb:cc:dd:ee:ff does not support this functionality",
|
|
|
):
|
|
):
|
|
|
await device.set_rgb(100, 255, 128, 64)
|
|
await device.set_rgb(100, 255, 128, 64)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+@pytest.mark.asyncio
|
|
|
|
|
+@pytest.mark.parametrize(
|
|
|
|
|
+ ("color_mode_value", "expected_color_mode"),
|
|
|
|
|
+ [
|
|
|
|
|
+ (1, ColorMode.EFFECT), # SEGMENTED
|
|
|
|
|
+ (2, ColorMode.RGB),
|
|
|
|
|
+ (3, ColorMode.EFFECT), # SCENE
|
|
|
|
|
+ (4, ColorMode.EFFECT), # MUSIC
|
|
|
|
|
+ (5, ColorMode.EFFECT), # CONTROLLER
|
|
|
|
|
+ (6, ColorMode.COLOR_TEMP),
|
|
|
|
|
+ (7, ColorMode.EFFECT), # EFFECT (RGBIC-specific)
|
|
|
|
|
+ (10, ColorMode.OFF), # UNKNOWN
|
|
|
|
|
+ ],
|
|
|
|
|
+)
|
|
|
|
|
+async def test_permanent_outdoor_light_color_mode(
|
|
|
|
|
+ color_mode_value, expected_color_mode
|
|
|
|
|
+):
|
|
|
|
|
+ """Test that POL correctly handles all RGBICStripLightColorMode values including EFFECT (7)."""
|
|
|
|
|
+ device = create_device_for_command_testing(
|
|
|
|
|
+ PERMANENT_OUTDOOR_LIGHT_INFO,
|
|
|
|
|
+ light_strip.SwitchbotPermanentOutdoorLight,
|
|
|
|
|
+ init_data={"color_mode": color_mode_value},
|
|
|
|
|
+ )
|
|
|
|
|
+ assert device.color_mode == expected_color_mode
|