@zwave-js/cc 10.0.1-0-pr-4836-e8a3d62 → 10.0.2

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.
@@ -1,1203 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ScheduleEntryLockCCDailyRepeatingScheduleGet = exports.ScheduleEntryLockCCDailyRepeatingScheduleReport = exports.ScheduleEntryLockCCDailyRepeatingScheduleSet = exports.ScheduleEntryLockCCTimeOffsetGet = exports.ScheduleEntryLockCCTimeOffsetReport = exports.ScheduleEntryLockCCTimeOffsetSet = exports.ScheduleEntryLockCCYearDayScheduleGet = exports.ScheduleEntryLockCCYearDayScheduleReport = exports.ScheduleEntryLockCCYearDayScheduleSet = exports.ScheduleEntryLockCCWeekDayScheduleGet = exports.ScheduleEntryLockCCWeekDayScheduleReport = exports.ScheduleEntryLockCCWeekDayScheduleSet = exports.ScheduleEntryLockCCSupportedGet = exports.ScheduleEntryLockCCSupportedReport = exports.ScheduleEntryLockCCEnableAllSet = exports.ScheduleEntryLockCCEnableSet = exports.ScheduleEntryLockCC = exports.ScheduleEntryLockCCAPI = exports.ScheduleEntryLockCCValues = void 0;
10
- function __assertType(argName, typeName, boundHasError) {
11
- const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
12
- if (boundHasError()) {
13
- throw new ZWaveError(typeName ? `${argName} is not a ${typeName}` : `${argName} has the wrong type`, ZWaveErrorCodes.Argument_Invalid);
14
- }
15
- }
16
- const __assertType__boolean = $o => {
17
- function _boolean($o) {
18
- return typeof $o !== "boolean" ? {} : null;
19
- }
20
- return _boolean($o);
21
- };
22
- const __assertType__optional_number = $o => {
23
- function _number($o) {
24
- return typeof $o !== "number" ? {} : null;
25
- }
26
- function optional__number($o) {
27
- if ($o !== undefined) {
28
- const error = _number($o);
29
- if (error)
30
- return error;
31
- }
32
- return null;
33
- }
34
- return optional__number($o);
35
- };
36
- const __assertType__ScheduleEntryLockSlotId = $o => {
37
- function _number($o) {
38
- return typeof $o !== "number" ? {} : null;
39
- }
40
- function _0($o) {
41
- if (typeof $o !== "object" || $o === null || Array.isArray($o))
42
- return {};
43
- if ("userId" in $o && $o["userId"] !== undefined) {
44
- const error = _number($o["userId"]);
45
- if (error)
46
- return error;
47
- }
48
- else
49
- return {};
50
- if ("slotId" in $o && $o["slotId"] !== undefined) {
51
- const error = _number($o["slotId"]);
52
- if (error)
53
- return error;
54
- }
55
- else
56
- return {};
57
- return null;
58
- }
59
- return _0($o);
60
- };
61
- const __assertType__optional_ScheduleEntryLockWeekDaySchedule = $o => {
62
- function su__2__3__4__5__6__7__8_eu($o) {
63
- return ![0, 1, 2, 3, 4, 5, 6].includes($o) ? {} : null;
64
- }
65
- function _number($o) {
66
- return typeof $o !== "number" ? {} : null;
67
- }
68
- function _0($o) {
69
- if (typeof $o !== "object" || $o === null || Array.isArray($o))
70
- return {};
71
- if ("weekday" in $o && $o["weekday"] !== undefined) {
72
- const error = su__2__3__4__5__6__7__8_eu($o["weekday"]);
73
- if (error)
74
- return error;
75
- }
76
- else
77
- return {};
78
- if ("startHour" in $o && $o["startHour"] !== undefined) {
79
- const error = _number($o["startHour"]);
80
- if (error)
81
- return error;
82
- }
83
- else
84
- return {};
85
- if ("startMinute" in $o && $o["startMinute"] !== undefined) {
86
- const error = _number($o["startMinute"]);
87
- if (error)
88
- return error;
89
- }
90
- else
91
- return {};
92
- if ("stopHour" in $o && $o["stopHour"] !== undefined) {
93
- const error = _number($o["stopHour"]);
94
- if (error)
95
- return error;
96
- }
97
- else
98
- return {};
99
- if ("stopMinute" in $o && $o["stopMinute"] !== undefined) {
100
- const error = _number($o["stopMinute"]);
101
- if (error)
102
- return error;
103
- }
104
- else
105
- return {};
106
- return null;
107
- }
108
- function optional__0($o) {
109
- if ($o !== undefined) {
110
- const error = _0($o);
111
- if (error)
112
- return error;
113
- }
114
- return null;
115
- }
116
- return optional__0($o);
117
- };
118
- const __assertType__optional_ScheduleEntryLockYearDaySchedule = $o => {
119
- function _number($o) {
120
- return typeof $o !== "number" ? {} : null;
121
- }
122
- function _0($o) {
123
- if (typeof $o !== "object" || $o === null || Array.isArray($o))
124
- return {};
125
- if ("startYear" in $o && $o["startYear"] !== undefined) {
126
- const error = _number($o["startYear"]);
127
- if (error)
128
- return error;
129
- }
130
- else
131
- return {};
132
- if ("startMonth" in $o && $o["startMonth"] !== undefined) {
133
- const error = _number($o["startMonth"]);
134
- if (error)
135
- return error;
136
- }
137
- else
138
- return {};
139
- if ("startDay" in $o && $o["startDay"] !== undefined) {
140
- const error = _number($o["startDay"]);
141
- if (error)
142
- return error;
143
- }
144
- else
145
- return {};
146
- if ("startHour" in $o && $o["startHour"] !== undefined) {
147
- const error = _number($o["startHour"]);
148
- if (error)
149
- return error;
150
- }
151
- else
152
- return {};
153
- if ("startMinute" in $o && $o["startMinute"] !== undefined) {
154
- const error = _number($o["startMinute"]);
155
- if (error)
156
- return error;
157
- }
158
- else
159
- return {};
160
- if ("stopYear" in $o && $o["stopYear"] !== undefined) {
161
- const error = _number($o["stopYear"]);
162
- if (error)
163
- return error;
164
- }
165
- else
166
- return {};
167
- if ("stopMonth" in $o && $o["stopMonth"] !== undefined) {
168
- const error = _number($o["stopMonth"]);
169
- if (error)
170
- return error;
171
- }
172
- else
173
- return {};
174
- if ("stopDay" in $o && $o["stopDay"] !== undefined) {
175
- const error = _number($o["stopDay"]);
176
- if (error)
177
- return error;
178
- }
179
- else
180
- return {};
181
- if ("stopHour" in $o && $o["stopHour"] !== undefined) {
182
- const error = _number($o["stopHour"]);
183
- if (error)
184
- return error;
185
- }
186
- else
187
- return {};
188
- if ("stopMinute" in $o && $o["stopMinute"] !== undefined) {
189
- const error = _number($o["stopMinute"]);
190
- if (error)
191
- return error;
192
- }
193
- else
194
- return {};
195
- return null;
196
- }
197
- function optional__0($o) {
198
- if ($o !== undefined) {
199
- const error = _0($o);
200
- if (error)
201
- return error;
202
- }
203
- return null;
204
- }
205
- return optional__0($o);
206
- };
207
- const __assertType__optional_ScheduleEntryLockDailyRepeatingSchedule = $o => {
208
- function su__4__5__6__7__8__9__10_eu($o) {
209
- return ![0, 1, 2, 3, 4, 5, 6].includes($o) ? {} : null;
210
- }
211
- function sa_su__4__5__6__7__8__9__10_eu_ea_3($o) {
212
- if (!Array.isArray($o))
213
- return {};
214
- for (let i = 0; i < $o.length; i++) {
215
- const error = su__4__5__6__7__8__9__10_eu($o[i]);
216
- if (error)
217
- return error;
218
- }
219
- return null;
220
- }
221
- function _number($o) {
222
- return typeof $o !== "number" ? {} : null;
223
- }
224
- function _0($o) {
225
- if (typeof $o !== "object" || $o === null || Array.isArray($o))
226
- return {};
227
- if ("weekdays" in $o && $o["weekdays"] !== undefined) {
228
- const error = sa_su__4__5__6__7__8__9__10_eu_ea_3($o["weekdays"]);
229
- if (error)
230
- return error;
231
- }
232
- else
233
- return {};
234
- if ("startHour" in $o && $o["startHour"] !== undefined) {
235
- const error = _number($o["startHour"]);
236
- if (error)
237
- return error;
238
- }
239
- else
240
- return {};
241
- if ("startMinute" in $o && $o["startMinute"] !== undefined) {
242
- const error = _number($o["startMinute"]);
243
- if (error)
244
- return error;
245
- }
246
- else
247
- return {};
248
- if ("durationHour" in $o && $o["durationHour"] !== undefined) {
249
- const error = _number($o["durationHour"]);
250
- if (error)
251
- return error;
252
- }
253
- else
254
- return {};
255
- if ("durationMinute" in $o && $o["durationMinute"] !== undefined) {
256
- const error = _number($o["durationMinute"]);
257
- if (error)
258
- return error;
259
- }
260
- else
261
- return {};
262
- return null;
263
- }
264
- function optional__0($o) {
265
- if ($o !== undefined) {
266
- const error = _0($o);
267
- if (error)
268
- return error;
269
- }
270
- return null;
271
- }
272
- return optional__0($o);
273
- };
274
- const __assertType__Timezone = $o => {
275
- function _number($o) {
276
- return typeof $o !== "number" ? {} : null;
277
- }
278
- function _0($o) {
279
- if (typeof $o !== "object" || $o === null || Array.isArray($o))
280
- return {};
281
- if ("standardOffset" in $o && $o["standardOffset"] !== undefined) {
282
- const error = _number($o["standardOffset"]);
283
- if (error)
284
- return error;
285
- }
286
- else
287
- return {};
288
- if ("dstOffset" in $o && $o["dstOffset"] !== undefined) {
289
- const error = _number($o["dstOffset"]);
290
- if (error)
291
- return error;
292
- }
293
- else
294
- return {};
295
- return null;
296
- }
297
- return _0($o);
298
- };
299
- const core_1 = require("@zwave-js/core");
300
- const shared_1 = require("@zwave-js/shared");
301
- const API_1 = require("../lib/API");
302
- const CommandClass_1 = require("../lib/CommandClass");
303
- const CommandClassDecorators_1 = require("../lib/CommandClassDecorators");
304
- const serializers_1 = require("../lib/serializers");
305
- const Values_1 = require("../lib/Values");
306
- const _Types_1 = require("../lib/_Types");
307
- exports.ScheduleEntryLockCCValues = Object.freeze({
308
- ...Values_1.V.defineStaticCCValues(core_1.CommandClasses["Schedule Entry Lock"], {
309
- ...Values_1.V.staticProperty("numWeekDaySlots", undefined, { internal: true }),
310
- ...Values_1.V.staticProperty("numYearDaySlots", undefined, { internal: true }),
311
- ...Values_1.V.staticProperty("numDailyRepeatingSlots", undefined, {
312
- internal: true,
313
- }),
314
- }),
315
- });
316
- let ScheduleEntryLockCCAPI = class ScheduleEntryLockCCAPI extends API_1.CCAPI {
317
- supportsCommand(cmd) {
318
- switch (cmd) {
319
- case _Types_1.ScheduleEntryLockCommand.EnableSet:
320
- case _Types_1.ScheduleEntryLockCommand.EnableAllSet:
321
- case _Types_1.ScheduleEntryLockCommand.WeekDayScheduleSet:
322
- case _Types_1.ScheduleEntryLockCommand.WeekDayScheduleGet:
323
- case _Types_1.ScheduleEntryLockCommand.YearDayScheduleSet:
324
- case _Types_1.ScheduleEntryLockCommand.YearDayScheduleGet:
325
- case _Types_1.ScheduleEntryLockCommand.SupportedGet:
326
- return true; // V1
327
- case _Types_1.ScheduleEntryLockCommand.TimeOffsetSet:
328
- case _Types_1.ScheduleEntryLockCommand.TimeOffsetGet:
329
- return this.version >= 2;
330
- case _Types_1.ScheduleEntryLockCommand.DailyRepeatingScheduleSet:
331
- case _Types_1.ScheduleEntryLockCommand.DailyRepeatingScheduleGet:
332
- return this.version >= 3;
333
- }
334
- return super.supportsCommand(cmd);
335
- }
336
- /**
337
- * Enables or disables schedules. If a user ID is given, that user's
338
- * schedules will be enabled or disabled. If no user ID is given, all schedules
339
- * will be affected.
340
- */
341
- async setEnabled(enabled, userId) {
342
- __assertType("enabled", "boolean", __assertType__boolean.bind(void 0, enabled));
343
- __assertType("userId", "(optional) number", __assertType__optional_number.bind(void 0, userId));
344
- if (userId != undefined) {
345
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.EnableSet);
346
- const cc = new ScheduleEntryLockCCEnableSet(this.applHost, {
347
- nodeId: this.endpoint.nodeId,
348
- endpoint: this.endpoint.index,
349
- userId,
350
- enabled,
351
- });
352
- return this.applHost.sendCommand(cc, this.commandOptions);
353
- }
354
- else {
355
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.EnableAllSet);
356
- const cc = new ScheduleEntryLockCCEnableAllSet(this.applHost, {
357
- nodeId: this.endpoint.nodeId,
358
- endpoint: this.endpoint.index,
359
- enabled,
360
- });
361
- return this.applHost.sendCommand(cc, this.commandOptions);
362
- }
363
- }
364
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
365
- async getNumSlots() {
366
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.SupportedGet);
367
- const cc = new ScheduleEntryLockCCSupportedGet(this.applHost, {
368
- nodeId: this.endpoint.nodeId,
369
- endpoint: this.endpoint.index,
370
- });
371
- const result = await this.applHost.sendCommand(cc, this.commandOptions);
372
- if (result) {
373
- return (0, shared_1.pick)(result, [
374
- "numWeekDaySlots",
375
- "numYearDaySlots",
376
- "numDailyRepeatingSlots",
377
- ]);
378
- }
379
- }
380
- async setWeekDaySchedule(slot, schedule) {
381
- __assertType("slot", "ScheduleEntryLockSlotId", __assertType__ScheduleEntryLockSlotId.bind(void 0, slot));
382
- __assertType("schedule", "(optional) ScheduleEntryLockWeekDaySchedule", __assertType__optional_ScheduleEntryLockWeekDaySchedule.bind(void 0, schedule));
383
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.WeekDayScheduleSet);
384
- if (this.isSinglecast()) {
385
- const numSlots = ScheduleEntryLockCC.getNumWeekDaySlotsCached(this.applHost, this.endpoint);
386
- if (slot.slotId < 0 || slot.slotId >= numSlots) {
387
- throw new core_1.ZWaveError(`The schedule slot ID must be between 0 and the number of supported day-of-week slots ${numSlots}.`, core_1.ZWaveErrorCodes.Argument_Invalid);
388
- }
389
- }
390
- const cc = new ScheduleEntryLockCCWeekDayScheduleSet(this.applHost, {
391
- nodeId: this.endpoint.nodeId,
392
- endpoint: this.endpoint.index,
393
- ...slot,
394
- ...(schedule
395
- ? {
396
- action: _Types_1.ScheduleEntryLockSetAction.Set,
397
- ...schedule,
398
- }
399
- : {
400
- action: _Types_1.ScheduleEntryLockSetAction.Erase,
401
- }),
402
- });
403
- return this.applHost.sendCommand(cc, this.commandOptions);
404
- }
405
- async getWeekDaySchedule(slot) {
406
- __assertType("slot", "ScheduleEntryLockSlotId", __assertType__ScheduleEntryLockSlotId.bind(void 0, slot));
407
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.WeekDayScheduleSet);
408
- const cc = new ScheduleEntryLockCCWeekDayScheduleGet(this.applHost, {
409
- nodeId: this.endpoint.nodeId,
410
- endpoint: this.endpoint.index,
411
- ...slot,
412
- });
413
- const result = await this.applHost.sendCommand(cc, this.commandOptions);
414
- if (result?.weekday != undefined) {
415
- return {
416
- weekday: result.weekday,
417
- startHour: result.startHour,
418
- startMinute: result.startMinute,
419
- stopHour: result.stopHour,
420
- stopMinute: result.stopMinute,
421
- };
422
- }
423
- }
424
- async setYearDaySchedule(slot, schedule) {
425
- __assertType("slot", "ScheduleEntryLockSlotId", __assertType__ScheduleEntryLockSlotId.bind(void 0, slot));
426
- __assertType("schedule", "(optional) ScheduleEntryLockYearDaySchedule", __assertType__optional_ScheduleEntryLockYearDaySchedule.bind(void 0, schedule));
427
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.YearDayScheduleSet);
428
- if (this.isSinglecast()) {
429
- const numSlots = ScheduleEntryLockCC.getNumYearDaySlotsCached(this.applHost, this.endpoint);
430
- if (slot.slotId < 0 || slot.slotId >= numSlots) {
431
- throw new core_1.ZWaveError(`The schedule slot ID must be between 0 and the number of supported day-of-year slots ${numSlots}.`, core_1.ZWaveErrorCodes.Argument_Invalid);
432
- }
433
- }
434
- const cc = new ScheduleEntryLockCCYearDayScheduleSet(this.applHost, {
435
- nodeId: this.endpoint.nodeId,
436
- endpoint: this.endpoint.index,
437
- ...slot,
438
- ...(schedule
439
- ? {
440
- action: _Types_1.ScheduleEntryLockSetAction.Set,
441
- ...schedule,
442
- }
443
- : {
444
- action: _Types_1.ScheduleEntryLockSetAction.Erase,
445
- }),
446
- });
447
- return this.applHost.sendCommand(cc, this.commandOptions);
448
- }
449
- async getYearDaySchedule(slot) {
450
- __assertType("slot", "ScheduleEntryLockSlotId", __assertType__ScheduleEntryLockSlotId.bind(void 0, slot));
451
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.YearDayScheduleSet);
452
- const cc = new ScheduleEntryLockCCYearDayScheduleGet(this.applHost, {
453
- nodeId: this.endpoint.nodeId,
454
- endpoint: this.endpoint.index,
455
- ...slot,
456
- });
457
- const result = await this.applHost.sendCommand(cc, this.commandOptions);
458
- if (result?.startYear != undefined) {
459
- return {
460
- startYear: result.startYear,
461
- startMonth: result.startMonth,
462
- startDay: result.startDay,
463
- startHour: result.startHour,
464
- startMinute: result.startMinute,
465
- stopYear: result.stopYear,
466
- stopMonth: result.stopMonth,
467
- stopDay: result.stopDay,
468
- stopHour: result.stopHour,
469
- stopMinute: result.stopMinute,
470
- };
471
- }
472
- }
473
- async setDailyRepeatingSchedule(slot, schedule) {
474
- __assertType("slot", "ScheduleEntryLockSlotId", __assertType__ScheduleEntryLockSlotId.bind(void 0, slot));
475
- __assertType("schedule", "(optional) ScheduleEntryLockDailyRepeatingSchedule", __assertType__optional_ScheduleEntryLockDailyRepeatingSchedule.bind(void 0, schedule));
476
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.DailyRepeatingScheduleSet);
477
- if (this.isSinglecast()) {
478
- const numSlots = ScheduleEntryLockCC.getNumDailyRepeatingSlotsCached(this.applHost, this.endpoint);
479
- if (slot.slotId < 0 || slot.slotId >= numSlots) {
480
- throw new core_1.ZWaveError(`The schedule slot ID must be between 0 and the number of supported daily repeating slots ${numSlots}.`, core_1.ZWaveErrorCodes.Argument_Invalid);
481
- }
482
- }
483
- const cc = new ScheduleEntryLockCCDailyRepeatingScheduleSet(this.applHost, {
484
- nodeId: this.endpoint.nodeId,
485
- endpoint: this.endpoint.index,
486
- ...slot,
487
- ...(schedule
488
- ? {
489
- action: _Types_1.ScheduleEntryLockSetAction.Set,
490
- ...schedule,
491
- }
492
- : {
493
- action: _Types_1.ScheduleEntryLockSetAction.Erase,
494
- }),
495
- });
496
- return this.applHost.sendCommand(cc, this.commandOptions);
497
- }
498
- async getDailyRepeatingSchedule(slot) {
499
- __assertType("slot", "ScheduleEntryLockSlotId", __assertType__ScheduleEntryLockSlotId.bind(void 0, slot));
500
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.DailyRepeatingScheduleSet);
501
- const cc = new ScheduleEntryLockCCDailyRepeatingScheduleGet(this.applHost, {
502
- nodeId: this.endpoint.nodeId,
503
- endpoint: this.endpoint.index,
504
- ...slot,
505
- });
506
- const result = await this.applHost.sendCommand(cc, this.commandOptions);
507
- if (result?.weekdays != undefined) {
508
- return {
509
- weekdays: result.weekdays,
510
- startHour: result.startHour,
511
- startMinute: result.startMinute,
512
- durationHour: result.durationHour,
513
- durationMinute: result.durationMinute,
514
- };
515
- }
516
- }
517
- async getTimezone() {
518
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.TimeOffsetGet);
519
- const cc = new ScheduleEntryLockCCTimeOffsetGet(this.applHost, {
520
- nodeId: this.endpoint.nodeId,
521
- endpoint: this.endpoint.index,
522
- });
523
- const result = await this.applHost.sendCommand(cc, this.commandOptions);
524
- if (result) {
525
- return (0, shared_1.pick)(result, ["standardOffset", "dstOffset"]);
526
- }
527
- }
528
- async setTimezone(timezone) {
529
- __assertType("timezone", "Timezone", __assertType__Timezone.bind(void 0, timezone));
530
- this.assertSupportsCommand(_Types_1.ScheduleEntryLockCommand, _Types_1.ScheduleEntryLockCommand.TimeOffsetSet);
531
- const cc = new ScheduleEntryLockCCTimeOffsetSet(this.applHost, {
532
- nodeId: this.endpoint.nodeId,
533
- endpoint: this.endpoint.index,
534
- ...timezone,
535
- });
536
- return this.applHost.sendCommand(cc, this.commandOptions);
537
- }
538
- };
539
- ScheduleEntryLockCCAPI = __decorate([
540
- (0, CommandClassDecorators_1.API)(core_1.CommandClasses["Schedule Entry Lock"])
541
- ], ScheduleEntryLockCCAPI);
542
- exports.ScheduleEntryLockCCAPI = ScheduleEntryLockCCAPI;
543
- let ScheduleEntryLockCC = class ScheduleEntryLockCC extends CommandClass_1.CommandClass {
544
- async interview(applHost) {
545
- const node = this.getNode(applHost);
546
- const endpoint = this.getEndpoint(applHost);
547
- const api = API_1.CCAPI.create(core_1.CommandClasses["Schedule Entry Lock"], applHost, endpoint).withOptions({
548
- priority: core_1.MessagePriority.NodeQuery,
549
- });
550
- applHost.controllerLog.logNode(node.id, {
551
- endpoint: this.endpointIndex,
552
- message: `Interviewing ${this.ccName}...`,
553
- direction: "none",
554
- });
555
- applHost.controllerLog.logNode(node.id, {
556
- endpoint: this.endpointIndex,
557
- message: "Querying supported number of schedule slots...",
558
- direction: "outbound",
559
- });
560
- const slotsResp = await api.getNumSlots();
561
- if (slotsResp) {
562
- let logMessage = `received supported number of schedule slots:
563
- day of week: ${slotsResp.numWeekDaySlots}
564
- day of year: ${slotsResp.numYearDaySlots}`;
565
- if (slotsResp.numDailyRepeatingSlots != undefined) {
566
- logMessage += `
567
- daily repeating: ${slotsResp.numDailyRepeatingSlots}`;
568
- }
569
- applHost.controllerLog.logNode(node.id, {
570
- endpoint: this.endpointIndex,
571
- message: logMessage,
572
- direction: "inbound",
573
- });
574
- }
575
- applHost.controllerLog.logNode(node.id, {
576
- endpoint: this.endpointIndex,
577
- message: "Querying configured time zone...",
578
- direction: "outbound",
579
- });
580
- const tzResp = await api.getTimezone();
581
- if (tzResp) {
582
- applHost.controllerLog.logNode(node.id, {
583
- endpoint: this.endpointIndex,
584
- message: `received configured time zone:
585
- standard offset: ${tzResp.standardOffset} minutes
586
- dst offset: ${tzResp.dstOffset} minutes`,
587
- direction: "inbound",
588
- });
589
- }
590
- // Remember that the interview is complete
591
- this.setInterviewComplete(applHost, true);
592
- }
593
- /**
594
- * Returns the number of supported day-of-week slots.
595
- * This only works AFTER the interview process
596
- */
597
- static getNumWeekDaySlotsCached(applHost, endpoint) {
598
- return (applHost
599
- .getValueDB(endpoint.nodeId)
600
- .getValue(exports.ScheduleEntryLockCCValues.numWeekDaySlots.endpoint(endpoint.index)) || 0);
601
- }
602
- /**
603
- * Returns the number of supported day-of-year slots.
604
- * This only works AFTER the interview process
605
- */
606
- static getNumYearDaySlotsCached(applHost, endpoint) {
607
- return (applHost
608
- .getValueDB(endpoint.nodeId)
609
- .getValue(exports.ScheduleEntryLockCCValues.numYearDaySlots.endpoint(endpoint.index)) || 0);
610
- }
611
- /**
612
- * Returns the number of supported daily-repeating slots.
613
- * This only works AFTER the interview process
614
- */
615
- static getNumDailyRepeatingSlotsCached(applHost, endpoint) {
616
- return (applHost
617
- .getValueDB(endpoint.nodeId)
618
- .getValue(exports.ScheduleEntryLockCCValues.numDailyRepeatingSlots.endpoint(endpoint.index)) || 0);
619
- }
620
- };
621
- ScheduleEntryLockCC = __decorate([
622
- (0, CommandClassDecorators_1.commandClass)(core_1.CommandClasses["Schedule Entry Lock"]),
623
- (0, CommandClassDecorators_1.implementedVersion)(3),
624
- (0, CommandClassDecorators_1.ccValues)(exports.ScheduleEntryLockCCValues)
625
- ], ScheduleEntryLockCC);
626
- exports.ScheduleEntryLockCC = ScheduleEntryLockCC;
627
- let ScheduleEntryLockCCEnableSet = class ScheduleEntryLockCCEnableSet extends ScheduleEntryLockCC {
628
- constructor(host, options) {
629
- super(host, options);
630
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
631
- (0, core_1.validatePayload)(this.payload.length >= 2);
632
- this.userId = this.payload[0];
633
- this.enabled = this.payload[1] === 0x01;
634
- }
635
- else {
636
- this.userId = options.userId;
637
- this.enabled = options.enabled;
638
- }
639
- }
640
- serialize() {
641
- this.payload = Buffer.from([this.userId, this.enabled ? 0x01 : 0x00]);
642
- return super.serialize();
643
- }
644
- };
645
- ScheduleEntryLockCCEnableSet = __decorate([
646
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.EnableSet)
647
- ], ScheduleEntryLockCCEnableSet);
648
- exports.ScheduleEntryLockCCEnableSet = ScheduleEntryLockCCEnableSet;
649
- let ScheduleEntryLockCCEnableAllSet = class ScheduleEntryLockCCEnableAllSet extends ScheduleEntryLockCC {
650
- constructor(host, options) {
651
- super(host, options);
652
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
653
- (0, core_1.validatePayload)(this.payload.length >= 1);
654
- this.enabled = this.payload[0] === 0x01;
655
- }
656
- else {
657
- this.enabled = options.enabled;
658
- }
659
- }
660
- serialize() {
661
- this.payload = Buffer.from([this.enabled ? 0x01 : 0x00]);
662
- return super.serialize();
663
- }
664
- };
665
- ScheduleEntryLockCCEnableAllSet = __decorate([
666
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.EnableAllSet)
667
- ], ScheduleEntryLockCCEnableAllSet);
668
- exports.ScheduleEntryLockCCEnableAllSet = ScheduleEntryLockCCEnableAllSet;
669
- let ScheduleEntryLockCCSupportedReport = class ScheduleEntryLockCCSupportedReport extends ScheduleEntryLockCC {
670
- constructor(host, options) {
671
- super(host, options);
672
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
673
- (0, core_1.validatePayload)(this.payload.length >= 2);
674
- this.numWeekDaySlots = this.payload[0];
675
- this.numYearDaySlots = this.payload[1];
676
- if (this.payload.length >= 3) {
677
- this.numDailyRepeatingSlots = this.payload[2];
678
- }
679
- }
680
- else {
681
- this.numWeekDaySlots = options.numWeekDaySlots;
682
- this.numYearDaySlots = options.numYearDaySlots;
683
- this.numDailyRepeatingSlots = options.numDailyRepeatingSlots;
684
- }
685
- }
686
- serialize() {
687
- this.payload = Buffer.from([
688
- this.numWeekDaySlots,
689
- this.numYearDaySlots,
690
- ]);
691
- if (this.version >= 3 && this.numDailyRepeatingSlots != undefined) {
692
- this.payload = Buffer.concat([
693
- this.payload,
694
- Buffer.from([this.numDailyRepeatingSlots]),
695
- ]);
696
- }
697
- return super.serialize();
698
- }
699
- };
700
- __decorate([
701
- (0, CommandClassDecorators_1.ccValue)(exports.ScheduleEntryLockCCValues.numWeekDaySlots)
702
- ], ScheduleEntryLockCCSupportedReport.prototype, "numWeekDaySlots", void 0);
703
- __decorate([
704
- (0, CommandClassDecorators_1.ccValue)(exports.ScheduleEntryLockCCValues.numYearDaySlots)
705
- ], ScheduleEntryLockCCSupportedReport.prototype, "numYearDaySlots", void 0);
706
- __decorate([
707
- (0, CommandClassDecorators_1.ccValue)(exports.ScheduleEntryLockCCValues.numDailyRepeatingSlots)
708
- ], ScheduleEntryLockCCSupportedReport.prototype, "numDailyRepeatingSlots", void 0);
709
- ScheduleEntryLockCCSupportedReport = __decorate([
710
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.SupportedReport)
711
- ], ScheduleEntryLockCCSupportedReport);
712
- exports.ScheduleEntryLockCCSupportedReport = ScheduleEntryLockCCSupportedReport;
713
- let ScheduleEntryLockCCSupportedGet = class ScheduleEntryLockCCSupportedGet extends ScheduleEntryLockCC {
714
- };
715
- ScheduleEntryLockCCSupportedGet = __decorate([
716
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.SupportedGet),
717
- (0, CommandClassDecorators_1.expectedCCResponse)(ScheduleEntryLockCCSupportedReport)
718
- ], ScheduleEntryLockCCSupportedGet);
719
- exports.ScheduleEntryLockCCSupportedGet = ScheduleEntryLockCCSupportedGet;
720
- let ScheduleEntryLockCCWeekDayScheduleSet = class ScheduleEntryLockCCWeekDayScheduleSet extends ScheduleEntryLockCC {
721
- constructor(host, options) {
722
- super(host, options);
723
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
724
- (0, core_1.validatePayload)(this.payload.length >= 3);
725
- this.action = this.payload[0];
726
- (0, core_1.validatePayload)(this.action === _Types_1.ScheduleEntryLockSetAction.Set ||
727
- this.action === _Types_1.ScheduleEntryLockSetAction.Erase);
728
- this.userId = this.payload[1];
729
- this.slotId = this.payload[2];
730
- if (this.action === _Types_1.ScheduleEntryLockSetAction.Set) {
731
- (0, core_1.validatePayload)(this.payload.length >= 8);
732
- this.weekday = this.payload[3];
733
- this.startHour = this.payload[4];
734
- this.startMinute = this.payload[5];
735
- this.stopHour = this.payload[6];
736
- this.stopMinute = this.payload[7];
737
- }
738
- }
739
- else {
740
- this.userId = options.userId;
741
- this.slotId = options.slotId;
742
- this.action = options.action;
743
- if (options.action === _Types_1.ScheduleEntryLockSetAction.Set) {
744
- this.weekday = options.weekday;
745
- this.startHour = options.startHour;
746
- this.startMinute = options.startMinute;
747
- this.stopHour = options.stopHour;
748
- this.stopMinute = options.stopMinute;
749
- }
750
- }
751
- }
752
- serialize() {
753
- this.payload = Buffer.from([
754
- this.action,
755
- this.userId,
756
- this.slotId,
757
- // The report should have these fields set to 0xff
758
- // if the slot is erased. The specs don't mention anything
759
- // for the Set command, so we just assume the same is okay
760
- this.weekday ?? 0xff,
761
- this.startHour ?? 0xff,
762
- this.startMinute ?? 0xff,
763
- this.stopHour ?? 0xff,
764
- this.stopMinute ?? 0xff,
765
- ]);
766
- return super.serialize();
767
- }
768
- };
769
- ScheduleEntryLockCCWeekDayScheduleSet = __decorate([
770
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.WeekDayScheduleSet)
771
- ], ScheduleEntryLockCCWeekDayScheduleSet);
772
- exports.ScheduleEntryLockCCWeekDayScheduleSet = ScheduleEntryLockCCWeekDayScheduleSet;
773
- let ScheduleEntryLockCCWeekDayScheduleReport = class ScheduleEntryLockCCWeekDayScheduleReport extends ScheduleEntryLockCC {
774
- constructor(host, options) {
775
- super(host, options);
776
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
777
- (0, core_1.validatePayload)(this.payload.length >= 2);
778
- this.userId = this.payload[0];
779
- this.slotId = this.payload[1];
780
- if (this.payload.length >= 7) {
781
- if (this.payload[2] !== 0xff) {
782
- this.weekday = this.payload[2];
783
- }
784
- if (this.payload[3] !== 0xff) {
785
- this.startHour = this.payload[3];
786
- }
787
- if (this.payload[4] !== 0xff) {
788
- this.startMinute = this.payload[4];
789
- }
790
- if (this.payload[5] !== 0xff) {
791
- this.stopHour = this.payload[5];
792
- }
793
- if (this.payload[6] !== 0xff) {
794
- this.stopMinute = this.payload[6];
795
- }
796
- }
797
- }
798
- else {
799
- this.userId = options.userId;
800
- this.slotId = options.slotId;
801
- this.weekday = options.weekday;
802
- this.startHour = options.startHour;
803
- this.startMinute = options.startMinute;
804
- this.stopHour = options.stopHour;
805
- this.stopMinute = options.stopMinute;
806
- }
807
- }
808
- serialize() {
809
- this.payload = Buffer.from([
810
- this.userId,
811
- this.slotId,
812
- this.weekday ?? 0xff,
813
- this.startHour ?? 0xff,
814
- this.startMinute ?? 0xff,
815
- this.stopHour ?? 0xff,
816
- this.stopMinute ?? 0xff,
817
- ]);
818
- return super.serialize();
819
- }
820
- };
821
- ScheduleEntryLockCCWeekDayScheduleReport = __decorate([
822
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.WeekDayScheduleReport)
823
- ], ScheduleEntryLockCCWeekDayScheduleReport);
824
- exports.ScheduleEntryLockCCWeekDayScheduleReport = ScheduleEntryLockCCWeekDayScheduleReport;
825
- let ScheduleEntryLockCCWeekDayScheduleGet = class ScheduleEntryLockCCWeekDayScheduleGet extends ScheduleEntryLockCC {
826
- constructor(host, options) {
827
- super(host, options);
828
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
829
- (0, core_1.validatePayload)(this.payload.length >= 2);
830
- this.userId = this.payload[0];
831
- this.slotId = this.payload[1];
832
- }
833
- else {
834
- this.userId = options.userId;
835
- this.slotId = options.slotId;
836
- }
837
- }
838
- serialize() {
839
- this.payload = Buffer.from([this.userId, this.slotId]);
840
- return super.serialize();
841
- }
842
- };
843
- ScheduleEntryLockCCWeekDayScheduleGet = __decorate([
844
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.WeekDayScheduleGet),
845
- (0, CommandClassDecorators_1.expectedCCResponse)(ScheduleEntryLockCCWeekDayScheduleReport)
846
- ], ScheduleEntryLockCCWeekDayScheduleGet);
847
- exports.ScheduleEntryLockCCWeekDayScheduleGet = ScheduleEntryLockCCWeekDayScheduleGet;
848
- let ScheduleEntryLockCCYearDayScheduleSet = class ScheduleEntryLockCCYearDayScheduleSet extends ScheduleEntryLockCC {
849
- constructor(host, options) {
850
- super(host, options);
851
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
852
- (0, core_1.validatePayload)(this.payload.length >= 3);
853
- this.action = this.payload[0];
854
- (0, core_1.validatePayload)(this.action === _Types_1.ScheduleEntryLockSetAction.Set ||
855
- this.action === _Types_1.ScheduleEntryLockSetAction.Erase);
856
- this.userId = this.payload[1];
857
- this.slotId = this.payload[2];
858
- if (this.action === _Types_1.ScheduleEntryLockSetAction.Set) {
859
- (0, core_1.validatePayload)(this.payload.length >= 13);
860
- this.startYear = this.payload[3];
861
- this.startMonth = this.payload[4];
862
- this.startDay = this.payload[5];
863
- this.startHour = this.payload[6];
864
- this.startMinute = this.payload[7];
865
- this.stopYear = this.payload[8];
866
- this.stopMonth = this.payload[9];
867
- this.stopDay = this.payload[10];
868
- this.stopHour = this.payload[11];
869
- this.stopMinute = this.payload[12];
870
- }
871
- }
872
- else {
873
- this.userId = options.userId;
874
- this.slotId = options.slotId;
875
- this.action = options.action;
876
- if (options.action === _Types_1.ScheduleEntryLockSetAction.Set) {
877
- this.startYear = options.startYear;
878
- this.startMonth = options.startMonth;
879
- this.startDay = options.startDay;
880
- this.startHour = options.startHour;
881
- this.startMinute = options.startMinute;
882
- this.stopYear = options.stopYear;
883
- this.stopMonth = options.stopMonth;
884
- this.stopDay = options.stopDay;
885
- this.stopHour = options.stopHour;
886
- this.stopMinute = options.stopMinute;
887
- }
888
- }
889
- }
890
- serialize() {
891
- this.payload = Buffer.from([
892
- this.action,
893
- this.userId,
894
- this.slotId,
895
- // The report should have these fields set to 0xff
896
- // if the slot is erased. The specs don't mention anything
897
- // for the Set command, so we just assume the same is okay
898
- this.startYear ?? 0xff,
899
- this.startMonth ?? 0xff,
900
- this.startDay ?? 0xff,
901
- this.startHour ?? 0xff,
902
- this.startMinute ?? 0xff,
903
- this.stopYear ?? 0xff,
904
- this.stopMonth ?? 0xff,
905
- this.stopDay ?? 0xff,
906
- this.stopHour ?? 0xff,
907
- this.stopMinute ?? 0xff,
908
- ]);
909
- return super.serialize();
910
- }
911
- };
912
- ScheduleEntryLockCCYearDayScheduleSet = __decorate([
913
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.YearDayScheduleSet)
914
- ], ScheduleEntryLockCCYearDayScheduleSet);
915
- exports.ScheduleEntryLockCCYearDayScheduleSet = ScheduleEntryLockCCYearDayScheduleSet;
916
- let ScheduleEntryLockCCYearDayScheduleReport = class ScheduleEntryLockCCYearDayScheduleReport extends ScheduleEntryLockCC {
917
- constructor(host, options) {
918
- super(host, options);
919
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
920
- (0, core_1.validatePayload)(this.payload.length >= 2);
921
- this.userId = this.payload[0];
922
- this.slotId = this.payload[1];
923
- if (this.payload.length >= 12) {
924
- if (this.payload[2] !== 0xff) {
925
- this.startYear = this.payload[2];
926
- }
927
- if (this.payload[3] !== 0xff) {
928
- this.startMonth = this.payload[3];
929
- }
930
- if (this.payload[4] !== 0xff) {
931
- this.startDay = this.payload[4];
932
- }
933
- if (this.payload[5] !== 0xff) {
934
- this.startHour = this.payload[5];
935
- }
936
- if (this.payload[6] !== 0xff) {
937
- this.startMinute = this.payload[6];
938
- }
939
- if (this.payload[7] !== 0xff) {
940
- this.stopYear = this.payload[7];
941
- }
942
- if (this.payload[8] !== 0xff) {
943
- this.stopMonth = this.payload[8];
944
- }
945
- if (this.payload[9] !== 0xff) {
946
- this.stopDay = this.payload[9];
947
- }
948
- if (this.payload[10] !== 0xff) {
949
- this.stopHour = this.payload[10];
950
- }
951
- if (this.payload[11] !== 0xff) {
952
- this.stopMinute = this.payload[11];
953
- }
954
- }
955
- }
956
- else {
957
- this.userId = options.userId;
958
- this.slotId = options.slotId;
959
- this.startYear = options.startYear;
960
- this.startMonth = options.startMonth;
961
- this.startDay = options.startDay;
962
- this.startHour = options.startHour;
963
- this.startMinute = options.startMinute;
964
- this.stopYear = options.stopYear;
965
- this.stopMonth = options.stopMonth;
966
- this.stopDay = options.stopDay;
967
- this.stopHour = options.stopHour;
968
- this.stopMinute = options.stopMinute;
969
- }
970
- }
971
- serialize() {
972
- this.payload = Buffer.from([
973
- this.userId,
974
- this.slotId,
975
- this.startYear ?? 0xff,
976
- this.startMonth ?? 0xff,
977
- this.startDay ?? 0xff,
978
- this.startHour ?? 0xff,
979
- this.startMinute ?? 0xff,
980
- this.stopYear ?? 0xff,
981
- this.stopMonth ?? 0xff,
982
- this.stopDay ?? 0xff,
983
- this.stopHour ?? 0xff,
984
- this.stopMinute ?? 0xff,
985
- ]);
986
- return super.serialize();
987
- }
988
- };
989
- ScheduleEntryLockCCYearDayScheduleReport = __decorate([
990
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.YearDayScheduleReport)
991
- ], ScheduleEntryLockCCYearDayScheduleReport);
992
- exports.ScheduleEntryLockCCYearDayScheduleReport = ScheduleEntryLockCCYearDayScheduleReport;
993
- let ScheduleEntryLockCCYearDayScheduleGet = class ScheduleEntryLockCCYearDayScheduleGet extends ScheduleEntryLockCC {
994
- constructor(host, options) {
995
- super(host, options);
996
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
997
- (0, core_1.validatePayload)(this.payload.length >= 2);
998
- this.userId = this.payload[0];
999
- this.slotId = this.payload[1];
1000
- }
1001
- else {
1002
- this.userId = options.userId;
1003
- this.slotId = options.slotId;
1004
- }
1005
- }
1006
- serialize() {
1007
- this.payload = Buffer.from([this.userId, this.slotId]);
1008
- return super.serialize();
1009
- }
1010
- };
1011
- ScheduleEntryLockCCYearDayScheduleGet = __decorate([
1012
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.YearDayScheduleGet),
1013
- (0, CommandClassDecorators_1.expectedCCResponse)(ScheduleEntryLockCCYearDayScheduleReport)
1014
- ], ScheduleEntryLockCCYearDayScheduleGet);
1015
- exports.ScheduleEntryLockCCYearDayScheduleGet = ScheduleEntryLockCCYearDayScheduleGet;
1016
- let ScheduleEntryLockCCTimeOffsetSet = class ScheduleEntryLockCCTimeOffsetSet extends ScheduleEntryLockCC {
1017
- constructor(host, options) {
1018
- super(host, options);
1019
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1020
- const { standardOffset, dstOffset } = (0, serializers_1.parseTimezone)(this.payload);
1021
- this.standardOffset = standardOffset;
1022
- this.dstOffset = dstOffset;
1023
- }
1024
- else {
1025
- this.standardOffset = options.standardOffset;
1026
- this.dstOffset = options.dstOffset;
1027
- }
1028
- }
1029
- serialize() {
1030
- this.payload = (0, serializers_1.encodeTimezone)({
1031
- standardOffset: this.standardOffset,
1032
- dstOffset: this.dstOffset,
1033
- });
1034
- return super.serialize();
1035
- }
1036
- };
1037
- ScheduleEntryLockCCTimeOffsetSet = __decorate([
1038
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.TimeOffsetSet)
1039
- ], ScheduleEntryLockCCTimeOffsetSet);
1040
- exports.ScheduleEntryLockCCTimeOffsetSet = ScheduleEntryLockCCTimeOffsetSet;
1041
- let ScheduleEntryLockCCTimeOffsetReport = class ScheduleEntryLockCCTimeOffsetReport extends ScheduleEntryLockCC {
1042
- constructor(host, options) {
1043
- super(host, options);
1044
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1045
- const { standardOffset, dstOffset } = (0, serializers_1.parseTimezone)(this.payload);
1046
- this.standardOffset = standardOffset;
1047
- this.dstOffset = dstOffset;
1048
- }
1049
- else {
1050
- this.standardOffset = options.standardOffset;
1051
- this.dstOffset = options.dstOffset;
1052
- }
1053
- }
1054
- serialize() {
1055
- this.payload = (0, serializers_1.encodeTimezone)({
1056
- standardOffset: this.standardOffset,
1057
- dstOffset: this.dstOffset,
1058
- });
1059
- return super.serialize();
1060
- }
1061
- };
1062
- ScheduleEntryLockCCTimeOffsetReport = __decorate([
1063
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.TimeOffsetReport)
1064
- ], ScheduleEntryLockCCTimeOffsetReport);
1065
- exports.ScheduleEntryLockCCTimeOffsetReport = ScheduleEntryLockCCTimeOffsetReport;
1066
- let ScheduleEntryLockCCTimeOffsetGet = class ScheduleEntryLockCCTimeOffsetGet extends ScheduleEntryLockCC {
1067
- };
1068
- ScheduleEntryLockCCTimeOffsetGet = __decorate([
1069
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.TimeOffsetGet),
1070
- (0, CommandClassDecorators_1.expectedCCResponse)(ScheduleEntryLockCCTimeOffsetReport)
1071
- ], ScheduleEntryLockCCTimeOffsetGet);
1072
- exports.ScheduleEntryLockCCTimeOffsetGet = ScheduleEntryLockCCTimeOffsetGet;
1073
- let ScheduleEntryLockCCDailyRepeatingScheduleSet = class ScheduleEntryLockCCDailyRepeatingScheduleSet extends ScheduleEntryLockCC {
1074
- constructor(host, options) {
1075
- super(host, options);
1076
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1077
- (0, core_1.validatePayload)(this.payload.length >= 3);
1078
- this.action = this.payload[0];
1079
- (0, core_1.validatePayload)(this.action === _Types_1.ScheduleEntryLockSetAction.Set ||
1080
- this.action === _Types_1.ScheduleEntryLockSetAction.Erase);
1081
- this.userId = this.payload[1];
1082
- this.slotId = this.payload[2];
1083
- if (this.action === _Types_1.ScheduleEntryLockSetAction.Set) {
1084
- (0, core_1.validatePayload)(this.payload.length >= 8);
1085
- this.weekdays = (0, core_1.parseBitMask)(this.payload.slice(3, 4), _Types_1.ScheduleEntryLockWeekday.Sunday);
1086
- this.startHour = this.payload[4];
1087
- this.startMinute = this.payload[5];
1088
- this.durationHour = this.payload[6];
1089
- this.durationMinute = this.payload[7];
1090
- }
1091
- }
1092
- else {
1093
- this.userId = options.userId;
1094
- this.slotId = options.slotId;
1095
- this.action = options.action;
1096
- if (options.action === _Types_1.ScheduleEntryLockSetAction.Set) {
1097
- this.weekdays = options.weekdays;
1098
- this.startHour = options.startHour;
1099
- this.startMinute = options.startMinute;
1100
- this.durationHour = options.durationHour;
1101
- this.durationMinute = options.durationMinute;
1102
- }
1103
- }
1104
- }
1105
- serialize() {
1106
- this.payload = Buffer.from([this.action, this.userId, this.slotId]);
1107
- if (this.action === _Types_1.ScheduleEntryLockSetAction.Set) {
1108
- this.payload = Buffer.concat([
1109
- this.payload,
1110
- (0, core_1.encodeBitMask)(this.weekdays, _Types_1.ScheduleEntryLockWeekday.Saturday, _Types_1.ScheduleEntryLockWeekday.Sunday),
1111
- Buffer.from([
1112
- this.startHour,
1113
- this.startMinute,
1114
- this.durationHour,
1115
- this.durationMinute,
1116
- ]),
1117
- ]);
1118
- }
1119
- else {
1120
- // Not sure if this is correct
1121
- this.payload = Buffer.concat([this.payload, Buffer.alloc(5, 0xff)]);
1122
- }
1123
- return super.serialize();
1124
- }
1125
- };
1126
- ScheduleEntryLockCCDailyRepeatingScheduleSet = __decorate([
1127
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.DailyRepeatingScheduleSet)
1128
- ], ScheduleEntryLockCCDailyRepeatingScheduleSet);
1129
- exports.ScheduleEntryLockCCDailyRepeatingScheduleSet = ScheduleEntryLockCCDailyRepeatingScheduleSet;
1130
- let ScheduleEntryLockCCDailyRepeatingScheduleReport = class ScheduleEntryLockCCDailyRepeatingScheduleReport extends ScheduleEntryLockCC {
1131
- constructor(host, options) {
1132
- super(host, options);
1133
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1134
- (0, core_1.validatePayload)(this.payload.length >= 2);
1135
- this.userId = this.payload[0];
1136
- this.slotId = this.payload[1];
1137
- if (this.payload.length >= 7) {
1138
- this.weekdays = (0, core_1.parseBitMask)(this.payload.slice(2, 3), _Types_1.ScheduleEntryLockWeekday.Sunday);
1139
- this.startHour = this.payload[3];
1140
- this.startMinute = this.payload[4];
1141
- this.durationHour = this.payload[5];
1142
- this.durationMinute = this.payload[6];
1143
- }
1144
- }
1145
- else {
1146
- this.userId = options.userId;
1147
- this.slotId = options.slotId;
1148
- this.weekdays = options.weekdays;
1149
- this.startHour = options.startHour;
1150
- this.startMinute = options.startMinute;
1151
- this.durationHour = options.durationHour;
1152
- this.durationMinute = options.durationMinute;
1153
- }
1154
- }
1155
- serialize() {
1156
- this.payload = Buffer.from([this.userId, this.slotId]);
1157
- if (this.weekdays) {
1158
- this.payload = Buffer.concat([
1159
- this.payload,
1160
- (0, core_1.encodeBitMask)(this.weekdays, _Types_1.ScheduleEntryLockWeekday.Saturday, _Types_1.ScheduleEntryLockWeekday.Sunday),
1161
- Buffer.from([
1162
- this.startHour,
1163
- this.startMinute,
1164
- this.durationHour,
1165
- this.durationMinute,
1166
- ]),
1167
- ]);
1168
- }
1169
- else {
1170
- // Not sure if this is correct
1171
- this.payload = Buffer.concat([this.payload, Buffer.alloc(5, 0xff)]);
1172
- }
1173
- return super.serialize();
1174
- }
1175
- };
1176
- ScheduleEntryLockCCDailyRepeatingScheduleReport = __decorate([
1177
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.DailyRepeatingScheduleReport)
1178
- ], ScheduleEntryLockCCDailyRepeatingScheduleReport);
1179
- exports.ScheduleEntryLockCCDailyRepeatingScheduleReport = ScheduleEntryLockCCDailyRepeatingScheduleReport;
1180
- let ScheduleEntryLockCCDailyRepeatingScheduleGet = class ScheduleEntryLockCCDailyRepeatingScheduleGet extends ScheduleEntryLockCC {
1181
- constructor(host, options) {
1182
- super(host, options);
1183
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1184
- (0, core_1.validatePayload)(this.payload.length >= 2);
1185
- this.userId = this.payload[0];
1186
- this.slotId = this.payload[1];
1187
- }
1188
- else {
1189
- this.userId = options.userId;
1190
- this.slotId = options.slotId;
1191
- }
1192
- }
1193
- serialize() {
1194
- this.payload = Buffer.from([this.userId, this.slotId]);
1195
- return super.serialize();
1196
- }
1197
- };
1198
- ScheduleEntryLockCCDailyRepeatingScheduleGet = __decorate([
1199
- (0, CommandClassDecorators_1.CCCommand)(_Types_1.ScheduleEntryLockCommand.DailyRepeatingScheduleGet),
1200
- (0, CommandClassDecorators_1.expectedCCResponse)(ScheduleEntryLockCCDailyRepeatingScheduleReport)
1201
- ], ScheduleEntryLockCCDailyRepeatingScheduleGet);
1202
- exports.ScheduleEntryLockCCDailyRepeatingScheduleGet = ScheduleEntryLockCCDailyRepeatingScheduleGet;
1203
- //# sourceMappingURL=ScheduleEntryLockCC.js.map