-
Notifications
You must be signed in to change notification settings - Fork 50
/
ColorControlOverrides.ts
146 lines (133 loc) · 5.46 KB
/
ColorControlOverrides.ts
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
/**
* @license
* Copyright 2022-2024 Matter.js Authors
* SPDX-License-Identifier: Apache-2.0
*/
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",
},
// 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: "enum16",
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",
children: [
{ tag: "field", name: "Decrement", id: 0 },
{ tag: "field", name: "Increment", id: 1 },
],
},
// 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
{
tag: "attribute",
id: 0x400a,
name: "ColorCapabilities",
type: "map16",
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",
children: [
{ tag: "field", name: "MoveMode", id: 0x0, type: "MoveMode", conformance: "M", constraint: "desc" },
],
},
// Set the correct type if StepMode because just in the description
{
tag: "command",
id: 0x4c,
name: "StepColorTemperature",
children: [
{ tag: "field", name: "StepMode", id: 0x0, type: "StepMode", conformance: "M", constraint: "desc" },
],
},
],
});