@deconz-community/ddf-validator 1.3.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -19
- package/dist/ddf-schema.json +1 -1
- package/dist/ddf-validator.cjs +1 -1
- package/dist/ddf-validator.d.ts +182 -12
- package/dist/ddf-validator.mjs +373 -610
- package/package.json +1 -2
package/dist/ddf-validator.d.ts
CHANGED
|
@@ -1,23 +1,33 @@
|
|
|
1
|
+
import { ZodType } from "zod";
|
|
1
2
|
|
|
2
3
|
export type DDF = {
|
|
3
4
|
$schema?: string | undefined;
|
|
4
5
|
schema: "devcap1.schema.json";
|
|
5
6
|
"doc:path"?: string | undefined;
|
|
6
7
|
"doc:hdr"?: string | undefined;
|
|
8
|
+
/** Know issues for this device, markdown file. */
|
|
7
9
|
"md:known_issues"?: string[] | undefined;
|
|
8
|
-
|
|
10
|
+
/** Manufacturer name from Basic Cluster. */
|
|
11
|
+
manufacturername: ("$MF_BOSCH" | "$MF_IKEA" | "$MF_LUMI" | "$MF_LUTRON" | "$MF_PHILIPS" | "$MF_SAMJIN" | "$MF_SIGNIFY" | "$MF_TUYA" | "$MF_XIAOMI") | string | (("$MF_BOSCH" | "$MF_IKEA" | "$MF_LUMI" | "$MF_LUTRON" | "$MF_PHILIPS" | "$MF_SAMJIN" | "$MF_SIGNIFY" | "$MF_TUYA" | "$MF_XIAOMI") | string)[];
|
|
12
|
+
/** Model ID from Basic Cluster. */
|
|
9
13
|
modelid: string | string[];
|
|
14
|
+
/** Friendly name of the manufacturer. */
|
|
10
15
|
vendor?: string | undefined;
|
|
11
16
|
comment?: string | undefined;
|
|
17
|
+
/** Need to return true for the DDF be used. */
|
|
12
18
|
matchexpr?: string | undefined;
|
|
19
|
+
/** DDF path, useless, can be removed. */
|
|
13
20
|
path?: string | undefined;
|
|
21
|
+
/** Complements the model id to be shown in the UI. */
|
|
14
22
|
product?: string | undefined;
|
|
23
|
+
/** Sleeping devices can only receive when awake. */
|
|
15
24
|
sleeper?: boolean | undefined;
|
|
16
25
|
supportsMgmtBind?: boolean | undefined;
|
|
17
26
|
/** The code quality of the DDF file. */
|
|
18
27
|
status: "Draft" | "Bronze" | "Silver" | "Gold";
|
|
28
|
+
/** Devices section. */
|
|
19
29
|
subdevices: {
|
|
20
|
-
type: "$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$
|
|
30
|
+
type: ("$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_ANCILLARY_CONTROL" | "$TYPE_BATTERY_SENSOR" | "$TYPE_CARBON_MONOXIDE" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_DOOR_LOCK" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$TYPE_OPEN_CLOSE_SENSOR" | "$TYPE_POWER_SENSOR" | "$TYPE_PRESENCE_SENSOR" | "$TYPE_PRESSURE_SENSOR" | "$TYPE_RANGE_EXTENDER" | "$TYPE_RELATIVE_ROTARY" | "$TYPE_SMART_PLUG" | "$TYPE_SPECTRAL_SENSOR" | "$TYPE_SWITCH" | "$TYPE_TEMPERATURE_SENSOR" | "$TYPE_THERMOSTAT" | "$TYPE_TIME" | "$TYPE_VIBRATION_SENSOR" | "$TYPE_WARNING_DEVICE" | "$TYPE_WATER_LEAK_SENSOR" | "$TYPE_WINDOW_COVERING_DEVICE" | "$TYPE_ZGP_SWITCH") | string;
|
|
21
31
|
restapi: "/lights" | "/sensors";
|
|
22
32
|
uuid: [
|
|
23
33
|
"$address.ext",
|
|
@@ -41,121 +51,202 @@ export type DDF = {
|
|
|
41
51
|
buttons?: any | undefined;
|
|
42
52
|
buttonevents?: any | undefined;
|
|
43
53
|
items: {
|
|
44
|
-
|
|
54
|
+
/** Item name. */
|
|
55
|
+
name: "state/windowopen" | "state/water" | "state/voltage" | "state/vibrationstrength" | "state/vibration" | "state/valve" | "state/utc" | "state/tiltangle" | "state/tilt" | "state/test" | "state/temperature" | "state/tampered" | "state/speed" | "state/seconds_remaining" | "state/sat" | "state/rotaryevent" | "state/replacefilter" | "state/reachable" | "state/production" | "state/pressure" | "state/presenceevent" | "state/presence" | "state/power" | "state/pm2_5" | "state/panel" | "state/orientation_z" | "state/orientation_y" | "state/orientation_x" | "state/orientation" | "state/open" | "state/on" | "state/mountingmodeactive" | "state/lux" | "state/lowbattery" | "state/lockstate" | "state/localtime" | "state/lightlevel" | "state/lift" | "state/lastupdated" | "state/lastset" | "state/lastcheckin" | "state/humidity" | "state/hue" | "state/heating" | "state/gradient" | "state/gesture" | "state/fire" | "state/filterruntime" | "state/expectedrotation" | "state/expectedeventduration" | "state/eventduration" | "state/errorcode" | "state/effect" | "state/deviceruntime" | "state/daylight" | "state/dark" | "state/current" | "state/current_P3" | "state/current_P2" | "state/current_P1" | "state/ct" | "state/consumption" | "state/consumption_2" | "state/y" | "state/x" | "state/colormode" | "state/charging" | "state/carbonmonoxide" | "state/buttonevent" | "state/bri" | "state/battery" | "state/angle" | "state/alert" | "state/alarm" | "state/airqualityppb" | "state/airquality" | "state/action" | "config/windowopen_set" | "config/windowcoveringtype" | "config/usertest" | "config/unoccupiedheatsetpoint" | "config/triggerdistance" | "config/tholdoffset" | "config/tholddark" | "config/temperature" | "config/swingmode" | "config/sensitivitymax" | "config/sensitivity" | "config/selftest" | "config/schedule_on" | "config/schedule" | "config/resetpresence" | "config/reachable" | "config/pulseconfiguration" | "config/preset" | "config/pending" | "config/on/startup" | "config/on" | "config/offset" | "config/mountingmode" | "config/mode" | "config/locked" | "config/lock" | "config/ledindication" | "config/interfacemode" | "config/heatsetpoint" | "config/group" | "config/filterlifetime" | "config/fanmode" | "config/externalwindowopen" | "config/externalsensortemp" | "config/enrolled" | "config/duration" | "config/displayflipped" | "config/devicemode" | "config/delay" | "config/ctmin" | "config/ctmax" | "config/coolsetpoint" | "config/controlsequence" | "config/configured" | "config/colorcapabilities" | "config/color/xy/startup_y" | "config/color/xy/startup_x" | "config/color/gradient/reversed" | "config/color/execute_if_off" | "config/color/ct/startup" | "config/clickmode" | "config/checkin" | "config/bri/startup" | "config/bri/onoff_transitiontime" | "config/bri/on_level" | "config/bri/min" | "config/bri/max" | "config/bri/execute_if_off" | "config/battery" | "config/allowtouchlink" | "config/alert" | "cap/transition_block" | "cap/sleeper" | "cap/on/off_with_effect" | "cap/groups/not_supported" | "cap/color/xy/red_y" | "cap/color/xy/red_x" | "cap/color/xy/green_y" | "cap/color/xy/green_x" | "cap/color/xy/blue_y" | "cap/color/xy/blue_x" | "cap/color/gradient/styles" | "cap/color/gradient/pixel_length" | "cap/color/gradient/pixel_count" | "cap/color/gradient/max_segments" | "cap/color/gamut_type" | "cap/color/effects" | "cap/color/ct/min" | "cap/color/ct/max" | "cap/color/ct/computes_xy" | "cap/color/capabilities" | "cap/bri/move_with_onoff" | "cap/bri/min_dim_level" | "cap/alert/trigger_effect" | "attr/uniqueid" | "attr/type" | "attr/swversion" | "attr/swconfigid" | "attr/productname" | "attr/productid" | "attr/powerup" | "attr/poweronlevel" | "attr/poweronct" | "attr/name" | "attr/modelid" | "attr/mode" | "attr/manufacturername" | "attr/lastseen" | "attr/lastannounced" | "attr/id";
|
|
56
|
+
/** Item description, better to do not use it. */
|
|
45
57
|
description?: string | undefined;
|
|
46
58
|
comment?: string | undefined;
|
|
59
|
+
/** Item visible on the API. */
|
|
47
60
|
public?: boolean | undefined;
|
|
61
|
+
/** A static default value is fixed and can be not changed. */
|
|
48
62
|
static?: (string | number | boolean) | undefined;
|
|
63
|
+
/** Values range limit. */
|
|
49
64
|
range?: [
|
|
50
65
|
number,
|
|
51
66
|
number
|
|
52
67
|
] | undefined;
|
|
53
68
|
deprecated?: string | undefined;
|
|
69
|
+
/** Access mode for this item, some of them are not editable. */
|
|
54
70
|
access?: "R" | undefined;
|
|
71
|
+
/** Fonction used to read value. */
|
|
55
72
|
read?: ({
|
|
56
73
|
fn: "none";
|
|
57
74
|
} | {
|
|
75
|
+
/** Generic function to read ZCL attributes. */
|
|
58
76
|
fn?: undefined;
|
|
59
|
-
|
|
77
|
+
/** Attribute ID. */
|
|
78
|
+
at: string | string[];
|
|
79
|
+
/** Cluster ID. */
|
|
60
80
|
cl: string;
|
|
81
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
61
82
|
ep?: (string | number) | undefined;
|
|
83
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
62
84
|
mf?: string | undefined;
|
|
85
|
+
/** Javascript expression to transform the raw value. */
|
|
63
86
|
eval?: string | undefined;
|
|
64
87
|
} | {
|
|
88
|
+
/** Generic function to read ZCL attributes. */
|
|
65
89
|
fn: "zcl";
|
|
66
|
-
|
|
90
|
+
/** Attribute ID. */
|
|
91
|
+
at: string | string[];
|
|
92
|
+
/** Cluster ID. */
|
|
67
93
|
cl: string;
|
|
94
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
68
95
|
ep?: (string | number) | undefined;
|
|
96
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
69
97
|
mf?: string | undefined;
|
|
98
|
+
/** Javascript expression to transform the raw value. */
|
|
70
99
|
eval?: string | undefined;
|
|
71
100
|
} | {
|
|
101
|
+
/** Generic function to read all Tuya datapoints. It has no parameters. */
|
|
72
102
|
fn: "tuya";
|
|
73
103
|
}) | undefined;
|
|
104
|
+
/** Fonction used to parse incoming values. */
|
|
74
105
|
parse?: ({
|
|
106
|
+
/** Generic function to parse ZCL attributes and commands. */
|
|
75
107
|
fn?: undefined;
|
|
108
|
+
/** Attribute ID. */
|
|
76
109
|
at?: string | undefined;
|
|
110
|
+
/** Cluster ID. */
|
|
77
111
|
cl: string;
|
|
78
112
|
cppsrc?: string | undefined;
|
|
113
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
79
114
|
ep?: (string | number) | undefined;
|
|
115
|
+
/** Zigbee command. */
|
|
80
116
|
cmd?: string | undefined;
|
|
117
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
81
118
|
mf?: string | undefined;
|
|
119
|
+
/** Javascript expression to transform the raw value. */
|
|
82
120
|
eval?: string | undefined;
|
|
121
|
+
/** Relative path of a Javascript .js file. */
|
|
83
122
|
script?: string | undefined;
|
|
84
123
|
} | {
|
|
124
|
+
/** Generic function to parse ZCL attributes and commands. */
|
|
85
125
|
fn: "zcl";
|
|
126
|
+
/** Attribute ID. */
|
|
86
127
|
at?: string | undefined;
|
|
128
|
+
/** Cluster ID. */
|
|
87
129
|
cl: string;
|
|
88
130
|
cppsrc?: string | undefined;
|
|
131
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
89
132
|
ep?: (string | number) | undefined;
|
|
133
|
+
/** Zigbee command. */
|
|
90
134
|
cmd?: string | undefined;
|
|
135
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
91
136
|
mf?: string | undefined;
|
|
137
|
+
/** Javascript expression to transform the raw value. */
|
|
92
138
|
eval?: string | undefined;
|
|
139
|
+
/** Relative path of a Javascript .js file. */
|
|
93
140
|
script?: string | undefined;
|
|
94
141
|
} | {
|
|
142
|
+
/** Generic function to parse IAS ZONE status change notifications or zone status from read/report command. */
|
|
95
143
|
fn: "ias:zonestatus";
|
|
144
|
+
/** Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status. */
|
|
96
145
|
mask?: (("alarm1" | "alarm2") | "alarm1,alarm2") | undefined;
|
|
97
146
|
} | {
|
|
147
|
+
/** Generic function to to convert number to string. */
|
|
98
148
|
fn: "numtostr";
|
|
149
|
+
/** The source item holding the number. */
|
|
99
150
|
srcitem: "state/airqualityppb" | "state/pm2_5";
|
|
100
|
-
|
|
151
|
+
/** Comparison operator (lt | le | eq | gt | ge) */
|
|
152
|
+
op: "lt" | "le" | "eq" | "gt" | "ge";
|
|
153
|
+
/** Array of (num, string) mappings */
|
|
101
154
|
to: any;
|
|
102
155
|
} | {
|
|
156
|
+
/** Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed. */
|
|
103
157
|
fn: "time";
|
|
104
158
|
} | {
|
|
159
|
+
/** Generic function to parse custom Xiaomi attributes and commands. */
|
|
105
160
|
fn: "xiaomi:special";
|
|
161
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
106
162
|
ep?: (string | number) | undefined;
|
|
163
|
+
/** Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7 */
|
|
107
164
|
at?: string | undefined;
|
|
165
|
+
/** A 8-bit string hex value. */
|
|
108
166
|
idx: string;
|
|
167
|
+
/** Javascript expression to transform the raw value. */
|
|
109
168
|
eval?: string | undefined;
|
|
169
|
+
/** Relative path of a Javascript .js file. */
|
|
110
170
|
script?: string | undefined;
|
|
111
171
|
} | {
|
|
172
|
+
/** Generic function to parse Tuya data. */
|
|
112
173
|
fn: "tuya";
|
|
174
|
+
/** Data point ID. 1-255 the datapoint ID. */
|
|
113
175
|
dpid: number;
|
|
176
|
+
/** Javascript expression to transform the raw value. */
|
|
114
177
|
eval?: string | undefined;
|
|
178
|
+
/** Relative path of a Javascript .js file. */
|
|
115
179
|
script?: string | undefined;
|
|
116
180
|
}) | undefined;
|
|
181
|
+
/** Fonction used to write value. */
|
|
117
182
|
write?: ({
|
|
118
183
|
fn: "none";
|
|
119
184
|
} | {
|
|
120
185
|
fn?: undefined;
|
|
186
|
+
/** Attribute ID. */
|
|
121
187
|
at?: (string | string[]) | undefined;
|
|
122
188
|
"state.timeout"?: number | undefined;
|
|
123
189
|
"change.timeout"?: number | undefined;
|
|
190
|
+
/** Cluster ID. */
|
|
124
191
|
cl: string;
|
|
192
|
+
/** Data type. */
|
|
125
193
|
dt: string;
|
|
194
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
126
195
|
ep?: (string | number) | undefined;
|
|
196
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
127
197
|
mf?: string | undefined;
|
|
198
|
+
/** Javascript expression to transform the raw value. */
|
|
128
199
|
eval?: string | undefined;
|
|
200
|
+
/** Relative path of a Javascript .js file. */
|
|
129
201
|
script?: string | undefined;
|
|
130
202
|
} | {
|
|
131
203
|
fn: "zcl";
|
|
204
|
+
/** Attribute ID. */
|
|
132
205
|
at?: (string | string[]) | undefined;
|
|
133
206
|
"state.timeout"?: number | undefined;
|
|
134
207
|
"change.timeout"?: number | undefined;
|
|
208
|
+
/** Cluster ID. */
|
|
135
209
|
cl: string;
|
|
210
|
+
/** Data type. */
|
|
136
211
|
dt: string;
|
|
212
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
137
213
|
ep?: (string | number) | undefined;
|
|
214
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
138
215
|
mf?: string | undefined;
|
|
216
|
+
/** Javascript expression to transform the raw value. */
|
|
139
217
|
eval?: string | undefined;
|
|
218
|
+
/** Relative path of a Javascript .js file. */
|
|
140
219
|
script?: string | undefined;
|
|
141
220
|
} | {
|
|
221
|
+
/** Generic function to write Tuya data. */
|
|
142
222
|
fn: "tuya";
|
|
223
|
+
/** Data point ID. 1-255 the datapoint ID. */
|
|
143
224
|
dpid: number;
|
|
225
|
+
/** Data type. */
|
|
144
226
|
dt: string;
|
|
227
|
+
/** Javascript expression to transform the raw value. */
|
|
145
228
|
eval?: string | undefined;
|
|
229
|
+
/** Relative path of a Javascript .js file. */
|
|
146
230
|
script?: string | undefined;
|
|
147
231
|
}) | undefined;
|
|
232
|
+
/** The device is considered awake when this item is set due a incoming command. */
|
|
148
233
|
awake?: boolean | undefined;
|
|
234
|
+
/** Defaut value. */
|
|
149
235
|
default?: unknown | undefined;
|
|
150
236
|
values?: unknown | undefined;
|
|
237
|
+
/** Refresh interval used for read fonction, NEED to be superior at value used in binding part. */
|
|
151
238
|
"refresh.interval"?: number | undefined;
|
|
152
239
|
}[];
|
|
153
240
|
example?: unknown | undefined;
|
|
154
241
|
}[];
|
|
242
|
+
/** Bindings section. */
|
|
155
243
|
bindings?: ({
|
|
156
244
|
bind: "unicast";
|
|
245
|
+
/** Source endpoint. */
|
|
157
246
|
"src.ep": string | number;
|
|
247
|
+
/** Destination endpoint, generaly 0x01. */
|
|
158
248
|
"dst.ep"?: (string | number) | undefined;
|
|
249
|
+
/** Cluster. */
|
|
159
250
|
cl: string;
|
|
160
251
|
report?: {
|
|
161
252
|
at: string;
|
|
@@ -167,7 +258,9 @@ export type DDF = {
|
|
|
167
258
|
}[] | undefined;
|
|
168
259
|
} | {
|
|
169
260
|
bind: "groupcast";
|
|
261
|
+
/** Source endpoint. */
|
|
170
262
|
"src.ep": string | number;
|
|
263
|
+
/** Cluster. */
|
|
171
264
|
cl: string;
|
|
172
265
|
"config.group": number;
|
|
173
266
|
})[] | undefined;
|
|
@@ -194,96 +287,161 @@ export type DDF = {
|
|
|
194
287
|
static?: boolean | undefined;
|
|
195
288
|
virtual?: boolean | undefined;
|
|
196
289
|
parse?: ({
|
|
290
|
+
/** Generic function to parse ZCL attributes and commands. */
|
|
197
291
|
fn?: undefined;
|
|
292
|
+
/** Attribute ID. */
|
|
198
293
|
at?: string | undefined;
|
|
294
|
+
/** Cluster ID. */
|
|
199
295
|
cl: string;
|
|
200
296
|
cppsrc?: string | undefined;
|
|
297
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
201
298
|
ep?: (string | number) | undefined;
|
|
299
|
+
/** Zigbee command. */
|
|
202
300
|
cmd?: string | undefined;
|
|
301
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
203
302
|
mf?: string | undefined;
|
|
303
|
+
/** Javascript expression to transform the raw value. */
|
|
204
304
|
eval?: string | undefined;
|
|
305
|
+
/** Relative path of a Javascript .js file. */
|
|
205
306
|
script?: string | undefined;
|
|
206
307
|
} | {
|
|
308
|
+
/** Generic function to parse ZCL attributes and commands. */
|
|
207
309
|
fn: "zcl";
|
|
310
|
+
/** Attribute ID. */
|
|
208
311
|
at?: string | undefined;
|
|
312
|
+
/** Cluster ID. */
|
|
209
313
|
cl: string;
|
|
210
314
|
cppsrc?: string | undefined;
|
|
315
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
211
316
|
ep?: (string | number) | undefined;
|
|
317
|
+
/** Zigbee command. */
|
|
212
318
|
cmd?: string | undefined;
|
|
319
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
213
320
|
mf?: string | undefined;
|
|
321
|
+
/** Javascript expression to transform the raw value. */
|
|
214
322
|
eval?: string | undefined;
|
|
323
|
+
/** Relative path of a Javascript .js file. */
|
|
215
324
|
script?: string | undefined;
|
|
216
325
|
} | {
|
|
326
|
+
/** Generic function to parse IAS ZONE status change notifications or zone status from read/report command. */
|
|
217
327
|
fn: "ias:zonestatus";
|
|
328
|
+
/** Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status. */
|
|
218
329
|
mask?: (("alarm1" | "alarm2") | "alarm1,alarm2") | undefined;
|
|
219
330
|
} | {
|
|
331
|
+
/** Generic function to to convert number to string. */
|
|
220
332
|
fn: "numtostr";
|
|
333
|
+
/** The source item holding the number. */
|
|
221
334
|
srcitem: "state/airqualityppb" | "state/pm2_5";
|
|
222
|
-
|
|
335
|
+
/** Comparison operator (lt | le | eq | gt | ge) */
|
|
336
|
+
op: "lt" | "le" | "eq" | "gt" | "ge";
|
|
337
|
+
/** Array of (num, string) mappings */
|
|
223
338
|
to: any;
|
|
224
339
|
} | {
|
|
340
|
+
/** Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed. */
|
|
225
341
|
fn: "time";
|
|
226
342
|
} | {
|
|
343
|
+
/** Generic function to parse custom Xiaomi attributes and commands. */
|
|
227
344
|
fn: "xiaomi:special";
|
|
345
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
228
346
|
ep?: (string | number) | undefined;
|
|
347
|
+
/** Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7 */
|
|
229
348
|
at?: string | undefined;
|
|
349
|
+
/** A 8-bit string hex value. */
|
|
230
350
|
idx: string;
|
|
351
|
+
/** Javascript expression to transform the raw value. */
|
|
231
352
|
eval?: string | undefined;
|
|
353
|
+
/** Relative path of a Javascript .js file. */
|
|
232
354
|
script?: string | undefined;
|
|
233
355
|
} | {
|
|
356
|
+
/** Generic function to parse Tuya data. */
|
|
234
357
|
fn: "tuya";
|
|
358
|
+
/** Data point ID. 1-255 the datapoint ID. */
|
|
235
359
|
dpid: number;
|
|
360
|
+
/** Javascript expression to transform the raw value. */
|
|
236
361
|
eval?: string | undefined;
|
|
362
|
+
/** Relative path of a Javascript .js file. */
|
|
237
363
|
script?: string | undefined;
|
|
238
364
|
}) | undefined;
|
|
239
365
|
read?: ({
|
|
240
366
|
fn: "none";
|
|
241
367
|
} | {
|
|
368
|
+
/** Generic function to read ZCL attributes. */
|
|
242
369
|
fn?: undefined;
|
|
243
|
-
|
|
370
|
+
/** Attribute ID. */
|
|
371
|
+
at: string | string[];
|
|
372
|
+
/** Cluster ID. */
|
|
244
373
|
cl: string;
|
|
374
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
245
375
|
ep?: (string | number) | undefined;
|
|
376
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
246
377
|
mf?: string | undefined;
|
|
378
|
+
/** Javascript expression to transform the raw value. */
|
|
247
379
|
eval?: string | undefined;
|
|
248
380
|
} | {
|
|
381
|
+
/** Generic function to read ZCL attributes. */
|
|
249
382
|
fn: "zcl";
|
|
250
|
-
|
|
383
|
+
/** Attribute ID. */
|
|
384
|
+
at: string | string[];
|
|
385
|
+
/** Cluster ID. */
|
|
251
386
|
cl: string;
|
|
387
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
252
388
|
ep?: (string | number) | undefined;
|
|
389
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
253
390
|
mf?: string | undefined;
|
|
391
|
+
/** Javascript expression to transform the raw value. */
|
|
254
392
|
eval?: string | undefined;
|
|
255
393
|
} | {
|
|
394
|
+
/** Generic function to read all Tuya datapoints. It has no parameters. */
|
|
256
395
|
fn: "tuya";
|
|
257
396
|
}) | undefined;
|
|
258
397
|
write?: ({
|
|
259
398
|
fn: "none";
|
|
260
399
|
} | {
|
|
261
400
|
fn?: undefined;
|
|
401
|
+
/** Attribute ID. */
|
|
262
402
|
at?: (string | string[]) | undefined;
|
|
263
403
|
"state.timeout"?: number | undefined;
|
|
264
404
|
"change.timeout"?: number | undefined;
|
|
405
|
+
/** Cluster ID. */
|
|
265
406
|
cl: string;
|
|
407
|
+
/** Data type. */
|
|
266
408
|
dt: string;
|
|
409
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
267
410
|
ep?: (string | number) | undefined;
|
|
411
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
268
412
|
mf?: string | undefined;
|
|
413
|
+
/** Javascript expression to transform the raw value. */
|
|
269
414
|
eval?: string | undefined;
|
|
415
|
+
/** Relative path of a Javascript .js file. */
|
|
270
416
|
script?: string | undefined;
|
|
271
417
|
} | {
|
|
272
418
|
fn: "zcl";
|
|
419
|
+
/** Attribute ID. */
|
|
273
420
|
at?: (string | string[]) | undefined;
|
|
274
421
|
"state.timeout"?: number | undefined;
|
|
275
422
|
"change.timeout"?: number | undefined;
|
|
423
|
+
/** Cluster ID. */
|
|
276
424
|
cl: string;
|
|
425
|
+
/** Data type. */
|
|
277
426
|
dt: string;
|
|
427
|
+
/** Endpoint, 255 means any endpoint, 0 means auto selected from subdevice. */
|
|
278
428
|
ep?: (string | number) | undefined;
|
|
429
|
+
/** Manufacturer code, must be set to 0x0000 for non manufacturer specific commands. */
|
|
279
430
|
mf?: string | undefined;
|
|
431
|
+
/** Javascript expression to transform the raw value. */
|
|
280
432
|
eval?: string | undefined;
|
|
433
|
+
/** Relative path of a Javascript .js file. */
|
|
281
434
|
script?: string | undefined;
|
|
282
435
|
} | {
|
|
436
|
+
/** Generic function to write Tuya data. */
|
|
283
437
|
fn: "tuya";
|
|
438
|
+
/** Data point ID. 1-255 the datapoint ID. */
|
|
284
439
|
dpid: number;
|
|
440
|
+
/** Data type. */
|
|
285
441
|
dt: string;
|
|
442
|
+
/** Javascript expression to transform the raw value. */
|
|
286
443
|
eval?: string | undefined;
|
|
444
|
+
/** Relative path of a Javascript .js file. */
|
|
287
445
|
script?: string | undefined;
|
|
288
446
|
}) | undefined;
|
|
289
447
|
"refresh.interval"?: number | undefined;
|
|
@@ -296,7 +454,7 @@ export type DDF = {
|
|
|
296
454
|
} | {
|
|
297
455
|
$schema?: string | undefined;
|
|
298
456
|
schema: "subdevice1.schema.json";
|
|
299
|
-
type: "$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$
|
|
457
|
+
type: ("$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_ANCILLARY_CONTROL" | "$TYPE_BATTERY_SENSOR" | "$TYPE_CARBON_MONOXIDE" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_DOOR_LOCK" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$TYPE_OPEN_CLOSE_SENSOR" | "$TYPE_POWER_SENSOR" | "$TYPE_PRESENCE_SENSOR" | "$TYPE_PRESSURE_SENSOR" | "$TYPE_RANGE_EXTENDER" | "$TYPE_RELATIVE_ROTARY" | "$TYPE_SMART_PLUG" | "$TYPE_SPECTRAL_SENSOR" | "$TYPE_SWITCH" | "$TYPE_TEMPERATURE_SENSOR" | "$TYPE_THERMOSTAT" | "$TYPE_TIME" | "$TYPE_VIBRATION_SENSOR" | "$TYPE_WARNING_DEVICE" | "$TYPE_WATER_LEAK_SENSOR" | "$TYPE_WINDOW_COVERING_DEVICE" | "$TYPE_ZGP_SWITCH") | string;
|
|
300
458
|
name: string;
|
|
301
459
|
restapi: "/lights" | "/sensors";
|
|
302
460
|
order: number;
|
|
@@ -308,9 +466,21 @@ export type DDF = {
|
|
|
308
466
|
string,
|
|
309
467
|
string
|
|
310
468
|
];
|
|
311
|
-
items: ("
|
|
469
|
+
items: ("state/windowopen" | "state/water" | "state/voltage" | "state/vibrationstrength" | "state/vibration" | "state/valve" | "state/utc" | "state/tiltangle" | "state/tilt" | "state/test" | "state/temperature" | "state/tampered" | "state/speed" | "state/seconds_remaining" | "state/sat" | "state/rotaryevent" | "state/replacefilter" | "state/reachable" | "state/production" | "state/pressure" | "state/presenceevent" | "state/presence" | "state/power" | "state/pm2_5" | "state/panel" | "state/orientation_z" | "state/orientation_y" | "state/orientation_x" | "state/orientation" | "state/open" | "state/on" | "state/mountingmodeactive" | "state/lux" | "state/lowbattery" | "state/lockstate" | "state/localtime" | "state/lightlevel" | "state/lift" | "state/lastupdated" | "state/lastset" | "state/lastcheckin" | "state/humidity" | "state/hue" | "state/heating" | "state/gradient" | "state/gesture" | "state/fire" | "state/filterruntime" | "state/expectedrotation" | "state/expectedeventduration" | "state/eventduration" | "state/errorcode" | "state/effect" | "state/deviceruntime" | "state/daylight" | "state/dark" | "state/current" | "state/current_P3" | "state/current_P2" | "state/current_P1" | "state/ct" | "state/consumption" | "state/consumption_2" | "state/y" | "state/x" | "state/colormode" | "state/charging" | "state/carbonmonoxide" | "state/buttonevent" | "state/bri" | "state/battery" | "state/angle" | "state/alert" | "state/alarm" | "state/airqualityppb" | "state/airquality" | "state/action" | "config/windowopen_set" | "config/windowcoveringtype" | "config/usertest" | "config/unoccupiedheatsetpoint" | "config/triggerdistance" | "config/tholdoffset" | "config/tholddark" | "config/temperature" | "config/swingmode" | "config/sensitivitymax" | "config/sensitivity" | "config/selftest" | "config/schedule_on" | "config/schedule" | "config/resetpresence" | "config/reachable" | "config/pulseconfiguration" | "config/preset" | "config/pending" | "config/on/startup" | "config/on" | "config/offset" | "config/mountingmode" | "config/mode" | "config/locked" | "config/lock" | "config/ledindication" | "config/interfacemode" | "config/heatsetpoint" | "config/group" | "config/filterlifetime" | "config/fanmode" | "config/externalwindowopen" | "config/externalsensortemp" | "config/enrolled" | "config/duration" | "config/displayflipped" | "config/devicemode" | "config/delay" | "config/ctmin" | "config/ctmax" | "config/coolsetpoint" | "config/controlsequence" | "config/configured" | "config/colorcapabilities" | "config/color/xy/startup_y" | "config/color/xy/startup_x" | "config/color/gradient/reversed" | "config/color/execute_if_off" | "config/color/ct/startup" | "config/clickmode" | "config/checkin" | "config/bri/startup" | "config/bri/onoff_transitiontime" | "config/bri/on_level" | "config/bri/min" | "config/bri/max" | "config/bri/execute_if_off" | "config/battery" | "config/allowtouchlink" | "config/alert" | "cap/transition_block" | "cap/sleeper" | "cap/on/off_with_effect" | "cap/groups/not_supported" | "cap/color/xy/red_y" | "cap/color/xy/red_x" | "cap/color/xy/green_y" | "cap/color/xy/green_x" | "cap/color/xy/blue_y" | "cap/color/xy/blue_x" | "cap/color/gradient/styles" | "cap/color/gradient/pixel_length" | "cap/color/gradient/pixel_count" | "cap/color/gradient/max_segments" | "cap/color/gamut_type" | "cap/color/effects" | "cap/color/ct/min" | "cap/color/ct/max" | "cap/color/ct/computes_xy" | "cap/color/capabilities" | "cap/bri/move_with_onoff" | "cap/bri/min_dim_level" | "cap/alert/trigger_effect" | "attr/uniqueid" | "attr/type" | "attr/swversion" | "attr/swconfigid" | "attr/productname" | "attr/productid" | "attr/powerup" | "attr/poweronlevel" | "attr/poweronct" | "attr/name" | "attr/modelid" | "attr/mode" | "attr/manufacturername" | "attr/lastseen" | "attr/lastannounced" | "attr/id")[];
|
|
312
470
|
};
|
|
313
471
|
|
|
314
|
-
export
|
|
472
|
+
export interface GenericsData {
|
|
473
|
+
attributes: string[]
|
|
474
|
+
manufacturers: Record<string, string>
|
|
475
|
+
deviceTypes: Record<string, string>
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
export declare function createValidator(generics?: GenericsData): {
|
|
480
|
+
generics: GenericsData;
|
|
481
|
+
loadGeneric: (data: unknown) => DDF;
|
|
482
|
+
validate: (data: unknown) => DDF;
|
|
483
|
+
getSchema: () => ZodType<DDF>;
|
|
484
|
+
};
|
|
315
485
|
|
|
316
486
|
export {};
|