-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathColorControlOverrides.ts
More file actions
169 lines (154 loc) · 6.22 KB
/
ColorControlOverrides.ts
File metadata and controls
169 lines (154 loc) · 6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/**
* @license
* Copyright 2022-2026 Matter.js Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { FieldValue } from "@matter/model";
import { LocalMatter } from "../local.js";
LocalMatter.children.push({
tag: "cluster",
name: "ColorControl",
children: [
// 63353 (0xFFF) is used as "endless" when color is looping (hue/enhanced hue)
{
tag: "attribute",
name: "RemainingTime",
id: 0x2,
constraint: "0 to 65535",
},
// Adjust the constraints to match the spec
{
tag: "attribute",
id: 0x7,
name: "ColorTemperatureMireds",
constraint: "ColorTempPhysicalMinMireds to ColorTempPhysicalMaxMireds",
},
// Remove the default of mandatory color mode field which points to (feature specific) color mode XY
{
tag: "attribute",
id: 0x8,
name: "ColorMode",
default: FieldValue.None,
},
// Override primary conformance using our ">" extension to conformance syntax
{ tag: "attribute", id: 0x11, name: "Primary1X", conformance: "NumberOfPrimaries > 0" },
{ tag: "attribute", id: 0x12, name: "Primary1Y", conformance: "NumberOfPrimaries > 0" },
{ tag: "attribute", id: 0x13, name: "Primary1Intensity", conformance: "NumberOfPrimaries > 0" },
{ tag: "attribute", id: 0x15, name: "Primary2X", conformance: "NumberOfPrimaries > 1" },
{ tag: "attribute", id: 0x16, name: "Primary2Y", conformance: "NumberOfPrimaries > 1" },
{ tag: "attribute", id: 0x17, name: "Primary2Intensity", conformance: "NumberOfPrimaries > 1" },
{ tag: "attribute", id: 0x19, name: "Primary3X", conformance: "NumberOfPrimaries > 2" },
{ tag: "attribute", id: 0x1a, name: "Primary3Y", conformance: "NumberOfPrimaries > 2" },
{ tag: "attribute", id: 0x1b, name: "Primary3Intensity", conformance: "NumberOfPrimaries > 2" },
{ tag: "attribute", id: 0x20, name: "Primary4X", conformance: "NumberOfPrimaries > 3" },
{ tag: "attribute", id: 0x21, name: "Primary4Y", conformance: "NumberOfPrimaries > 3" },
{ tag: "attribute", id: 0x22, name: "Primary4Intensity", conformance: "NumberOfPrimaries > 3" },
{ tag: "attribute", id: 0x24, name: "Primary5X", conformance: "NumberOfPrimaries > 4" },
{ tag: "attribute", id: 0x25, name: "Primary5Y", conformance: "NumberOfPrimaries > 4" },
{ tag: "attribute", id: 0x26, name: "Primary5Intensity", conformance: "NumberOfPrimaries > 4" },
{ tag: "attribute", id: 0x28, name: "Primary6X", conformance: "NumberOfPrimaries > 5" },
{ tag: "attribute", id: 0x29, name: "Primary6Y", conformance: "NumberOfPrimaries > 5" },
{ tag: "attribute", id: 0x2a, name: "Primary6Intensity", conformance: "NumberOfPrimaries > 5" },
// Convert the enum like number usage to an enum for convenience
{
tag: "attribute",
id: 0x4002,
name: "ColorLoopActive",
type: "enum8",
children: [
{ tag: "field", name: "Inactive", id: 0 },
{ tag: "field", name: "Active", id: 1 },
],
},
// Convert the enum like number usage to an enum for convenience
{
tag: "attribute",
id: 0x4003,
name: "ColorLoopDirection",
type: "enum16",
until: "1.4",
children: [
{ tag: "field", name: "Decrement", id: 0 },
{ tag: "field", name: "Increment", id: 1 },
],
},
// In 1.4 they created ColorLoopDirectionEnum but left the type of ColorLoopDirection attribute as uint8
{
tag: "attribute",
id: 0x4003,
asOf: "1.4",
name: "ColorLoopDirection",
type: "ColorLoopDirectionEnum",
},
// Spec defines conformance on these as "CT | ColorTemperatureMireds" which doesn't make sense because
// conformance on ColorTemperatureMireds is "CT"
{
tag: "attribute",
id: 0x400d,
name: "CoupleColorTempToLevelMinMireds",
conformance: "CT & ColorTemperatureMireds",
},
{
tag: "attribute",
id: 0x4010,
name: "StartUpColorTemperatureMireds",
conformance: "CT & ColorTemperatureMireds",
},
// Spec states the values of this bitmap are the same as the feature map.
// Fixed in spec 1.5 via ColorCapabilitiesBitmap type definition.
{
tag: "attribute",
id: 0x400a,
name: "ColorCapabilities",
type: "map16",
until: "1.4.2",
children: [
{
tag: "field",
name: "HueSaturation",
constraint: "0",
},
{
tag: "field",
name: "EnhancedHue",
constraint: "1",
},
{
tag: "field",
name: "ColorLoop",
constraint: "2",
},
{
tag: "field",
name: "XY",
constraint: "3",
},
{
tag: "field",
name: "ColorTemperature",
constraint: "4",
},
],
},
// Set the correct type of MoveMode because just in the description
{
tag: "command",
id: 0x4b,
name: "MoveColorTemperature",
until: "1.3",
children: [
{ tag: "field", name: "MoveMode", id: 0x0, type: "MoveModeEnum", conformance: "M", constraint: "desc" },
],
},
// Set the correct type if StepMode because just in the description
{
tag: "command",
id: 0x4c,
name: "StepColorTemperature",
until: "1.3",
children: [
{ tag: "field", name: "StepMode", id: 0x0, type: "StepModeEnum", conformance: "M", constraint: "desc" },
],
},
],
});