-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathWindowCoveringOverrides.ts
303 lines (273 loc) · 13.1 KB
/
WindowCoveringOverrides.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
/**
* @license
* Copyright 2022-2024 Matter.js Authors
* SPDX-License-Identifier: Apache-2.0
*/
import { ClusterElement as Cluster } from "@matter/model";
import { LocalMatter } from "../local.js";
LocalMatter.children.push(
Cluster({
tag: "cluster",
name: "WindowCovering",
children: [
// Formal definition of operational status bitmap fields
{
tag: "datatype",
type: "enum8",
name: "MovementStatus",
details: "Values for OperationalStatus attribute fields.",
children: [
{
tag: "field",
id: 0,
name: "Stopped",
details: "Covering is not moving",
},
{
tag: "field",
id: 1,
name: "Opening",
details: "Covering is moving from closed to open",
},
{
tag: "field",
id: 2,
name: "Closing",
details: "Covering is moving from open to closed",
},
],
},
// Set Mode field names. They're correct in chip.ts but only placeholders in spec.ts. Since spec overrides
// chip for names we need to re-write them here
{
tag: "attribute",
id: 0x17,
name: "Mode",
// Spec fixed in 1.2
until: "1.2",
children: [
{ tag: "field", name: "MotorDirectionReversed", constraint: "0" },
{ tag: "field", name: "CalibrationMode", constraint: "1" },
{ tag: "field", name: "MaintenanceMode", constraint: "2" },
{ tag: "field", name: "LedFeedback", constraint: "3" },
],
},
// Set the name of the ConfigStatus config fields. Same issue as for Mode
{
tag: "attribute",
id: 7,
name: "ConfigStatus",
// Spec fixed in 1.2
until: "1.2",
children: [
{ tag: "field", name: "Operational", constraint: "0" },
{ tag: "field", name: "OnlineReserved", constraint: "1" },
{ tag: "field", name: "LiftMovementReversed", constraint: "2" },
{ tag: "field", name: "LiftPositionAware", constraint: "3" },
{ tag: "field", name: "TiltPositionAware", constraint: "4" },
{ tag: "field", name: "LiftEncoderControlled", constraint: "5" },
{ tag: "field", name: "TiltEncoderControlled", constraint: "6" },
],
},
// Add conformance to the Type attribute
{
tag: "attribute",
id: 0,
name: "Type",
// In 1.2 conformance is still defined incorrectly but definitions moved to TypeEnum (see next
// definition)
until: "1.2",
children: [
{ tag: "field", name: "Rollershade", id: 0, conformance: "LF & !TL" },
{ tag: "field", name: "Rollershade2Motor", id: 1, conformance: "LF & !TL" },
{ tag: "field", name: "RollershadeExterior", id: 2, conformance: "LF & !TL" },
{ tag: "field", name: "RollershadeExterior2Motor", id: 3, conformance: "LF & !TL" },
{ tag: "field", name: "Drapery", id: 4, conformance: "LF & !TL" },
{ tag: "field", name: "Awning", id: 5, conformance: "LF & !TL" },
// see https://github.com/project-chip/connectedhomeip/issues/33135
{ tag: "field", name: "Shutter", id: 6, conformance: "LF | TL" },
{ tag: "field", name: "TiltBlindTiltOnly", id: 7, conformance: "!LF & TL" },
{ tag: "field", name: "TiltBlindLift", id: 8, conformance: "LF & TL" },
{ tag: "field", name: "ProjectorScreen", id: 9, conformance: "LF & !TL" },
{ tag: "field", name: "Unknown", id: 255, conformance: "O" },
],
},
// Add conformance to TypeEnum
{
tag: "datatype",
name: "TypeEnum",
asOf: "1.2",
children: [
{ tag: "field", name: "Rollershade", id: 0, conformance: "LF & !TL" },
{ tag: "field", name: "Rollershade2Motor", id: 1, conformance: "LF & !TL" },
{ tag: "field", name: "RollershadeExterior", id: 2, conformance: "LF & !TL" },
{ tag: "field", name: "RollershadeExterior2Motor", id: 3, conformance: "LF & !TL" },
{ tag: "field", name: "Drapery", id: 4, conformance: "LF & !TL" },
{ tag: "field", name: "Awning", id: 5, conformance: "LF & !TL" },
// see https://github.com/project-chip/connectedhomeip/issues/33135
{ tag: "field", name: "Shutter", id: 6, conformance: "LF | TL" },
{ tag: "field", name: "TiltBlindTiltOnly", id: 7, conformance: "!LF & TL" },
{ tag: "field", name: "TiltBlindLift", id: 8, conformance: "LF & TL" },
{ tag: "field", name: "ProjectorScreen", id: 9, conformance: "LF & !TL" },
{ tag: "field", name: "Unknown", id: 255, conformance: "O" },
],
},
// Add Conformance field to the EndProductType attribute. Unclear if "LF" actually means "LF & !TL" and
// such
{
tag: "attribute",
id: 13,
name: "EndProductType",
// In 1.2 conformance is present (and definitions moved to EndProductTypeEnum)
until: "1.2",
children: [
{ tag: "field", name: "RollerShade", id: 0, conformance: "LF" },
{ tag: "field", name: "RomanShade", id: 1, conformance: "LF" },
{ tag: "field", name: "BalloonShade", id: 2, conformance: "LF" },
{ tag: "field", name: "WovenWood", id: 3, conformance: "LF" },
{ tag: "field", name: "PleatedShade", id: 4, conformance: "LF" },
{ tag: "field", name: "CellularShade", id: 5, conformance: "LF" },
{ tag: "field", name: "LayeredShade", id: 6, conformance: "LF" },
{ tag: "field", name: "LayeredShade2D", id: 7, conformance: "LF" },
{ tag: "field", name: "SheerShade", id: 8, conformance: "LF & TL" },
{ tag: "field", name: "TiltOnlyInteriorBlind", id: 9, conformance: "TL" },
{ tag: "field", name: "InteriorBlind", id: 10, conformance: "LF & TL" },
{ tag: "field", name: "VerticalBlindStripCurtain", id: 11, conformance: "LF & TL" },
{ tag: "field", name: "InteriorVenetianBlind", id: 12, conformance: "LF & TL" },
{ tag: "field", name: "ExteriorVenetianBlind", id: 13, conformance: "LF & TL" },
{ tag: "field", name: "LateralLeftCurtain", id: 14, conformance: "LF" },
{ tag: "field", name: "LateralRightCurtain", id: 15, conformance: "LF" },
{ tag: "field", name: "CentralCurtain", id: 16, conformance: "LF" },
{ tag: "field", name: "RollerShutter", id: 17, conformance: "LF" },
{ tag: "field", name: "ExteriorVerticalScreen", id: 18, conformance: "LF" },
{ tag: "field", name: "AwningTerrace", id: 19, conformance: "LF" },
{ tag: "field", name: "AwningVerticalScreen", id: 20, conformance: "LF" },
{ tag: "field", name: "TiltOnlyPergola", id: 21, conformance: "LF | TL" },
{ tag: "field", name: "SwingingShutter", id: 22, conformance: "LF | TL" },
{ tag: "field", name: "SlidingShutter", id: 23, conformance: "LF | TL" },
{ tag: "field", name: "Unknown", id: 255, conformance: "O" },
],
},
// Set the name, type and description of the OperationalStatus config fields. Otherwise name would be a
// placeholder, type would be a bare number and the description would be overly-verbose bit-level
// descriptions from the spec
{
tag: "attribute",
id: 10,
name: "OperationalStatus",
// Fixed in 1.2, but we still need to install "MovementStatus" as the type (see below)
until: "1.2",
children: [
{
tag: "field",
name: "Global",
type: "MovementStatus",
constraint: "0 to 2",
description: "Movement status of the cover",
},
{
tag: "field",
name: "Lift",
type: "MovementStatus",
constraint: "2 to 4",
description: "Movement status of the cover's lift function",
},
{
tag: "field",
name: "Tilt",
type: "MovementStatus",
constraint: "4 to 6",
description: "Movement status of the cover's tilt function",
},
],
},
// Set the type of the bit fields so code generates with our "MovementStatus" enum
{
tag: "datatype",
name: "OperationalStatusBitmap",
// The type is correct but need to set here so model logic knows to use the constraint for matching
type: "map8",
children: [
{ tag: "field", name: "Global", type: "MovementStatus", constraint: "0 to 2" },
{ tag: "field", name: "Lift", type: "MovementStatus", constraint: "2 to 4" },
{ tag: "field", name: "Tilt", type: "MovementStatus", constraint: "4 to 6" },
],
},
// Adjust the constraints for the GoToLiftValue command parameter to allow automatic validation
{
tag: "command",
name: "GoToLiftValue",
id: 4,
children: [
{
tag: "field",
name: "LiftValue",
id: 0,
type: "uint16",
conformance: "M",
constraint: "InstalledOpenLimitLift to InstalledClosedLimitLift",
},
],
},
// Adjust the constraints for the GoToTiltValue command parameter to allow automatic validation
{
tag: "command",
name: "GoToTiltValue",
id: 7,
children: [
{
tag: "field",
name: "TiltValue",
id: 0,
type: "uint16",
conformance: "M",
constraint: "InstalledOpenLimitTilt to InstalledClosedLimitTilt",
},
],
},
// The spec defines two fields but CHIP only uses the first one with a different datatype. So necessary to
// follow defacto standard rather than specification here
{
tag: "command",
name: "GoToLiftPercentage",
id: 0x5,
children: [
{
id: 0,
tag: "field",
name: "LiftPercent100thsValue",
type: "percent100ths",
conformance: "M",
},
{
id: 1,
tag: "field",
name: "Ignored",
conformance: "X",
},
],
},
// Same issue as for GoToLiftPercentage
{
tag: "command",
name: "GoToTiltPercentage",
id: 0x8,
children: [
{
id: 0,
tag: "field",
name: "TiltPercent100thsValue",
type: "percent100ths",
conformance: "M",
},
{
id: 1,
tag: "field",
name: "Ignored",
conformance: "X",
},
],
},
],
}),
);