Repository navigation
feat(colorControl): Add the OptionsMask / OptionsOverride command fields - #233
Open
TedTolboom wants to merge 1 commit into
Open
TedTolboom wants to merge 1 commit into
TedTolboom wants to merge 1 commit into
Conversation
The Move to Hue, Move to Saturation, Move to Hue and Saturation, Move to Color and Move to Color Temperature commands end with the OptionsMask and OptionsOverride fields (ZCL r8 5.2.2.3.3), which temporarily override the Options attribute, e.g. executeIfOff. They were not defined, so a driver could not send them without building a raw frame. The fields are optional (encodeMissingFieldsBehavior 'skip'): existing calls without them encode exactly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
The Color Control commands Move to Hue, Move to Saturation, Move to Hue and Saturation, Move to Color and Move to Color
Temperature end with the
OptionsMaskandOptionsOverridefields (map8, ZCL r8 Figures 5-2 – 5-12). Together theytemporarily override the
Optionsattribute for that one command, e.g.executeIfOff(ZCL r8 5.2.2.3.3).zigbee-clusters already defines the
optionsattribute (map8('executeIfOff')), but not these command fields. So adriver cannot send them without building a raw ZCL frame.
This PR adds both fields to the five commands as optional fields (
encodeMissingFieldsBehavior: 'skip', as describedin
AGENTS.md).Compatibility
Existing calls without the options encode exactly as before; the new fields are only sent when provided:
{ colorTemperature, transitionTime }(unchanged)1e 01 0f 00+ optionsMask: ['executeIfOff'], optionsOverride: ['executeIfOff']1e 01 0f 00 01 01Note: ZCL r8 says the two fields "SHALL both be present. Default values are provided to interpret missing fields from
legacy devices" (CCB 2814). Making them optional keeps the current behaviour for all existing drivers. Encoding
00 00by default would follow r8 more strictly, but it changes the payload for every device, so I left that decisionto you.
Why
Aqara hubs send the color temperature command with these fields (
… 01 01, execute if off). The Aqara Ceiling Light T1M(
lumi.light.acn032) depends on them. Homey runs its white scenes (e.g. a "breathing" sequence) as level + colortemperature steps, and without the fields the light follows the level steps but not the color temperature steps. With
the fields, as the Aqara hub sends them, the light follows both. This was validated with a sniffer capture of the Aqara
hub and of Homey. Until now we work around it in the app with a subclass that adds a second command with id 0x0A.
Changes
lib/clusters/colorControl.js:OPTIONS_BITMAP(map8('executeIfOff')), shared by theoptionsattribute and the new fields;OPTIONS_ARGS(optionsMask,optionsOverride) added to the five commands, withencodeMissingFieldsBehavior: 'skip'.index.d.ts: regenerated withnpm run generate-types.test/colorControl.js: encoding tests against the spec bytes, without options (unchanged payload) and with options(Figures 5-9 and 5-12), plus a loopback test that receives the options.
Test plan
npm test: 96 passing, including the 4 new testsnpm run lintnpm run buildsequence starts from off
Not included (possible follow-ups)
colorLoopSet, which also have these fields in r8.🤖 Generated with Claude Code