-
Notifications
You must be signed in to change notification settings - Fork 64
Add support for Rgbic Neon Rope Light #452
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
base: master
Are you sure you want to change the base?
Changes from all commits
a25103a
fbeadeb
b18cd54
7b55fa7
e77be46
98a7a12
aecc10f
44a8a82
3a36c5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -343,3 +343,43 @@ def color_mode(self) -> ColorMode: | |
| """Return the current color mode.""" | ||
| device_mode = RGBICStripLightColorMode(self._get_adv_value("color_mode") or 10) | ||
| return _RGBICWW_STRIP_LIGHT_COLOR_MODE_MAP.get(device_mode, ColorMode.OFF) | ||
|
|
||
|
|
||
| class SwitchbotRgbicNeonLight(SwitchbotEncryptedDevice, SwitchbotLightStrip): | ||
| """Support for Switchbot RGBIC Neon lights.""" | ||
|
|
||
| _effect_dict = RGBIC_EFFECTS | ||
|
|
||
| def __init__( | ||
| self, | ||
| device: BLEDevice, | ||
| key_id: str, | ||
| encryption_key: str, | ||
| interface: int = 0, | ||
| model: SwitchbotModel = SwitchbotModel.RGBICWW_STRIP_LIGHT, | ||
| **kwargs: Any, | ||
| ) -> None: | ||
| super().__init__(device, key_id, encryption_key, model, interface, **kwargs) | ||
|
|
||
| @classmethod | ||
| async def verify_encryption_key( | ||
| cls, | ||
| device: BLEDevice, | ||
| key_id: str, | ||
| encryption_key: str, | ||
| model: SwitchbotModel = SwitchbotModel.RGBIC_NEON_ROPE_LIGHT, | ||
| **kwargs: Any, | ||
| ) -> bool: | ||
| return await super().verify_encryption_key( | ||
| device, key_id, encryption_key, model, **kwargs | ||
| ) | ||
|
Comment on lines
+365
to
+375
|
||
|
|
||
| @property | ||
| def color_modes(self) -> set[ColorMode]: | ||
| """Return the supported color modes.""" | ||
| return {ColorMode.RGB} | ||
|
|
||
|
Comment on lines
+377
to
+381
|
||
| @property | ||
| def color_mode(self) -> ColorMode: | ||
| """Return the current color mode.""" | ||
| return ColorMode.RGB | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3575,6 +3575,21 @@ def test_humidifer_with_empty_data() -> None: | |
| "RGBICWW Strip Light", | ||
| SwitchbotModel.RGBICWW_STRIP_LIGHT, | ||
| ), | ||
| AdvTestCase( | ||
| b"@L\xca!pz/\x8b'\x00\x11:\x00", | ||
| b"\x00\x00\x00\x00\x10\xd0\xb6", | ||
| { | ||
| "sequence_number": 47, | ||
| "isOn": True, | ||
| "brightness": 11, | ||
| "delay": False, | ||
| "network_state": 2, | ||
| "color_mode": 7, | ||
| }, | ||
| b"\x00\x10\xd0\xb6", | ||
| "RGBIC Neon Rope Light", | ||
| SwitchbotModel.RGBIC_NEON_ROPE_LIGHT, | ||
| ), | ||
|
Comment on lines
+3578
to
+3592
|
||
| AdvTestCase( | ||
| b"\xb0\xe9\xfe\xe4\xbf\xd8\x0b\x01\x11f\x00\x16M\x15", | ||
| b"\x00\x00M\x00\x10\xfb\xa8", | ||
|
|
@@ -3947,6 +3962,21 @@ def test_adv_active(test_case: AdvTestCase) -> None: | |
| "RGBICWW Strip Light", | ||
| SwitchbotModel.RGBICWW_STRIP_LIGHT, | ||
| ), | ||
| AdvTestCase( | ||
| b"@L\xca!pz/\x8b'\x00\x11:\x00", | ||
| None, | ||
| { | ||
| "sequence_number": 47, | ||
| "isOn": True, | ||
| "brightness": 11, | ||
| "delay": False, | ||
| "network_state": 2, | ||
| "color_mode": 7, | ||
| }, | ||
| b"\x00\x10\xd0\xb6", | ||
| "RGBIC Neon Rope Light", | ||
| SwitchbotModel.RGBIC_NEON_ROPE_LIGHT, | ||
| ), | ||
| AdvTestCase( | ||
| b"\xb0\xe9\xfe\xe4\xbf\xd8\x0b\x01\x11f\x00\x16M\x15", | ||
| None, | ||
|
|
@@ -4300,6 +4330,14 @@ def test_adv_passive(test_case: AdvTestCase) -> None: | |
| "Keypad Vision", | ||
| SwitchbotModel.KEYPAD_VISION, | ||
| ), | ||
| AdvTestCase( | ||
| None, | ||
| b"\x00\x00\x00\x00\x10\xd0\xb6", | ||
| {}, | ||
| b"\x00\x10\xd0\xb6", | ||
| "RGBIC Neon Rope Light", | ||
| SwitchbotModel.RGBIC_NEON_ROPE_LIGHT, | ||
| ), | ||
| AdvTestCase( | ||
| None, | ||
| b"\x00\x00`\x01\x11Q\x98", | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |||
|
|
||||
| from . import ( | ||||
| FLOOR_LAMP_INFO, | ||||
| RGBIC_NEON_LIGHT_INFO, | ||||
| RGBICWW_FLOOR_LAMP_INFO, | ||||
| RGBICWW_STRIP_LIGHT_INFO, | ||||
| STRIP_LIGHT_3_INFO, | ||||
|
|
@@ -24,6 +25,7 @@ | |||
| (FLOOR_LAMP_INFO, light_strip.SwitchbotStripLight3), | ||||
| (RGBICWW_STRIP_LIGHT_INFO, light_strip.SwitchbotRgbicLight), | ||||
| (RGBICWW_FLOOR_LAMP_INFO, light_strip.SwitchbotRgbicLight), | ||||
| (RGBIC_NEON_LIGHT_INFO, light_strip.SwitchbotRgbicNeonLight), | ||||
|
||||
| (RGBIC_NEON_LIGHT_INFO, light_strip.SwitchbotRgbicNeonLight), |
Copilot
AI
Feb 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The color_modes assertion was weakened from an exact set check to only verifying ColorMode.RGB is present. This reduces coverage for models that should also support ColorMode.COLOR_TEMP (e.g., Strip Light 3 / RGBICWW devices). Prefer asserting the full expected set per model so regressions in supported modes are caught, while still allowing neon to be RGB-only.
Uh oh!
There was an error while loading. Please reload this page.