Skip to content

Add support for Candle Warmer Lamp#454

Open
XiaoLing-git wants to merge 7 commits intosblibs:masterfrom
XiaoLing-git:add_rl_light_0302
Open

Add support for Candle Warmer Lamp#454
XiaoLing-git wants to merge 7 commits intosblibs:masterfrom
XiaoLing-git:add_rl_light_0302

Conversation

@XiaoLing-git
Copy link

1. Candle Warmer Lamp

@codecov
Copy link

codecov bot commented Mar 2, 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% <100.00%> (ø)
switchbot/adv_parsers/light_strip.py 100.00% <100.00%> (ø)
switchbot/const/__init__.py 100.00% <100.00%> (ø)
switchbot/const/light.py 100.00% <100.00%> (ø)
switchbot/devices/light_strip.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new SwitchBot device model (“Candle Warmer Lamp”) to the library, including BLE advertisement parsing and a dedicated device class so it can be discovered and controlled consistently with other lighting devices.

Changes:

  • Add SwitchbotModel.CANDLE_WARMER_LAMP and new advertisement parser routing for its model identifiers.
  • Introduce SwitchbotCandleWarmerLamp device class with brightness-only color mode.
  • Extend test fixtures and adv-parser test vectors to cover the new device.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
switchbot/devices/light_strip.py Adds SwitchbotCandleWarmerLamp device implementation.
switchbot/adv_parsers/light_strip.py Adds process_candle_warmer_lamp advertisement data parser.
switchbot/adv_parser.py Wires the new model IDs to the new parser.
switchbot/const/__init__.py Adds SwitchbotModel.CANDLE_WARMER_LAMP.
switchbot/const/light.py Adds ColorMode.BRIGHTNESS.
switchbot/__init__.py Exposes SwitchbotCandleWarmerLamp in the package exports.
tests/__init__.py Adds CANDLE_WARMER_LAMP_INFO adv test fixture data.
tests/test_adv_parser.py Adds active/passive/manufacturer-data test cases for the new model.
tests/test_strip_light.py Adds candle warmer lamp initialization test and includes it in shared parametrized tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +307 to +321
class SwitchbotCandleWarmerLamp(SwitchbotEncryptedDevice, SwitchbotLightStrip):
"""Support for Switchbot Candle Warmer Lamp."""

_effect_dict = {}

def __init__(
self,
device: BLEDevice,
key_id: str,
encryption_key: str,
interface: int = 0,
model: SwitchbotModel = SwitchbotModel.CANDLE_WARMER_LAMP,
**kwargs: Any,
) -> None:
super().__init__(device, key_id, encryption_key, model, interface, **kwargs)
_version_info, _data = res
return {
"isOn": bool(_data[1] & 0b10000000),
"brightness": _data[2] & 0b01111111,
ColorMode.BRIGHTNESS,
}
assert device.brightness == adv_info.data["brightness"]
# Check that effect list contains expected lowercase effect names
COLOR_TEMP = 1
RGB = 2
EFFECT = 3
BRIGHTNESS = 11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 11 ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I observed other enumeration definitions in the same file, which appear to be related. To avoid potential issues, I assigned a non-existent value to them.

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments above

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.

3 participants