feat: add support for AK001-ZJ21413 (0xB6) Surplife outdoor lighting#498
feat: add support for AK001-ZJ21413 (0xB6) Surplife outdoor lighting#498asxzy wants to merge 21 commits into
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
47b30e7 to
995c338
Compare
|
Hi codeowners, I have a outdoor light by Surplife installed few days ago. The controller is not supported by the project -- "Cannot determine protocol" . The protocol is supported, but the device is not mapped in. I did most of the code via AI, and the feature is verified manually. Let me know if anything is missing before merging it in. Once it is in, I can request change to integrate this with home assistant. Yi |
There was a problem hiding this comment.
Pull request overview
This PR adds support for the Surplife outdoor permanent LED lighting system (model 0xB6, AK001-ZJ21413). The device exclusively uses the extended state format (0xEA 0x81) introduced in PR #428, requiring modifications to message handling priority and protocol determination logic to support devices that only respond with this format.
Changes:
- Modified message processing order to check extended state format before regular state format to support extended-state-only devices
- Enhanced protocol determination to extract model and version information from extended state messages
- Added byte position constants for parsing state messages to improve code maintainability
- Added complete model and hardware definitions for the 0xB6 device with RGB+CCT color modes
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| flux_led/aiodevice.py | Reordered message processing to prioritize extended state format and added protocol determination support for extended state responses |
| flux_led/base_device.py | Enhanced _set_protocol_from_msg() to handle both standard and extended state formats using byte position constants |
| flux_led/protocol.py | Added byte position constants and extended state validation methods to base protocol classes |
| flux_led/models_db.py | Added model definition for 0xB6 Surplife device and hardware configuration entry |
| tests/test_sync.py | Added sync API test for 0xB6 device identification and protocol validation |
| tests/test_aio.py | Added async API tests covering extended state setup and protocol validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @bdraco , I originally thought I can add the device in with existing protocol and call it a day. The existing protocol can perform on/off solid color change well, but the app is providing more features that is not use by other devices. When I doing more package capturing and analysis, I found this device is taking more command that change the pattern and segments. I think it will be cleaner to start a new protocol instead. Will update this PR later. |
|
@bdraco codecov failed and I can't see the detailed message. Let me know if anything need to be adjusted. |
|
flux_led/fluxled.py does not have unit test and it is out of scope of this PR. I will skip it for now. |
|
@bdraco let me know if anything is missing. |
|
I just came back to have a look at this and it looks like its nearly doubled in size. Its too large to review now. I only have a few time blocks to do reviews for large PRs (which is why its taken me so long to get back tot his), and the size makes it impossible to find a time block to review this all in one pass. |
|
Thanks for the work here; this PR has grown quite large (about 3600 additions across 11 files), which makes it hard to review in one pass. Could you split it into a few stacked PRs? A rough suggestion: one PR for the models_db and const entry for 0xB6, one for the new ProtocolLEDENETExtendedCustom class and the extended state parse reorder, one for the extended custom effect and segment color APIs, one for the fluxled CLI additions, and one for the timer.py changes (or drop those if they are unrelated). Smaller PRs are easier to review carefully and easier to revert if something regresses downstream. |
Summary
New Features
Device Support:
Extended Custom Effects (0xE1 0x21):
Segment Colors (0xE1 0x22):
New API Methods:
Technical Changes
Test plan