Add Permanent Outdoor Light support#464
Merged
bdraco merged 10 commits intosblibs:masterfrom Apr 23, 2026
Merged
Conversation
- Add SwitchbotPermanentOutdoorLight device class with RGBIC effects and RGBICStripLightColorMode-based color_mode property - Register POL model enum, adv_parser entries (service data 0xd0b7), and public API export - Fix missing RGBICStripLightColorMode.EFFECT mapping in color mode map - Add defensive bounds check in process_light for short manufacturer data - Add unit tests: POL in parametrized device_case fixture and dedicated color_mode test covering all RGBICStripLightColorMode values (100% coverage) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
- Add POL active, passive, and minimum_info adv parser test cases - Add passive test with short manufacturer data (13 bytes) to cover the cw=0 fallback branch in process_light - 100% coverage on adv_parsers/light_strip.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class support for the SwitchBot Permanent Outdoor Light (POL) across the library’s BLE advertisement parsing, device model enum, device implementation, and public exports, with accompanying test coverage and small robustness fixes.
Changes:
- Introduce
SwitchbotPermanentOutdoorLightdevice class and export it in the public API. - Register
SwitchbotModel.PERMANENT_OUTDOOR_LIGHTand add BLE adv parser mappings for service data0xd0b7(0x00/0x01prefixes). - Fix RGBIC color mode mapping (adds
RGBICStripLightColorMode.EFFECT) and harden CW parsing against short manufacturer data; extend/augment tests accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
switchbot/devices/light_strip.py |
Adds POL device class; extends RGBIC color-mode mapping to include EFFECT. |
switchbot/const/__init__.py |
Adds PERMANENT_OUTDOOR_LIGHT to SwitchbotModel. |
switchbot/adv_parser.py |
Registers POL service-data signatures (d0b7) and routes parsing via process_light. |
switchbot/adv_parsers/light_strip.py |
Adds bounds check for CW extraction to avoid IndexError on shorter mfr payloads. |
switchbot/__init__.py |
Exports SwitchbotPermanentOutdoorLight in the top-level public API. |
tests/__init__.py |
Adds PERMANENT_OUTDOOR_LIGHT_INFO test fixture data. |
tests/test_adv_parser.py |
Adds POL advertisement parsing test cases (active/passive). |
tests/test_strip_light.py |
Adds POL to strip-light parametrized tests and adds a dedicated color-mode mapping test. |
Comments suppressed due to low confidence (1)
switchbot/init.py:123
__all__contains multiple duplicated exports (e.g., "Switchbot", "SwitchbotModel", "SwitchbotPlugMini", "SwitchbotSupportedType"). This is harmless at runtime but makes the public API surface harder to audit and can confuse consumers/tools that inspect__all__. Please deduplicate the list so each symbol appears once.
__all__ = [
"AirPurifierMode",
"AirQualityLevel",
"BulbColorMode",
"CeilingLightColorMode",
"ClimateAction",
"ClimateMode",
"ColorMode",
"FanMode",
"GetSwitchbotDevices",
"HumidifierAction",
"HumidifierMode",
"HumidifierWaterLevel",
"LockStatus",
"SmartThermostatRadiatorMode",
"StripLightColorMode",
"SwitchBotAdvertisement",
"Switchbot",
"Switchbot",
"SwitchbotAccountConnectionError",
"SwitchbotAirPurifier",
"SwitchbotApiError",
"SwitchbotArtFrame",
"SwitchbotAuthenticationError",
"SwitchbotBaseLight",
"SwitchbotBlindTilt",
"SwitchbotBulb",
"SwitchbotCeilingLight",
"SwitchbotCurtain",
"SwitchbotDevice",
"SwitchbotEncryptedDevice",
"SwitchbotEvaporativeHumidifier",
"SwitchbotFan",
"SwitchbotGarageDoorOpener",
"SwitchbotHumidifier",
"SwitchbotKeypadVision",
"SwitchbotLightStrip",
"SwitchbotLock",
"SwitchbotMeterProCO2",
"SwitchbotModel",
"SwitchbotModel",
"SwitchbotOperationError",
"SwitchbotPermanentOutdoorLight",
"SwitchbotPlugMini",
"SwitchbotPlugMini",
"SwitchbotRelaySwitch",
"SwitchbotRelaySwitch2PM",
"SwitchbotRgbicLight",
"SwitchbotRollerShade",
"SwitchbotSmartThermostatRadiator",
"SwitchbotStripLight3",
"SwitchbotSupportedType",
"SwitchbotSupportedType",
"SwitchbotVacuum",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bdraco
reviewed
Apr 22, 2026
# Conflicts: # tests/test_strip_light.py
# Conflicts: # switchbot/adv_parser.py # switchbot/const/__init__.py # switchbot/devices/light_strip.py # tests/test_adv_parser.py # tests/test_strip_light.py
POL shares its BLE advertisement layout with the RGBIC family (color temperature at mfr_data offset 10), matching its SwitchbotRgbicLight class inheritance. Also revert the defensive bounds check in process_light since the short-mfr_data case it protected against is no longer reachable via POL.
zerzhang
approved these changes
Apr 23, 2026
bdraco
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for the SwitchBot Permanent Outdoor Light (POL) device — an encrypted RGBIC-based outdoor light strip.
Changes
Features
SwitchbotPermanentOutdoorLightdevice class with RGBIC effects andRGBICStripLightColorMode-basedcolor_modepropertyPERMANENT_OUTDOOR_LIGHTmodel enum inSwitchbotModel0xd0b7(both0x00and0x01prefixes)SwitchbotPermanentOutdoorLightin public APIBug Fixes
RGBICStripLightColorMode.EFFECT(value 7) mapping in_RGBICWW_STRIP_LIGHT_COLOR_MODE_MAP— this also fixes a potentialValueErrorfor existing RGBIC strip lightsprocess_lightfor short manufacturer data to avoidIndexErrorTests
device_casefixture (covers all existing strip light tests)test_permanent_outdoor_light_color_modetest covering allRGBICStripLightColorModevalueslight_strip.py