@@ -9,19 +9,19 @@ const ATTRIBUTES = {
99 currentHue : { id : 0 , type : ZCLDataTypes . uint8 } ,
1010
1111 // Mandatory if colorCapabilities = hueAndSaturation
12- // Reportable, read-only
12+ // Reportable, read-only, scene extension
1313 currentSaturation : { id : 1 , type : ZCLDataTypes . uint8 } ,
1414
15- // Mandatory
16- // Reportable, read-only
15+ // Mandatory if colorCapabilities = xy
16+ // Reportable, read-only, scene extension
1717 currentX : { id : 3 , type : ZCLDataTypes . uint16 } ,
1818
19- // Mandatory
20- // Reportable, read-only
19+ // Mandatory if colorCapabilities = xy
20+ // Reportable, read-only, scene extension
2121 currentY : { id : 4 , type : ZCLDataTypes . uint16 } ,
2222
2323 // Mandatory if colorCapabilities = colorTemperature
24- // Reportable, read-only
24+ // Reportable, read-only, scene extension
2525 colorTemperatureMireds : { id : 7 , type : ZCLDataTypes . uint16 } ,
2626
2727 // Mandatory, read-only
@@ -34,9 +34,69 @@ const ATTRIBUTES = {
3434 } ) ,
3535 } ,
3636
37+ // Mandatory
38+ // Read/write
39+ // Determines the default behavior of some cluster commands, meant to be changed only during
40+ // commissioning. When executeIfOff is not set, a command is not executed if the On/Off cluster
41+ // exists on the same endpoint and its onOff attribute is false.
42+ options : { id : 15 , type : ZCLDataTypes . map8 ( 'executeIfOff' ) } ,
43+
44+ // Mandatory if colorCapabilities = enhancedHue
45+ // Read-only, scene extension
46+ // Represents non-equidistant steps along the CIE 1931 color triangle, providing 16-bits
47+ // precision. The upper 8 bits are used as an index in the implementation specific XY lookup
48+ // table, the lower 8 bits interpolate between these steps in a linear way. For compatibility
49+ // with standard ZCL, currentHue contains a hue value in the range 0 to 254, calculated from
50+ // this attribute.
51+ enhancedCurrentHue : { id : 16384 , type : ZCLDataTypes . uint16 } ,
52+
53+ // Mandatory, read-only
54+ // Specifies which attributes are currently determining the color of the device. Note that for
55+ // compatibility with standard ZCL, colorMode reports currentHueAndCurrentSaturation while the
56+ // device is actually driven by enhancedCurrentHue, so read this attribute instead of colorMode
57+ // to tell those two apart.
58+ enhancedColorMode : {
59+ id : 16385 ,
60+ type : ZCLDataTypes . enum8 ( {
61+ currentHueAndCurrentSaturation : 0 ,
62+ currentXAndCurrentY : 1 ,
63+ colorTemperatureMireds : 2 ,
64+ enhancedCurrentHueAndCurrentSaturation : 3 ,
65+ } ) ,
66+ } ,
67+
68+ // Mandatory if colorCapabilities = colorLoop
69+ // Read-only, scene extension
70+ // Current active status of the color loop: 0x00 = inactive, 0x01 = active,
71+ // all other values (0x02 - 0xff) are reserved
72+ colorLoopActive : { id : 16386 , type : ZCLDataTypes . uint8 } ,
73+
74+ // Mandatory if colorCapabilities = colorLoop
75+ // Read-only, scene extension
76+ // Current direction of the color loop: 0x00 = enhancedCurrentHue is decremented,
77+ // 0x01 = enhancedCurrentHue is incremented, all other values (0x02 - 0xff) are reserved
78+ colorLoopDirection : { id : 16387 , type : ZCLDataTypes . uint8 } ,
79+
80+ // Mandatory if colorCapabilities = colorLoop
81+ // Read-only, scene extension
82+ // Number of seconds it takes to perform a full color loop, i.e. to cycle all values of the
83+ // enhancedCurrentHue attribute (between 0x0000 and 0xffff). Default 0x0019 (25 seconds).
84+ colorLoopTime : { id : 16388 , type : ZCLDataTypes . uint16 } ,
85+
86+ // Mandatory if colorCapabilities = colorLoop
87+ // Read-only
88+ // Value of enhancedCurrentHue from which the color loop starts. Default 0x2300.
89+ colorLoopStartEnhancedHue : { id : 16389 , type : ZCLDataTypes . uint16 } ,
90+
91+ // Mandatory if colorCapabilities = colorLoop
92+ // Read-only
93+ // Value of enhancedCurrentHue before the color loop was started. Once the color loop is
94+ // complete, enhancedCurrentHue is restored to this value.
95+ colorLoopStoredEnhancedHue : { id : 16390 , type : ZCLDataTypes . uint16 } ,
96+
3797 // Mandatory, read-only
3898 // Bit 0: hueAndSaturation mandatory commands: moveToHue, moveHue, stepHue, moveToSaturation,
39- // moveSaturation, stepSaturation moveToHueAndSaturation, stopMoveStep, related attributes:
99+ // moveSaturation, stepSaturation, moveToHueAndSaturation, stopMoveStep, related attributes:
40100 // currentHue, currentSaturation
41101
42102 // Bit 1: enhancedHue (hueAndSaturation must also be supported) mandatory commands:
@@ -63,8 +123,11 @@ const ATTRIBUTES = {
63123 // Read-only
64124 colorTempPhysicalMaxMireds : { id : 16396 , type : ZCLDataTypes . uint16 } ,
65125
126+ // Mandatory if colorTemperatureMireds is supported
127+ // Read/write, scene extension
66128 // Startup color temperature, reflected in colorTemperatureMireds on power up
67- // (0xffff = restore previous value)
129+ // (0xffff = restore previous value). On power up colorMode and enhancedColorMode are set to
130+ // colorTemperatureMireds.
68131 startUpColorTemperatureMireds : { id : 16400 , type : ZCLDataTypes . uint16 } ,
69132} ;
70133
@@ -73,19 +136,24 @@ const COMMANDS = {
73136 id : 0 ,
74137 args : {
75138 hue : ZCLDataTypes . uint8 ,
76- direction : ZCLDataTypes . enum8 ( { // TODO: ?
139+ // Direction of travel round the hue circle. shortestDistance is normal usage,
140+ // longestDistance can be used for rainbow effects. For those two values only, the up
141+ // direction is taken when both paths are equally long. up and down are explicit.
142+ direction : ZCLDataTypes . enum8 ( {
77143 shortestDistance : 0 ,
78144 longestDistance : 1 ,
79145 up : 2 ,
80146 down : 3 ,
81147 } ) ,
148+ // In 1/10ths of a second
82149 transitionTime : ZCLDataTypes . uint16 ,
83150 } ,
84151 } ,
85152 moveToSaturation : {
86153 id : 3 ,
87- args : { // TODO
154+ args : {
88155 saturation : ZCLDataTypes . uint8 ,
156+ // In 1/10ths of a second
89157 transitionTime : ZCLDataTypes . uint16 ,
90158 } ,
91159 } ,
@@ -94,6 +162,7 @@ const COMMANDS = {
94162 args : {
95163 hue : ZCLDataTypes . uint8 ,
96164 saturation : ZCLDataTypes . uint8 ,
165+ // In 1/10ths of a second
97166 transitionTime : ZCLDataTypes . uint16 ,
98167 } ,
99168 } ,
@@ -102,16 +171,54 @@ const COMMANDS = {
102171 args : {
103172 colorX : ZCLDataTypes . uint16 ,
104173 colorY : ZCLDataTypes . uint16 ,
174+ // In 1/10ths of a second
105175 transitionTime : ZCLDataTypes . uint16 ,
106176 } ,
107177 } ,
108178 moveToColorTemperature : {
109179 id : 10 ,
110180 args : {
111181 colorTemperature : ZCLDataTypes . uint16 ,
182+ // In 1/10ths of a second
112183 transitionTime : ZCLDataTypes . uint16 ,
113184 } ,
114185 } ,
186+
187+ // Mandatory if colorCapabilities = colorLoop
188+ // Activates a color loop such that the color lamp cycles through its range of hues
189+ colorLoopSet : {
190+ id : 68 , // 0x44
191+ args : {
192+ // Specifies which color loop attributes to update before the color loop is started. The
193+ // action, direction, time and startHue fields below are ignored by the device unless their
194+ // flag is set here.
195+ updateFlags : ZCLDataTypes . map8 (
196+ 'updateAction' , 'updateDirection' , 'updateTime' , 'updateStartHue' ,
197+ ) ,
198+
199+ // Action to take for the color loop, only applied when updateFlags.updateAction is set
200+ action : ZCLDataTypes . enum8 ( {
201+ deactivate : 0 ,
202+ activateFromColorLoopStartEnhancedHue : 1 ,
203+ activateFromEnhancedCurrentHue : 2 ,
204+ } ) ,
205+
206+ // Direction for the color loop, written to colorLoopDirection when
207+ // updateFlags.updateDirection is set
208+ direction : ZCLDataTypes . enum8 ( {
209+ decrementHue : 0 ,
210+ incrementHue : 1 ,
211+ } ) ,
212+
213+ // Number of seconds over which to perform a full color loop, written to colorLoopTime when
214+ // updateFlags.updateTime is set
215+ time : ZCLDataTypes . uint16 ,
216+
217+ // Starting hue to use for the color loop, written to colorLoopStartEnhancedHue when
218+ // updateFlags.updateStartHue is set
219+ startHue : ZCLDataTypes . uint16 ,
220+ } ,
221+ } ,
115222} ;
116223
117224class ColorControlCluster extends Cluster {
0 commit comments