Skip to content

Add Permanent Outdoor Light support#464

Open
fankai777 wants to merge 3 commits intosblibs:masterfrom
fankai777:feat/POL
Open

Add Permanent Outdoor Light support#464
fankai777 wants to merge 3 commits intosblibs:masterfrom
fankai777:feat/POL

Conversation

@fankai777
Copy link
Contributor

Summary

Add support for the SwitchBot Permanent Outdoor Light (POL) device — an encrypted RGBIC-based outdoor light strip.

Changes

Features

  • Add SwitchbotPermanentOutdoorLight device class with RGBIC effects and RGBICStripLightColorMode-based color_mode property
  • Register PERMANENT_OUTDOOR_LIGHT model enum in SwitchbotModel
  • Add BLE advertisement parser entries for service data 0xd0b7 (both 0x00 and 0x01 prefixes)
  • Export SwitchbotPermanentOutdoorLight in public API

Bug Fixes

  • Add missing RGBICStripLightColorMode.EFFECT (value 7) mapping in _RGBICWW_STRIP_LIGHT_COLOR_MODE_MAP — this also fixes a potential ValueError for existing RGBIC strip lights
  • Add defensive bounds check in process_light for short manufacturer data to avoid IndexError

Tests

  • Add POL to parametrized device_case fixture (covers all existing strip light tests)
  • Add dedicated test_permanent_outdoor_light_color_mode test covering all RGBICStripLightColorMode values
  • 100% code coverage on light_strip.py

fankai777 and others added 2 commits March 16, 2026 15:20
- 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
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
switchbot/__init__.py 100.00% <ø> (ø)
switchbot/adv_parser.py 97.81% <ø> (ø)
switchbot/adv_parsers/light_strip.py 100.00% <100.00%> (ø)
switchbot/const/__init__.py 100.00% <100.00%> (ø)
switchbot/devices/light_strip.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant