feat: extended timer support for 0xB6 devices#541
Draft
asxzy wants to merge 5 commits into
Draft
Conversation
9a008d2 to
75e74e8
Compare
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
75e74e8 to
1845f79
Compare
Introduces a dedicated protocol class for the Surplife 0xB6 device, switches the model to it, and adds synchronous-path support. - protocol.py: PROTOCOL_LEDENET_EXTENDED_CUSTOM, LEDENET_EXTENDED_STATE_RESPONSE_LEN, and ProtocolLEDENETExtendedCustom (name, 21-byte state length, extended-only is_valid_state_response, white-off-aware extended_state_to_state, and named_raw_state that converts extended -> standard for the sync path) - device.py: read the full 21-byte extended state and accept it while probing - base_device.py: register the protocol and add supports_extended_custom_effects - models_db.py: point the 0xB6 model at PROTOCOL_LEDENET_EXTENDED_CUSTOM Stacked on the reuse PR.
- const.py: ExtendedCustomEffectPattern / Direction / Option enums - pattern.py: EXTENDED_CUSTOM_EFFECT_ID_NAME / NAME_ID maps - protocol.py: construct_extended_custom_effect (0xE1 0x21), construct_custom_segment_colors (0xE1 0x22), construct_levels_change and the HSV(+W) byte helpers on ProtocolLEDENETExtendedCustom - base_device.py: extended_custom_effect_pattern_list, _generate_* helpers and pattern-name lookup in _named_effect - aiodevice.py / device.py: async_set_* and set* entry points Stacked on the dedicated-protocol PR.
The 0xB6 device uses a distinct timer wire format (e0 05/06 wrapped commands, variable-length 6-slot list, per-slot set): - const.py: TIMER_ACTION_* and TIMER_EFFECT_* constants - protocol.py: MSG_TIMERS_EXTENDED and the timer methods on ProtocolLEDENETExtendedCustom - timer.py: LedTimerExtended dataclass (to_bytes/from_bytes, __str__) - aiodevice.py: timer types widened, async_set_timers sends 0xB6 timers one at a time, new async_set_timer Stacked on the effect-APIs PR.
1845f79 to
447c63b
Compare
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.
Merge order: #538 → #539 → $540 → this → cli. Draft until predecessors land.
Background
The 0xB6 uses a different timer wire format than other LEDENET devices; before this, the CLI
reported "Could not get timers." This adds the device's timer model and protocol.
Changes
timer.py(+280)LedTimerExtended(parse/serialize the 0xB6 timer slots: on/off/color/preset/warmwhite modes, time, repeat mask).protocol.py(+113)construct_get_timers(E0 06),construct_set_timer(E0 05 <slot> …),is_valid_timers_response,parse_get_timers.aiodevice.py(+25)const.py(+12)tests/test_aio.py(+431)Testing
pytestgreen,ruffclean, no newmypyerrors.On-device verification (device
192.168.1.78):--getclock--setclock-t-T 3 color "time:1730;repeat:12345;color:red"→-t→-T 3 inactive ""