@vldmit/leap-client 1.7.9
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/LICENSE +21 -0
- package/README.md +151 -0
- package/authority +0 -0
- package/lib/api.md +176 -0
- package/lib/index.d.ts +2055 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +7 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +86 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,2055 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publishes devices, states and actions to an event emitter using the Lutron
|
|
3
|
+
* LEAP protocol.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This will autopmatically discover processors. You will need to press the
|
|
7
|
+
* pairing button on your processor or bridge.
|
|
8
|
+
*
|
|
9
|
+
* @packageDocumentation
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/// <reference types="node" />
|
|
13
|
+
|
|
14
|
+
import { Action } from '@mkellsy/hap-device';
|
|
15
|
+
import { Address as Address_2 } from '@mkellsy/hap-device';
|
|
16
|
+
import { AreaStatus as AreaStatus_2 } from '@mkellsy/hap-device';
|
|
17
|
+
import { Button } from '@mkellsy/hap-device';
|
|
18
|
+
import { Contact as Contact_2 } from '@mkellsy/hap-device';
|
|
19
|
+
import { Device } from '@mkellsy/hap-device';
|
|
20
|
+
import { DeviceState } from '@mkellsy/hap-device';
|
|
21
|
+
import { Dimmer as Dimmer_2 } from '@mkellsy/hap-device';
|
|
22
|
+
import { EventEmitter } from '@mkellsy/event-emitter';
|
|
23
|
+
import { Fan as Fan_2 } from '@mkellsy/hap-device';
|
|
24
|
+
import { ILogger } from 'js-logger';
|
|
25
|
+
import { Keypad as Keypad_2 } from '@mkellsy/hap-device';
|
|
26
|
+
import { Occupancy as Occupancy_2 } from '@mkellsy/hap-device';
|
|
27
|
+
import { pki } from 'node-forge';
|
|
28
|
+
import { Remote as Remote_2 } from '@mkellsy/hap-device';
|
|
29
|
+
import { Shade as Shade_2 } from '@mkellsy/hap-device';
|
|
30
|
+
import { Strip as Strip_2 } from '@mkellsy/hap-device';
|
|
31
|
+
import { Switch as Switch_2 } from '@mkellsy/hap-device';
|
|
32
|
+
import { Timeclock as Timeclock_2 } from '@mkellsy/hap-device';
|
|
33
|
+
import { TimeclockStatus as TimeclockStatus_2 } from '@mkellsy/hap-device';
|
|
34
|
+
import { Unknown as Unknown_2 } from '@mkellsy/hap-device';
|
|
35
|
+
import { ZoneStatus as ZoneStatus_2 } from '@mkellsy/hap-device';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A device address.
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
declare type Address = {
|
|
42
|
+
/**
|
|
43
|
+
* The device href.
|
|
44
|
+
*/
|
|
45
|
+
href: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A device's tooggle properties (extended)
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
declare type AdvancedToggleProperties = {
|
|
53
|
+
/**
|
|
54
|
+
* Primary preset.
|
|
55
|
+
*/
|
|
56
|
+
PrimaryPreset: Address;
|
|
57
|
+
/**
|
|
58
|
+
* Secondary preset.
|
|
59
|
+
*/
|
|
60
|
+
SecondaryPreset: Address;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* List of zones assigned to a button group.
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
declare type AffectedZone = Address & {
|
|
68
|
+
/**
|
|
69
|
+
* Button group.
|
|
70
|
+
*/
|
|
71
|
+
ButtonGroup: ButtonGroup;
|
|
72
|
+
/**
|
|
73
|
+
* Assigned zone.
|
|
74
|
+
*/
|
|
75
|
+
Zone: ZoneAddress;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Represents an area and contains a list of zones, control stations, and
|
|
80
|
+
* sensors.
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
declare type AreaAddress = Address & {
|
|
84
|
+
/**
|
|
85
|
+
* Area name.
|
|
86
|
+
*/
|
|
87
|
+
Name: string;
|
|
88
|
+
/**
|
|
89
|
+
* Area's control type.
|
|
90
|
+
*/
|
|
91
|
+
ControlType: string;
|
|
92
|
+
/**
|
|
93
|
+
* Area's parent node.
|
|
94
|
+
*/
|
|
95
|
+
Parent: Address;
|
|
96
|
+
/**
|
|
97
|
+
* Is this area a leaf, meaning there are no child areas.
|
|
98
|
+
*/
|
|
99
|
+
IsLeaf: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* List of zones in this area.
|
|
102
|
+
*/
|
|
103
|
+
AssociatedZones: Address[];
|
|
104
|
+
/**
|
|
105
|
+
* List of control stations in this area.
|
|
106
|
+
*/
|
|
107
|
+
AssociatedControlStations: Address[];
|
|
108
|
+
/**
|
|
109
|
+
* List of sensors in this area.
|
|
110
|
+
*/
|
|
111
|
+
AssociatedOccupancyGroups: Address[];
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Defines a scene for an area.
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
declare type AreaScene = Address & {
|
|
119
|
+
/**
|
|
120
|
+
* Scene name.
|
|
121
|
+
*/
|
|
122
|
+
Name: string;
|
|
123
|
+
/**
|
|
124
|
+
* The parent node this scene belongs to.
|
|
125
|
+
*/
|
|
126
|
+
Parent: Address;
|
|
127
|
+
/**
|
|
128
|
+
* Scene primary preset.
|
|
129
|
+
*/
|
|
130
|
+
Preset: Address;
|
|
131
|
+
/**
|
|
132
|
+
* Scene order amongst others.
|
|
133
|
+
*/
|
|
134
|
+
SortOrder: number;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* An area status.
|
|
139
|
+
* @private
|
|
140
|
+
*/
|
|
141
|
+
declare type AreaStatus = Address & {
|
|
142
|
+
/**
|
|
143
|
+
* Brightness level.
|
|
144
|
+
*/
|
|
145
|
+
Level: number;
|
|
146
|
+
/**
|
|
147
|
+
* Occupancy status.
|
|
148
|
+
*/
|
|
149
|
+
OccupancyStatus: string;
|
|
150
|
+
/**
|
|
151
|
+
* Area's current scene.
|
|
152
|
+
*/
|
|
153
|
+
CurrentScene: Address;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Area association.
|
|
158
|
+
* @private
|
|
159
|
+
*/
|
|
160
|
+
declare type AssociatedArea = Address & {
|
|
161
|
+
/**
|
|
162
|
+
* Area address.
|
|
163
|
+
*/
|
|
164
|
+
Area: Address;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Sensor association.
|
|
169
|
+
* @private
|
|
170
|
+
*/
|
|
171
|
+
declare type AssociatedSensor = Address & {
|
|
172
|
+
/**
|
|
173
|
+
* Sensor address.
|
|
174
|
+
*/
|
|
175
|
+
OccupancySensor: Address;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Authentication response.
|
|
180
|
+
* @private
|
|
181
|
+
*/
|
|
182
|
+
declare interface Authentication {
|
|
183
|
+
/**
|
|
184
|
+
* Request results
|
|
185
|
+
*/
|
|
186
|
+
SigningResult: {
|
|
187
|
+
/**
|
|
188
|
+
* Root certificate
|
|
189
|
+
*/
|
|
190
|
+
RootCertificate: string;
|
|
191
|
+
/**
|
|
192
|
+
* Auth Certificate
|
|
193
|
+
*/
|
|
194
|
+
Certificate: string;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare namespace Body_2 {
|
|
199
|
+
export {
|
|
200
|
+
BodyType
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Response body types
|
|
206
|
+
* @private
|
|
207
|
+
*/
|
|
208
|
+
declare type BodyType = AreaAddress | AreaAddress[] | AreaScene | AreaScene[] | AreaStatus | AreaStatus[] | Authentication | ButtonAddress | ButtonAddress[] | ButtonGroup | ButtonGroup[] | ButtonGroupExpanded | ButtonGroupExpanded[] | ButtonStatus | ButtonStatus[] | ClientSetting | ClientSetting[] | ControlStation | ControlStation[] | DeviceAddress | DeviceAddress[] | DeviceStatus | DeviceStatus[] | DimmedLevelAssignment | DimmedLevelAssignment[] | ExceptionDetail | ExceptionDetail[] | FanSpeedAssignment | FanSpeedAssignment[] | LinkNode | LinkNode[] | OccupancyGroup | OccupancyGroup[] | OccupancyGroupStatus | OccupancyGroupStatus[] | PhysicalAccess | PingResponse | PingResponse[] | Preset | Preset[] | PresetAssignment | PresetAssignment[] | ProgrammingModel | ProgrammingModel[] | Project | Project[] | TiltAssignment | TiltAssignment[] | TimeclockAddress | TimeclockAddress[] | TimeclockStatus | TimeclockStatus[] | VirtualButton | VirtualButton[] | ZoneAddress | ZoneAddress[] | ZoneStatus | ZoneStatus[];
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Defines a keypad button.
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
declare type ButtonAddress = Address & {
|
|
215
|
+
/**
|
|
216
|
+
* Associated led address.
|
|
217
|
+
*/
|
|
218
|
+
AssociatedLED: Address;
|
|
219
|
+
/**
|
|
220
|
+
* Button number on the keypad.
|
|
221
|
+
*/
|
|
222
|
+
ButtonNumber: number;
|
|
223
|
+
/**
|
|
224
|
+
* Custom engraving, configured name.
|
|
225
|
+
*/
|
|
226
|
+
Engraving: {
|
|
227
|
+
Text: string;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Configured name.
|
|
231
|
+
*/
|
|
232
|
+
Name: string;
|
|
233
|
+
/**
|
|
234
|
+
* Parent node address.
|
|
235
|
+
*/
|
|
236
|
+
Parent: Address;
|
|
237
|
+
/**
|
|
238
|
+
* Button's programming model.
|
|
239
|
+
*/
|
|
240
|
+
ProgrammingModel: ProgrammingModel;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Defines a group of buttons.
|
|
245
|
+
* @private
|
|
246
|
+
*/
|
|
247
|
+
declare type ButtonGroup = Address & {
|
|
248
|
+
/**
|
|
249
|
+
* Zones assigned to the buttons.
|
|
250
|
+
*/
|
|
251
|
+
AffectedZones: AffectedZone[];
|
|
252
|
+
/**
|
|
253
|
+
* List of buttons.
|
|
254
|
+
*/
|
|
255
|
+
Buttons: Address[];
|
|
256
|
+
/**
|
|
257
|
+
* Parent node address.
|
|
258
|
+
*/
|
|
259
|
+
Parent: DeviceAddress;
|
|
260
|
+
/**
|
|
261
|
+
* Button group programming type.
|
|
262
|
+
*/
|
|
263
|
+
ProgrammingType: string;
|
|
264
|
+
/**
|
|
265
|
+
* Order of group amongst others.
|
|
266
|
+
*/
|
|
267
|
+
SortOrder: number;
|
|
268
|
+
/**
|
|
269
|
+
* Special property to stop listening to the button if assicoated zone is
|
|
270
|
+
* in motion.
|
|
271
|
+
*/
|
|
272
|
+
StopIfMoving: string;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Defines a group of buttons (extended)
|
|
277
|
+
* @private
|
|
278
|
+
*/
|
|
279
|
+
declare type ButtonGroupExpanded = Address & {
|
|
280
|
+
/**
|
|
281
|
+
* Zones assigned to the buttons.
|
|
282
|
+
*/
|
|
283
|
+
AffectedZones: AffectedZone[];
|
|
284
|
+
/**
|
|
285
|
+
* List of buttons.
|
|
286
|
+
*/
|
|
287
|
+
Buttons: ButtonAddress[];
|
|
288
|
+
/**
|
|
289
|
+
* Parent node address.
|
|
290
|
+
*/
|
|
291
|
+
Parent: DeviceAddress;
|
|
292
|
+
/**
|
|
293
|
+
* Button group programming type.
|
|
294
|
+
*/
|
|
295
|
+
ProgrammingType: string;
|
|
296
|
+
/**
|
|
297
|
+
* Order of group amongst others.
|
|
298
|
+
*/
|
|
299
|
+
SortOrder: number;
|
|
300
|
+
/**
|
|
301
|
+
* Special property to stop listening to the button if assicoated zone is
|
|
302
|
+
* in motion.
|
|
303
|
+
*/
|
|
304
|
+
StopIfMoving: string;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Defines a button action status.
|
|
309
|
+
* @private
|
|
310
|
+
*/
|
|
311
|
+
declare type ButtonStatus = Address & {
|
|
312
|
+
/**
|
|
313
|
+
* Button address.
|
|
314
|
+
*/
|
|
315
|
+
Button: Address;
|
|
316
|
+
/**
|
|
317
|
+
* Button event, press, release, and long hold.
|
|
318
|
+
*/
|
|
319
|
+
ButtonEvent: {
|
|
320
|
+
EventType: "Press" | "Release" | "LongHold";
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Defines a catagory of devices.
|
|
326
|
+
* @private
|
|
327
|
+
*/
|
|
328
|
+
declare type Category = {
|
|
329
|
+
/**
|
|
330
|
+
* Device type.
|
|
331
|
+
*/
|
|
332
|
+
Type: string;
|
|
333
|
+
/**
|
|
334
|
+
* Device sub-type.
|
|
335
|
+
*/
|
|
336
|
+
SubType: string;
|
|
337
|
+
/**
|
|
338
|
+
* Is this device a light.
|
|
339
|
+
*/
|
|
340
|
+
IsLight: boolean;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Defines an auth certificate.
|
|
345
|
+
* @private
|
|
346
|
+
*/
|
|
347
|
+
declare interface Certificate {
|
|
348
|
+
/**
|
|
349
|
+
* Certificate authority.
|
|
350
|
+
*/
|
|
351
|
+
ca: string;
|
|
352
|
+
/**
|
|
353
|
+
* Certificate public key.
|
|
354
|
+
*/
|
|
355
|
+
key: string;
|
|
356
|
+
/**
|
|
357
|
+
* Certificate contents.
|
|
358
|
+
*/
|
|
359
|
+
cert: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Defines a certificate request.
|
|
364
|
+
* @private
|
|
365
|
+
*/
|
|
366
|
+
declare interface CertificateRequest {
|
|
367
|
+
/**
|
|
368
|
+
* Certificate private key.
|
|
369
|
+
*/
|
|
370
|
+
key: pki.rsa.PrivateKey;
|
|
371
|
+
/**
|
|
372
|
+
* Certificate contents.
|
|
373
|
+
*/
|
|
374
|
+
cert: string;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Creates an object that represents a single location, with a single network.
|
|
379
|
+
* @public
|
|
380
|
+
*/
|
|
381
|
+
export declare class Client extends EventEmitter<{
|
|
382
|
+
Action: (device: Device, button: Button, action: Action) => void;
|
|
383
|
+
Available: (devices: Device[]) => void;
|
|
384
|
+
Message: (response: Response) => void;
|
|
385
|
+
Update: (device: Device, state: DeviceState) => void;
|
|
386
|
+
}> {
|
|
387
|
+
private context;
|
|
388
|
+
private refresh;
|
|
389
|
+
private discovery;
|
|
390
|
+
private discovered;
|
|
391
|
+
private areaPaths;
|
|
392
|
+
/**
|
|
393
|
+
* Creates a location object and starts mDNS discovery.
|
|
394
|
+
*
|
|
395
|
+
* ```js
|
|
396
|
+
* const location = new Client();
|
|
397
|
+
*
|
|
398
|
+
* location.on("Avaliable", (devices: Device[]) => { });
|
|
399
|
+
* ```
|
|
400
|
+
*
|
|
401
|
+
* @param refresh If true, this will ignore any cache and reload.
|
|
402
|
+
*/
|
|
403
|
+
constructor(refresh?: boolean);
|
|
404
|
+
/**
|
|
405
|
+
* A list of processors in this location.
|
|
406
|
+
*
|
|
407
|
+
* @returns A string array of processor ids.
|
|
408
|
+
*/
|
|
409
|
+
get processors(): string[];
|
|
410
|
+
/**
|
|
411
|
+
* Fetch a processor from this location.
|
|
412
|
+
*
|
|
413
|
+
* @param id The processor id to fetch.
|
|
414
|
+
*
|
|
415
|
+
* @returns A processor object or undefined if it doesn't exist.
|
|
416
|
+
*/
|
|
417
|
+
processor(id: string): Processor | undefined;
|
|
418
|
+
/**
|
|
419
|
+
* Closes all connections for a location and stops searching.
|
|
420
|
+
*/
|
|
421
|
+
close(): void;
|
|
422
|
+
private rebuildAreaPaths;
|
|
423
|
+
private withAreaPath;
|
|
424
|
+
private discoverZones;
|
|
425
|
+
private discoverTimeclocks;
|
|
426
|
+
private discoverControls;
|
|
427
|
+
private discoverPositions;
|
|
428
|
+
private onDiscovered;
|
|
429
|
+
private onDeviceUpdate;
|
|
430
|
+
private onDeviceAction;
|
|
431
|
+
private onProcessorError;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Defines a processor client settings.
|
|
436
|
+
* @private
|
|
437
|
+
*/
|
|
438
|
+
declare type ClientSetting = Address & {
|
|
439
|
+
/**
|
|
440
|
+
* Client major version.
|
|
441
|
+
*/
|
|
442
|
+
ClientMajorVersion: number;
|
|
443
|
+
/**
|
|
444
|
+
* Client minor version.
|
|
445
|
+
*/
|
|
446
|
+
ClientMinorVersion: number;
|
|
447
|
+
/**
|
|
448
|
+
* Client permission and role.
|
|
449
|
+
*/
|
|
450
|
+
Permissions: {
|
|
451
|
+
SessionRole: string;
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Establishes a connection to all paired devices.
|
|
457
|
+
*
|
|
458
|
+
* @param refresh (optional) Setting this to true will not load devices from
|
|
459
|
+
* cache.
|
|
460
|
+
*
|
|
461
|
+
* @returns A reference to the location with all processors.
|
|
462
|
+
* @public
|
|
463
|
+
*/
|
|
464
|
+
export declare function connect(refresh?: boolean): Client;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Connects to a device with the provided secure host.
|
|
468
|
+
* @private
|
|
469
|
+
*/
|
|
470
|
+
declare class Connection extends Parser<{
|
|
471
|
+
Connect: (protocol: string) => void;
|
|
472
|
+
Disconnect: () => void;
|
|
473
|
+
Response: (response: Response_2) => void;
|
|
474
|
+
Message: (response: Response_2) => void;
|
|
475
|
+
Error: (error: Error) => void;
|
|
476
|
+
}> {
|
|
477
|
+
private socket?;
|
|
478
|
+
private secure;
|
|
479
|
+
private teardown;
|
|
480
|
+
private host;
|
|
481
|
+
private certificate;
|
|
482
|
+
private requests;
|
|
483
|
+
private subscriptions;
|
|
484
|
+
/**
|
|
485
|
+
* Creates a new connection to a device.
|
|
486
|
+
*
|
|
487
|
+
* ```js
|
|
488
|
+
* const connection = new Connection("192.168.1.1", { ca, key, cert });
|
|
489
|
+
* ```
|
|
490
|
+
*
|
|
491
|
+
* @param host The ip address of the device.
|
|
492
|
+
* @param certificate Authentication certificate.
|
|
493
|
+
*/
|
|
494
|
+
constructor(host: string, certificate?: Certificate);
|
|
495
|
+
/**
|
|
496
|
+
* Detects if a host is reachable.
|
|
497
|
+
*
|
|
498
|
+
* @param host Address of the device.
|
|
499
|
+
*
|
|
500
|
+
* @returns True if the device is rechable, false if not.
|
|
501
|
+
*/
|
|
502
|
+
static reachable(host: string): Promise<boolean>;
|
|
503
|
+
/**
|
|
504
|
+
* Asyncronously connects to a device.
|
|
505
|
+
*
|
|
506
|
+
* ```js
|
|
507
|
+
* await connection.connect();
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
connect(): Promise<void>;
|
|
511
|
+
/**
|
|
512
|
+
* Disconnects from a device.
|
|
513
|
+
*
|
|
514
|
+
* ```js
|
|
515
|
+
* connection.disconnect();
|
|
516
|
+
* ```
|
|
517
|
+
*/
|
|
518
|
+
disconnect(): void;
|
|
519
|
+
/**
|
|
520
|
+
* Fetches a record from the device. Not this only works for a secure
|
|
521
|
+
* connections.
|
|
522
|
+
*
|
|
523
|
+
* ```js
|
|
524
|
+
* const record = await connection.read<Zone>("/zone/123456");
|
|
525
|
+
* ```
|
|
526
|
+
*
|
|
527
|
+
* @param url The url of the record, this is typically a device address.
|
|
528
|
+
*
|
|
529
|
+
* @returns A payload or rejects. The payload is typed per call.
|
|
530
|
+
*/
|
|
531
|
+
read<T>(url: string): Promise<T>;
|
|
532
|
+
/**
|
|
533
|
+
* This sends an authentication request. This only works for non-secure
|
|
534
|
+
* connections.
|
|
535
|
+
*
|
|
536
|
+
* ```js
|
|
537
|
+
* const certificate = await connection.authenticate(csr);
|
|
538
|
+
* ```
|
|
539
|
+
*
|
|
540
|
+
* @param csr Sends a certificate request, typically created with open ssl.
|
|
541
|
+
*
|
|
542
|
+
* @returns An authentication certificate or rejects if failed.
|
|
543
|
+
*/
|
|
544
|
+
authenticate(csr: CertificateRequest): Promise<Certificate>;
|
|
545
|
+
/**
|
|
546
|
+
* Sends a commend to update a device. This only works for secure
|
|
547
|
+
* connections.
|
|
548
|
+
*
|
|
549
|
+
* ```js
|
|
550
|
+
* await connection.update("/zone/123456", state);
|
|
551
|
+
* ```
|
|
552
|
+
*
|
|
553
|
+
* @param url A command url typically the href of a device.
|
|
554
|
+
* @param body An object of values to update.
|
|
555
|
+
*
|
|
556
|
+
* @returns Returns a status paylod. The type is set per call.
|
|
557
|
+
*/
|
|
558
|
+
update<T>(url: string, body: Record<string, unknown>): Promise<T>;
|
|
559
|
+
/**
|
|
560
|
+
* Sends a known command to the device. This only works for secure
|
|
561
|
+
* connections.
|
|
562
|
+
*
|
|
563
|
+
* ```js
|
|
564
|
+
* await connection.command("/zone/123456", command);
|
|
565
|
+
* ```
|
|
566
|
+
*
|
|
567
|
+
* @param url A command url typically the href of a device.
|
|
568
|
+
* @param command A known command object.
|
|
569
|
+
*/
|
|
570
|
+
command(url: string, command: Record<string, unknown>): Promise<void>;
|
|
571
|
+
/**
|
|
572
|
+
* Subscribes to a record on the device. This will bind a listener to that
|
|
573
|
+
* record that will get called every time the record changes. This is
|
|
574
|
+
* helpful for keeping track of the status of an area, zone, or device.
|
|
575
|
+
* This only works for secure connections.
|
|
576
|
+
*
|
|
577
|
+
* ```js
|
|
578
|
+
* connection.subscribe("/zone/123456/status", (response) => { });
|
|
579
|
+
* ```
|
|
580
|
+
*
|
|
581
|
+
* @param url Url to subscribe to.
|
|
582
|
+
* @param listener Callback to run when the record updates.
|
|
583
|
+
*/
|
|
584
|
+
subscribe<T>(url: string, listener: (response: T) => void): Promise<void>;
|
|
585
|
+
private drainRequests;
|
|
586
|
+
private sendRequest;
|
|
587
|
+
private onResponse;
|
|
588
|
+
private onSocketData;
|
|
589
|
+
private onSocketDisconnect;
|
|
590
|
+
private onSocketError;
|
|
591
|
+
private authorityCertificate;
|
|
592
|
+
private physicalAccess;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Defines a CCO device.
|
|
597
|
+
* @public
|
|
598
|
+
*/
|
|
599
|
+
export declare interface Contact extends Contact_2 {
|
|
600
|
+
/**
|
|
601
|
+
* Recieves a state response from the connection and updates the device
|
|
602
|
+
* state.
|
|
603
|
+
*
|
|
604
|
+
* ```js
|
|
605
|
+
* cco.update({ CCOLevel: "Closed" });
|
|
606
|
+
* ```
|
|
607
|
+
*
|
|
608
|
+
* @param status The current device state.
|
|
609
|
+
*/
|
|
610
|
+
update(status: ZoneStatus_2): void;
|
|
611
|
+
/**
|
|
612
|
+
* Controls this device.
|
|
613
|
+
*
|
|
614
|
+
* ```js
|
|
615
|
+
* cco.set({ state: "Closed" });
|
|
616
|
+
* ```
|
|
617
|
+
*
|
|
618
|
+
* @param status Desired device state.
|
|
619
|
+
*/
|
|
620
|
+
set(status: ContactState): Promise<void>;
|
|
621
|
+
/**
|
|
622
|
+
* The current state of the device.
|
|
623
|
+
*
|
|
624
|
+
* @returns The device's state.
|
|
625
|
+
*/
|
|
626
|
+
readonly status: ContactState;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Defines a CCO's current status response.
|
|
631
|
+
* @public
|
|
632
|
+
*/
|
|
633
|
+
export declare interface ContactState extends DeviceState {
|
|
634
|
+
/**
|
|
635
|
+
* Is the contact closed or open.
|
|
636
|
+
*/
|
|
637
|
+
state: "Closed" | "Open";
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Defines a control station.
|
|
642
|
+
* @private
|
|
643
|
+
*/
|
|
644
|
+
declare type ControlStation = Address & {
|
|
645
|
+
/**
|
|
646
|
+
* Control station name.
|
|
647
|
+
*/
|
|
648
|
+
Name: string;
|
|
649
|
+
/**
|
|
650
|
+
* Control station control type.
|
|
651
|
+
*/
|
|
652
|
+
ControlType: string;
|
|
653
|
+
/**
|
|
654
|
+
* PArent node address.
|
|
655
|
+
*/
|
|
656
|
+
Parent: Address;
|
|
657
|
+
/**
|
|
658
|
+
* Area this control station is assigned to.
|
|
659
|
+
*/
|
|
660
|
+
AssociatedArea: Address;
|
|
661
|
+
/**
|
|
662
|
+
* Sort order amongst others.
|
|
663
|
+
*/
|
|
664
|
+
SortOrder: number;
|
|
665
|
+
/**
|
|
666
|
+
* List of assigned devices (keypads, pico remotes).
|
|
667
|
+
*/
|
|
668
|
+
AssociatedGangedDevices: {
|
|
669
|
+
Device: DeviceAddress;
|
|
670
|
+
}[];
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Defines a device.
|
|
675
|
+
* @private
|
|
676
|
+
*/
|
|
677
|
+
declare type DeviceAddress = Address & {
|
|
678
|
+
/**
|
|
679
|
+
* The device name.
|
|
680
|
+
*/
|
|
681
|
+
Name: string;
|
|
682
|
+
/**
|
|
683
|
+
* Parent node address.
|
|
684
|
+
*/
|
|
685
|
+
Parent: Address;
|
|
686
|
+
/**
|
|
687
|
+
* Device serial number.
|
|
688
|
+
*/
|
|
689
|
+
SerialNumber: string;
|
|
690
|
+
/**
|
|
691
|
+
* Device model number.
|
|
692
|
+
*/
|
|
693
|
+
ModelNumber: string;
|
|
694
|
+
/**
|
|
695
|
+
* DEvice type.
|
|
696
|
+
*/
|
|
697
|
+
DeviceType: string;
|
|
698
|
+
/**
|
|
699
|
+
* List of button groups.
|
|
700
|
+
*/
|
|
701
|
+
ButtonGroups: Address[];
|
|
702
|
+
/**
|
|
703
|
+
* List of local zones.
|
|
704
|
+
*/
|
|
705
|
+
LocalZones: Address[];
|
|
706
|
+
/**
|
|
707
|
+
* Area this device belongs to.
|
|
708
|
+
*/
|
|
709
|
+
AssociatedArea: Address;
|
|
710
|
+
/**
|
|
711
|
+
* List of sensors.
|
|
712
|
+
*/
|
|
713
|
+
OccupancySensors: Address[];
|
|
714
|
+
/**
|
|
715
|
+
* List of linked node addresses.
|
|
716
|
+
*/
|
|
717
|
+
LinkNodes: Address[];
|
|
718
|
+
/**
|
|
719
|
+
* List of device rules.
|
|
720
|
+
*/
|
|
721
|
+
DeviceRules: Address[];
|
|
722
|
+
/**
|
|
723
|
+
* Device's repeater properties (if supported).
|
|
724
|
+
*/
|
|
725
|
+
RepeaterProperties: {
|
|
726
|
+
/**
|
|
727
|
+
* Is this device a repeater.
|
|
728
|
+
*/
|
|
729
|
+
IsRepeater: boolean;
|
|
730
|
+
};
|
|
731
|
+
/**
|
|
732
|
+
* Devices firmware information.
|
|
733
|
+
*/
|
|
734
|
+
FirmwareImage: {
|
|
735
|
+
/**
|
|
736
|
+
* Devices firmware.
|
|
737
|
+
*/
|
|
738
|
+
Firmware: {
|
|
739
|
+
/**
|
|
740
|
+
* Firmware name.
|
|
741
|
+
*/
|
|
742
|
+
DisplayName: string;
|
|
743
|
+
};
|
|
744
|
+
/**
|
|
745
|
+
* Currently installed firmware.
|
|
746
|
+
*/
|
|
747
|
+
Installed: {
|
|
748
|
+
/**
|
|
749
|
+
* Year installed.
|
|
750
|
+
*/
|
|
751
|
+
Year: number;
|
|
752
|
+
/**
|
|
753
|
+
* Month installed.
|
|
754
|
+
*/
|
|
755
|
+
Month: number;
|
|
756
|
+
/**
|
|
757
|
+
* Day installed.
|
|
758
|
+
*/
|
|
759
|
+
Day: number;
|
|
760
|
+
/**
|
|
761
|
+
* Hour installed.
|
|
762
|
+
*/
|
|
763
|
+
Hour: number;
|
|
764
|
+
/**
|
|
765
|
+
* Minute installed.
|
|
766
|
+
*/
|
|
767
|
+
Minute: number;
|
|
768
|
+
/**
|
|
769
|
+
* Second installed.
|
|
770
|
+
*/
|
|
771
|
+
Second: number;
|
|
772
|
+
/**
|
|
773
|
+
* UTC date and time installed.
|
|
774
|
+
*/
|
|
775
|
+
Utc: string;
|
|
776
|
+
};
|
|
777
|
+
};
|
|
778
|
+
/**
|
|
779
|
+
* Is this device addressed.
|
|
780
|
+
*/
|
|
781
|
+
AddressedState?: "Addressed" | "Unaddressed" | "Unknown";
|
|
782
|
+
/**
|
|
783
|
+
* Is the device an actual device.
|
|
784
|
+
*/
|
|
785
|
+
IsThisDevice?: boolean;
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Device discovered response.
|
|
790
|
+
* @private
|
|
791
|
+
*/
|
|
792
|
+
declare type DeviceHeard = {
|
|
793
|
+
/**
|
|
794
|
+
* How was this device discovered.
|
|
795
|
+
*/
|
|
796
|
+
DiscoveryMechanism: "UserInteraction" | "UnassociatedDeviceDiscovery" | "Unknown";
|
|
797
|
+
/**
|
|
798
|
+
* Device serial number.
|
|
799
|
+
*/
|
|
800
|
+
SerialNumber: string;
|
|
801
|
+
/**
|
|
802
|
+
* Device type.
|
|
803
|
+
*/
|
|
804
|
+
DeviceType: string;
|
|
805
|
+
/**
|
|
806
|
+
* Device model number.
|
|
807
|
+
*/
|
|
808
|
+
ModelNumber: string;
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Device discovery status.
|
|
813
|
+
* @private
|
|
814
|
+
*/
|
|
815
|
+
declare type DeviceStatus = Address & {
|
|
816
|
+
/**
|
|
817
|
+
* Device discovery response.
|
|
818
|
+
*/
|
|
819
|
+
DeviceHeard: DeviceHeard;
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Dimmed level assignment.
|
|
824
|
+
* @private
|
|
825
|
+
*/
|
|
826
|
+
declare type DimmedLevelAssignment = Address & {
|
|
827
|
+
/**
|
|
828
|
+
* Device, area, or zone address.
|
|
829
|
+
*/
|
|
830
|
+
AssignableResource: Address;
|
|
831
|
+
/**
|
|
832
|
+
* Delay time.
|
|
833
|
+
*/
|
|
834
|
+
DelayTime: string;
|
|
835
|
+
/**
|
|
836
|
+
* Fade duration from previous assignment.
|
|
837
|
+
*/
|
|
838
|
+
FadeTime: string;
|
|
839
|
+
/**
|
|
840
|
+
* Target brightness level.
|
|
841
|
+
*/
|
|
842
|
+
Level: number;
|
|
843
|
+
/**
|
|
844
|
+
* Parent node address.
|
|
845
|
+
*/
|
|
846
|
+
Parent: Address;
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Defines a dimmable light device.
|
|
851
|
+
* @public
|
|
852
|
+
*/
|
|
853
|
+
export declare interface Dimmer extends Dimmer_2 {
|
|
854
|
+
/**
|
|
855
|
+
* Recieves a state response from the connection and updates the device
|
|
856
|
+
* state.
|
|
857
|
+
*
|
|
858
|
+
* ```js
|
|
859
|
+
* dimmer.update({ Level: 100 });
|
|
860
|
+
* ```
|
|
861
|
+
*
|
|
862
|
+
* @param status The current device state.
|
|
863
|
+
*/
|
|
864
|
+
update(status: ZoneStatus_2): void;
|
|
865
|
+
/**
|
|
866
|
+
* Controls this device.
|
|
867
|
+
*
|
|
868
|
+
* ```js
|
|
869
|
+
* dimmer.set({ state: "On", level: 50 });
|
|
870
|
+
* ```
|
|
871
|
+
*
|
|
872
|
+
* @param status Desired device state.
|
|
873
|
+
*/
|
|
874
|
+
set(status: DimmerState): Promise<void>;
|
|
875
|
+
/**
|
|
876
|
+
* The current state of the device.
|
|
877
|
+
*
|
|
878
|
+
* @returns The device's state.
|
|
879
|
+
*/
|
|
880
|
+
readonly status: DimmerState;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Defines a dimmer's current status response.
|
|
885
|
+
* @public
|
|
886
|
+
*/
|
|
887
|
+
export declare interface DimmerState extends DeviceState {
|
|
888
|
+
/**
|
|
889
|
+
* Is the dimmer on or off.
|
|
890
|
+
*/
|
|
891
|
+
state: "On" | "Off";
|
|
892
|
+
/**
|
|
893
|
+
* The dimmer's brightness level.
|
|
894
|
+
*/
|
|
895
|
+
level: number;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* Dual action scene properties.
|
|
900
|
+
* @private
|
|
901
|
+
*/
|
|
902
|
+
declare type DualActionProperties = {
|
|
903
|
+
/**
|
|
904
|
+
* Preset address.
|
|
905
|
+
*/
|
|
906
|
+
PressPreset: Address;
|
|
907
|
+
/**
|
|
908
|
+
* Preset address for the button release.
|
|
909
|
+
*/
|
|
910
|
+
ReleasePreset: Address;
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* Exception response.
|
|
915
|
+
* @private
|
|
916
|
+
*/
|
|
917
|
+
declare class ExceptionDetail {
|
|
918
|
+
/**
|
|
919
|
+
* Responce message.
|
|
920
|
+
*/
|
|
921
|
+
Message: string;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Defines a fan device.
|
|
926
|
+
* @public
|
|
927
|
+
*/
|
|
928
|
+
export declare interface Fan extends Fan_2 {
|
|
929
|
+
/**
|
|
930
|
+
* Recieves a state response from the connection and updates the device
|
|
931
|
+
* state.
|
|
932
|
+
*
|
|
933
|
+
* ```js
|
|
934
|
+
* fan.update({ SwitchedLevel: "On", FanSpeed: 7 });
|
|
935
|
+
* ```
|
|
936
|
+
*
|
|
937
|
+
* @param status The current device state.
|
|
938
|
+
*/
|
|
939
|
+
update(status: ZoneStatus_2): void;
|
|
940
|
+
/**
|
|
941
|
+
* Controls this device.
|
|
942
|
+
*
|
|
943
|
+
* ```js
|
|
944
|
+
* fan.set({ state: "On", speed: 3 });
|
|
945
|
+
* ```
|
|
946
|
+
*
|
|
947
|
+
* @param status Desired device state.
|
|
948
|
+
*/
|
|
949
|
+
set(status: FanState): Promise<void>;
|
|
950
|
+
/**
|
|
951
|
+
* The current state of the device.
|
|
952
|
+
*
|
|
953
|
+
* @returns The device's state.
|
|
954
|
+
*/
|
|
955
|
+
readonly status: FanState;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Fan speed assignement request.
|
|
960
|
+
* @private
|
|
961
|
+
*/
|
|
962
|
+
declare type FanSpeedAssignment = Address & {
|
|
963
|
+
/**
|
|
964
|
+
* Device, arfea, or zone address.
|
|
965
|
+
*/
|
|
966
|
+
AssignableResource: Address;
|
|
967
|
+
/**
|
|
968
|
+
* Delay time.
|
|
969
|
+
*/
|
|
970
|
+
DelayTime: string;
|
|
971
|
+
/**
|
|
972
|
+
* Parent node address.
|
|
973
|
+
*/
|
|
974
|
+
Parent: Address;
|
|
975
|
+
/**
|
|
976
|
+
* Target speed.
|
|
977
|
+
*/
|
|
978
|
+
Speed: string;
|
|
979
|
+
};
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Available fan speed levels.
|
|
983
|
+
* @private
|
|
984
|
+
*/
|
|
985
|
+
declare type FanSpeedType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Defines a fan's current status response.
|
|
989
|
+
* @public
|
|
990
|
+
*/
|
|
991
|
+
export declare interface FanState extends DeviceState {
|
|
992
|
+
/**
|
|
993
|
+
* Is the fan on, off, or set to auto.
|
|
994
|
+
*/
|
|
995
|
+
state: "On" | "Off";
|
|
996
|
+
/**
|
|
997
|
+
* The fan's speed setting.
|
|
998
|
+
*/
|
|
999
|
+
speed: number;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Defines a keypad device.
|
|
1004
|
+
* @public
|
|
1005
|
+
*/
|
|
1006
|
+
export declare interface Keypad extends Keypad_2 {
|
|
1007
|
+
readonly buttons: Button[];
|
|
1008
|
+
/**
|
|
1009
|
+
* Controls this LEDs on this device.
|
|
1010
|
+
*
|
|
1011
|
+
* ```js
|
|
1012
|
+
* keypad.set({ state: { href: "/led/123456" }, state: "On" });
|
|
1013
|
+
* ```
|
|
1014
|
+
*
|
|
1015
|
+
* @param status Desired device state.
|
|
1016
|
+
*/
|
|
1017
|
+
set(status: KeypadState): Promise<void>;
|
|
1018
|
+
/**
|
|
1019
|
+
* The current state of the device.
|
|
1020
|
+
*
|
|
1021
|
+
* @returns The device's state.
|
|
1022
|
+
*/
|
|
1023
|
+
readonly status: KeypadState;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Defines a keypad's LED current status response.
|
|
1028
|
+
* @public
|
|
1029
|
+
*/
|
|
1030
|
+
export declare interface KeypadState extends DeviceState {
|
|
1031
|
+
/**
|
|
1032
|
+
* Is the LED on or off.
|
|
1033
|
+
*/
|
|
1034
|
+
state: "On" | "Off";
|
|
1035
|
+
/**
|
|
1036
|
+
* The address of the LED on the keypad.
|
|
1037
|
+
*/
|
|
1038
|
+
led: Address_2;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Defines a device's linked nodes.
|
|
1043
|
+
* @private
|
|
1044
|
+
*/
|
|
1045
|
+
declare type LinkNode = Address & {
|
|
1046
|
+
/**
|
|
1047
|
+
* Parent node address.
|
|
1048
|
+
*/
|
|
1049
|
+
Parent: Address;
|
|
1050
|
+
/**
|
|
1051
|
+
* Link type.
|
|
1052
|
+
*/
|
|
1053
|
+
LinkType: string;
|
|
1054
|
+
/**
|
|
1055
|
+
* Order amongst others.
|
|
1056
|
+
*/
|
|
1057
|
+
SortOrder: number;
|
|
1058
|
+
/**
|
|
1059
|
+
* Associated link node.
|
|
1060
|
+
*/
|
|
1061
|
+
AssociatedLink: Address;
|
|
1062
|
+
/**
|
|
1063
|
+
* X-Link properties.
|
|
1064
|
+
*/
|
|
1065
|
+
ClearConnectTypeXLinkProperties: {
|
|
1066
|
+
/**
|
|
1067
|
+
* Pan ID.
|
|
1068
|
+
*/
|
|
1069
|
+
PANID: number;
|
|
1070
|
+
/**
|
|
1071
|
+
* Pan ID (extended).
|
|
1072
|
+
*/
|
|
1073
|
+
ExtendedPANID: string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Channel number of the device.
|
|
1076
|
+
*/
|
|
1077
|
+
Channel: number;
|
|
1078
|
+
/**
|
|
1079
|
+
* Network name.
|
|
1080
|
+
*/
|
|
1081
|
+
NetworkName: string;
|
|
1082
|
+
/**
|
|
1083
|
+
* Network security key.
|
|
1084
|
+
*/
|
|
1085
|
+
NetworkMasterKey: string;
|
|
1086
|
+
};
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Defines the available message types.
|
|
1091
|
+
* @private
|
|
1092
|
+
*/
|
|
1093
|
+
declare type MessageType = "OneProjectDefinition" | "OnePresetDefinition" | "OneAreaSceneDefinition" | "OneLinkDefinition" | "OneLinkNodeDefinition" | "MultipleLinkNodeDefinition" | "MultipleLinkDefinition" | "OneControlStationDefinition" | "MultipleControlStationDefinition" | "OneAreaDefinition" | "MultipleAreaDefinition" | "OneAreaStatus" | "MultipleAreaStatus" | "OneDeviceStatus" | "OneDeviceDefinition" | "MultipleDeviceDefinition" | "OneZoneDefinition" | "MultipleZoneDefinition" | "OneZoneStatus" | "MultipleZoneStatus" | "OnePingResponse" | "OneButtonGroupDefinition" | "MultipleButtonGroupDefinition" | "MultipleButtonGroupExpandedDefinition" | "OneButtonDefinition" | "OneButtonStatusEvent" | "MultipleOccupancyGroupStatus" | "OneOccupancyGroupDefinition" | "OneClientSettingDefinition" | "MultipleVirtualButtonDefinition" | "OneVirtualButtonDefinition" | "OneProgrammingModelDefinition" | "OnePresetAssignmentDefinition" | "OneDimmedLevelAssignmentDefinition" | "OneFanSpeedAssignmentDefinition" | "OneTiltAssignmentDefinition" | "OneTimeclockStatus" | "MultipleTimeclockStatus" | "ExceptionDetail";
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Defines a occupancy sensor device.
|
|
1097
|
+
* @public
|
|
1098
|
+
*/
|
|
1099
|
+
export declare interface Occupancy extends Occupancy_2 {
|
|
1100
|
+
/**
|
|
1101
|
+
* Recieves a state response from the connection and updates the device
|
|
1102
|
+
* state.
|
|
1103
|
+
*
|
|
1104
|
+
* ```js
|
|
1105
|
+
* sensor.update({ OccupancyStatus: "Occupied" });
|
|
1106
|
+
* ```
|
|
1107
|
+
*
|
|
1108
|
+
* @param status The current device state.
|
|
1109
|
+
*/
|
|
1110
|
+
update(status: AreaStatus_2): void;
|
|
1111
|
+
/**
|
|
1112
|
+
* The current state of the device.
|
|
1113
|
+
*
|
|
1114
|
+
* @returns The device's state.
|
|
1115
|
+
*/
|
|
1116
|
+
readonly status: OccupancyState;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Defines a group of occupancy sensors.
|
|
1121
|
+
* @private
|
|
1122
|
+
*/
|
|
1123
|
+
declare type OccupancyGroup = Address & {
|
|
1124
|
+
/**
|
|
1125
|
+
* Assigned area addresses.
|
|
1126
|
+
*/
|
|
1127
|
+
AssociatedAreas?: AssociatedArea[];
|
|
1128
|
+
/**
|
|
1129
|
+
* Assigned sensor addresses.
|
|
1130
|
+
*/
|
|
1131
|
+
AssociatedSensors?: AssociatedSensor[];
|
|
1132
|
+
/**
|
|
1133
|
+
* Sensor group programming model.
|
|
1134
|
+
*/
|
|
1135
|
+
ProgrammingModel?: Address;
|
|
1136
|
+
/**
|
|
1137
|
+
* Sensor group programming type.
|
|
1138
|
+
*/
|
|
1139
|
+
ProgrammingType?: string;
|
|
1140
|
+
/**
|
|
1141
|
+
* Sensor enabled/disabled schedule
|
|
1142
|
+
*/
|
|
1143
|
+
OccupiedActionSchedule?: {
|
|
1144
|
+
ScheduleType: string;
|
|
1145
|
+
};
|
|
1146
|
+
/**
|
|
1147
|
+
* Sensor enabled/disabled schedule
|
|
1148
|
+
*/
|
|
1149
|
+
UnoccupiedActionSchedule?: {
|
|
1150
|
+
ScheduleType: string;
|
|
1151
|
+
};
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Occupancy sensor status response.
|
|
1156
|
+
* @private
|
|
1157
|
+
*/
|
|
1158
|
+
declare type OccupancyGroupStatus = Address & {
|
|
1159
|
+
/**
|
|
1160
|
+
* Sensor group.
|
|
1161
|
+
*/
|
|
1162
|
+
OccupancyGroup: OccupancyGroup;
|
|
1163
|
+
/**
|
|
1164
|
+
* Sensor status.
|
|
1165
|
+
*/
|
|
1166
|
+
OccupancyStatus: OccupancyStatus;
|
|
1167
|
+
};
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Defines an occupancy sensor's current status response.
|
|
1171
|
+
* @public
|
|
1172
|
+
*/
|
|
1173
|
+
export declare interface OccupancyState extends DeviceState {
|
|
1174
|
+
/**
|
|
1175
|
+
* Is the sensor detecting occupied or not.
|
|
1176
|
+
*/
|
|
1177
|
+
state: "Occupied" | "Unoccupied";
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
/**
|
|
1181
|
+
* Occupancy status list.
|
|
1182
|
+
* @private
|
|
1183
|
+
*/
|
|
1184
|
+
declare type OccupancyStatus = "Occupied" | "Unoccupied" | "Unknown";
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Starts listening for pairing commands from processors.
|
|
1188
|
+
* @public
|
|
1189
|
+
*/
|
|
1190
|
+
export declare function pair(): Promise<void>;
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Enables response buffering.
|
|
1194
|
+
* @private
|
|
1195
|
+
*/
|
|
1196
|
+
declare class Parser<MAP extends {
|
|
1197
|
+
[key: string]: (...args: any[]) => void;
|
|
1198
|
+
}> extends EventEmitter<MAP> {
|
|
1199
|
+
private buffer;
|
|
1200
|
+
/**
|
|
1201
|
+
* Parses a raw response, and returns via a callback.
|
|
1202
|
+
*
|
|
1203
|
+
* @param data Raw socket buffer.
|
|
1204
|
+
* @param callback Listener for complete response.
|
|
1205
|
+
*/
|
|
1206
|
+
parse(data: Buffer, callback: (response: Response_2) => void): void;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* LED phase setting.
|
|
1211
|
+
* @private
|
|
1212
|
+
*/
|
|
1213
|
+
declare type PhaseSetting = Address & {
|
|
1214
|
+
/**
|
|
1215
|
+
* Phase direction.
|
|
1216
|
+
*/
|
|
1217
|
+
Direction: string;
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* Defines a physical address properties.
|
|
1222
|
+
* @private
|
|
1223
|
+
*/
|
|
1224
|
+
declare interface PhysicalAccess {
|
|
1225
|
+
/**
|
|
1226
|
+
* Address status.
|
|
1227
|
+
*/
|
|
1228
|
+
Status: {
|
|
1229
|
+
/**
|
|
1230
|
+
* Permission list.
|
|
1231
|
+
*/
|
|
1232
|
+
Permissions: unknown[];
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* Processor ping response.
|
|
1238
|
+
* @private
|
|
1239
|
+
*/
|
|
1240
|
+
declare type PingResponse = {
|
|
1241
|
+
/**
|
|
1242
|
+
* LEAP protocol version.
|
|
1243
|
+
*/
|
|
1244
|
+
LEAPVersion: number;
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Defines a preset.
|
|
1249
|
+
* @private
|
|
1250
|
+
*/
|
|
1251
|
+
declare type Preset = Address & {
|
|
1252
|
+
/**
|
|
1253
|
+
* Preset name.
|
|
1254
|
+
*/
|
|
1255
|
+
Name: string;
|
|
1256
|
+
/**
|
|
1257
|
+
* Parent node address.
|
|
1258
|
+
*/
|
|
1259
|
+
Parent: Address;
|
|
1260
|
+
/**
|
|
1261
|
+
* Child preset assignment.
|
|
1262
|
+
*/
|
|
1263
|
+
ChildPresetAssignment: PresetAssignment;
|
|
1264
|
+
/**
|
|
1265
|
+
* Current preset assignments.
|
|
1266
|
+
*/
|
|
1267
|
+
PresetAssignments: Address[];
|
|
1268
|
+
/**
|
|
1269
|
+
* Assignements for fans.
|
|
1270
|
+
*/
|
|
1271
|
+
FanSpeedAssignments: Address[];
|
|
1272
|
+
/**
|
|
1273
|
+
* Assignments for blinds.
|
|
1274
|
+
*/
|
|
1275
|
+
TiltAssignments: Address[];
|
|
1276
|
+
/**
|
|
1277
|
+
* Assignments for dimmers.
|
|
1278
|
+
*/
|
|
1279
|
+
DimmedLevelAssignments: Address[];
|
|
1280
|
+
/**
|
|
1281
|
+
* Assignments for favorites.
|
|
1282
|
+
*/
|
|
1283
|
+
FavoriteCycleAssignments: Address[];
|
|
1284
|
+
/**
|
|
1285
|
+
* Assignments for track blinds.
|
|
1286
|
+
*/
|
|
1287
|
+
NextTrackAssignments: Address[];
|
|
1288
|
+
/**
|
|
1289
|
+
* Assignments for sonos.
|
|
1290
|
+
*/
|
|
1291
|
+
PauseAssignments: Address[];
|
|
1292
|
+
/**
|
|
1293
|
+
* Assignments for sonos.
|
|
1294
|
+
*/
|
|
1295
|
+
PlayPauseToggleAssignments: Address[];
|
|
1296
|
+
/**
|
|
1297
|
+
* Assignments for track blinds.
|
|
1298
|
+
*/
|
|
1299
|
+
RaiseLowerAssignments: Address[];
|
|
1300
|
+
/**
|
|
1301
|
+
* Assignments for track blinds.
|
|
1302
|
+
*/
|
|
1303
|
+
ShadeLevelAssignments: Address[];
|
|
1304
|
+
/**
|
|
1305
|
+
* Assignments for sonos.
|
|
1306
|
+
*/
|
|
1307
|
+
SonosPlayAssignments: Address[];
|
|
1308
|
+
/**
|
|
1309
|
+
* Assignments for switches.
|
|
1310
|
+
*/
|
|
1311
|
+
SwitchedLevelAssignments: Address[];
|
|
1312
|
+
/**
|
|
1313
|
+
* Assignments for let strips.
|
|
1314
|
+
*/
|
|
1315
|
+
WhiteTuningLevelAssignments: Address[];
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1318
|
+
/**
|
|
1319
|
+
* Assigns preset assignment types.
|
|
1320
|
+
* @private
|
|
1321
|
+
*/
|
|
1322
|
+
declare type PresetAssignment = Address & {
|
|
1323
|
+
/**
|
|
1324
|
+
* Assingned zone address.
|
|
1325
|
+
*/
|
|
1326
|
+
AffectedZone?: ZoneAddress;
|
|
1327
|
+
/**
|
|
1328
|
+
* Action delay time.
|
|
1329
|
+
*/
|
|
1330
|
+
Delay?: number;
|
|
1331
|
+
/**
|
|
1332
|
+
* Brightness fade time.
|
|
1333
|
+
*/
|
|
1334
|
+
Fade?: number;
|
|
1335
|
+
/**
|
|
1336
|
+
* Brightness level.
|
|
1337
|
+
*/
|
|
1338
|
+
Level?: number;
|
|
1339
|
+
/**
|
|
1340
|
+
* Preset name.
|
|
1341
|
+
*/
|
|
1342
|
+
Name?: string;
|
|
1343
|
+
/**
|
|
1344
|
+
* Parent node address.
|
|
1345
|
+
*/
|
|
1346
|
+
Parent?: Preset;
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Defines a LEAP processor. This could be a Caseta Smart Bridge, RA2/RA3
|
|
1351
|
+
* Processor, or a Homeworks Processor.
|
|
1352
|
+
* @public
|
|
1353
|
+
*/
|
|
1354
|
+
declare interface Processor extends EventEmitter<{
|
|
1355
|
+
Message: (response: Response_2) => void;
|
|
1356
|
+
Connect: (connection: Connection) => void;
|
|
1357
|
+
Disconnect: () => void;
|
|
1358
|
+
}> {
|
|
1359
|
+
/**
|
|
1360
|
+
* The processor's unique identifier.
|
|
1361
|
+
*
|
|
1362
|
+
* @returns The processor id.
|
|
1363
|
+
*/
|
|
1364
|
+
readonly id: string;
|
|
1365
|
+
/**
|
|
1366
|
+
* A logger for the processor. This will automatically print the
|
|
1367
|
+
* processor id.
|
|
1368
|
+
*
|
|
1369
|
+
* @returns A reference to the logger assigned to this processor.
|
|
1370
|
+
*/
|
|
1371
|
+
readonly log: ILogger;
|
|
1372
|
+
/**
|
|
1373
|
+
* A device map for all devices found on this processor.
|
|
1374
|
+
*
|
|
1375
|
+
* @returns A device map by device id.
|
|
1376
|
+
*/
|
|
1377
|
+
readonly devices: Map<string, Device>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Connects to a processor.
|
|
1380
|
+
*/
|
|
1381
|
+
connect(): Promise<void>;
|
|
1382
|
+
/**
|
|
1383
|
+
* Disconnects from a processor.
|
|
1384
|
+
*/
|
|
1385
|
+
disconnect(): void;
|
|
1386
|
+
/**
|
|
1387
|
+
* Clears the processor's device cache.
|
|
1388
|
+
*/
|
|
1389
|
+
clear(): void;
|
|
1390
|
+
/**
|
|
1391
|
+
* Pings the processor, useful for keeping the connection alive.
|
|
1392
|
+
*
|
|
1393
|
+
* @returns A ping response.
|
|
1394
|
+
*/
|
|
1395
|
+
ping(): Promise<PingResponse>;
|
|
1396
|
+
/**
|
|
1397
|
+
* Sends a read command to the processor.
|
|
1398
|
+
*
|
|
1399
|
+
* @param url The url to read.
|
|
1400
|
+
* @returns A response object.
|
|
1401
|
+
*/
|
|
1402
|
+
read<PAYLOAD = any>(url: string): Promise<PAYLOAD>;
|
|
1403
|
+
/**
|
|
1404
|
+
* Fetches the project information assigned to this processor.
|
|
1405
|
+
*
|
|
1406
|
+
* @returns A project object.
|
|
1407
|
+
*/
|
|
1408
|
+
project(): Promise<Project>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Fetches the processor's system information.
|
|
1411
|
+
*
|
|
1412
|
+
* @returns The processor as a device, or undefined if the processor
|
|
1413
|
+
* doesn't support this.
|
|
1414
|
+
*/
|
|
1415
|
+
system(): Promise<DeviceAddress | undefined>;
|
|
1416
|
+
/**
|
|
1417
|
+
* Fetches available areas. This represents floors, rooms, and suites.
|
|
1418
|
+
*
|
|
1419
|
+
* @returns An array of area objects.
|
|
1420
|
+
*/
|
|
1421
|
+
areas(): Promise<AreaAddress[]>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Fetches available timeclocks.
|
|
1424
|
+
*
|
|
1425
|
+
* @returns An array of timeclock objects.
|
|
1426
|
+
*/
|
|
1427
|
+
timeclocks(): Promise<TimeclockAddress[]>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Fetches available zones in an area. Zones represent a light and control.
|
|
1430
|
+
* In other systems this is the device.
|
|
1431
|
+
*
|
|
1432
|
+
* @param address The area to fetch zones.
|
|
1433
|
+
*
|
|
1434
|
+
* @returns An array of zone objects.
|
|
1435
|
+
*/
|
|
1436
|
+
zones(address: Address): Promise<ZoneAddress[]>;
|
|
1437
|
+
/**
|
|
1438
|
+
* Fetches multiple status objects from an area or zone. Typically used to
|
|
1439
|
+
* fetch sensor states from an area.
|
|
1440
|
+
*
|
|
1441
|
+
* @param address Address of an area or zone.
|
|
1442
|
+
*
|
|
1443
|
+
* @returns A zone status object.
|
|
1444
|
+
*/
|
|
1445
|
+
status(address: Address): Promise<ZoneStatus>;
|
|
1446
|
+
/**
|
|
1447
|
+
* Fetches available control stations of an area or zone. A control station
|
|
1448
|
+
* represents a group of keypads or remotes.
|
|
1449
|
+
*
|
|
1450
|
+
* @param address The address of an area or zone.
|
|
1451
|
+
*
|
|
1452
|
+
* @returns An array of control station objects.
|
|
1453
|
+
*/
|
|
1454
|
+
controls(address: Address): Promise<ControlStation[]>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Fetches a single device in a group. This represents a single keypad or
|
|
1457
|
+
* Pico remote.
|
|
1458
|
+
*
|
|
1459
|
+
* @param address An address of a group position.
|
|
1460
|
+
*
|
|
1461
|
+
* @returns A device object.
|
|
1462
|
+
*/
|
|
1463
|
+
device(address: Address): Promise<DeviceAddress>;
|
|
1464
|
+
/**
|
|
1465
|
+
* Fetches available buttons on a device.
|
|
1466
|
+
*
|
|
1467
|
+
* @param address An address or a device.
|
|
1468
|
+
*
|
|
1469
|
+
* @returns An array of button group objects.
|
|
1470
|
+
*/
|
|
1471
|
+
buttons(address: Address): Promise<ButtonGroupExpanded[]>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Sends an updatre command to the processor.
|
|
1474
|
+
*
|
|
1475
|
+
* @param address The address of the record.
|
|
1476
|
+
* @param field The field to update.
|
|
1477
|
+
* @param value The value to set.
|
|
1478
|
+
*/
|
|
1479
|
+
update(address: Address, field: string, value: object): Promise<void>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Sends a structured command to the processor.
|
|
1482
|
+
*
|
|
1483
|
+
* @param address The address of the zone or device.
|
|
1484
|
+
* @param command The structured command object.
|
|
1485
|
+
*/
|
|
1486
|
+
command(address: Address, command: object): Promise<void>;
|
|
1487
|
+
/**
|
|
1488
|
+
* Subscribes to record updates. This will call the listener every time the
|
|
1489
|
+
* record is updated.
|
|
1490
|
+
*
|
|
1491
|
+
* @param address The assress of the record.
|
|
1492
|
+
* @param listener The callback to call on updates.
|
|
1493
|
+
*/
|
|
1494
|
+
subscribe<T>(address: Address, listener: (response: T) => void): Promise<void>;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* Defines a programming model.
|
|
1499
|
+
* @private
|
|
1500
|
+
*/
|
|
1501
|
+
declare type ProgrammingModel = Address & {
|
|
1502
|
+
/**
|
|
1503
|
+
* Assigned toggle properties.
|
|
1504
|
+
*/
|
|
1505
|
+
AdvancedToggleProperties: AdvancedToggleProperties;
|
|
1506
|
+
/**
|
|
1507
|
+
* Assigned dual action properties.
|
|
1508
|
+
*/
|
|
1509
|
+
DualActionProperties: DualActionProperties;
|
|
1510
|
+
/**
|
|
1511
|
+
* Model name.
|
|
1512
|
+
*/
|
|
1513
|
+
Name: string;
|
|
1514
|
+
/**
|
|
1515
|
+
* Parent node address.
|
|
1516
|
+
*/
|
|
1517
|
+
Parent: Address;
|
|
1518
|
+
/**
|
|
1519
|
+
* Preset address.
|
|
1520
|
+
*/
|
|
1521
|
+
Preset: Address;
|
|
1522
|
+
/**
|
|
1523
|
+
* Programming model type.
|
|
1524
|
+
*/
|
|
1525
|
+
ProgrammingModelType: ProgrammingModelType;
|
|
1526
|
+
};
|
|
1527
|
+
|
|
1528
|
+
/**
|
|
1529
|
+
* Available programming mode types.
|
|
1530
|
+
* @private
|
|
1531
|
+
*/
|
|
1532
|
+
declare type ProgrammingModelType = "SingleActionProgrammingModel" | "SingleSceneRaiseProgrammingModel" | "DualActionProgrammingModel" | "AdvancedToggleProgrammingModel" | "AdvancedConditionalProgrammingModel" | "SingleSceneLowerProgrammingModel" | "SimpleConditionalProgrammingModel" | "OpenStopCloseStopProgrammingModel" | "Unknown";
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Defines a project on a processor.
|
|
1536
|
+
* @private
|
|
1537
|
+
*/
|
|
1538
|
+
declare type Project = Address & {
|
|
1539
|
+
/**
|
|
1540
|
+
* Project name.
|
|
1541
|
+
*/
|
|
1542
|
+
Name: string;
|
|
1543
|
+
/**
|
|
1544
|
+
* Control type.
|
|
1545
|
+
*/
|
|
1546
|
+
ControlType: string;
|
|
1547
|
+
/**
|
|
1548
|
+
* Product type.
|
|
1549
|
+
*/
|
|
1550
|
+
ProductType: string;
|
|
1551
|
+
/**
|
|
1552
|
+
* Project contact list.
|
|
1553
|
+
*/
|
|
1554
|
+
Contacts: Address[];
|
|
1555
|
+
/**
|
|
1556
|
+
* Timeclock event rules.
|
|
1557
|
+
*/
|
|
1558
|
+
TimeclockEventRules: Address;
|
|
1559
|
+
/**
|
|
1560
|
+
* Last modification date.
|
|
1561
|
+
*/
|
|
1562
|
+
ProjectModifiedTimestamp: {
|
|
1563
|
+
/**
|
|
1564
|
+
* Year modified.
|
|
1565
|
+
*/
|
|
1566
|
+
Year: number;
|
|
1567
|
+
/**
|
|
1568
|
+
* Month modified.
|
|
1569
|
+
*/
|
|
1570
|
+
Month: number;
|
|
1571
|
+
/**
|
|
1572
|
+
* Day modified.
|
|
1573
|
+
*/
|
|
1574
|
+
Day: number;
|
|
1575
|
+
/**
|
|
1576
|
+
* Hour modified.
|
|
1577
|
+
*/
|
|
1578
|
+
Hour: number;
|
|
1579
|
+
/**
|
|
1580
|
+
* Minute modified.
|
|
1581
|
+
*/
|
|
1582
|
+
Minute: number;
|
|
1583
|
+
/**
|
|
1584
|
+
* Second modified.
|
|
1585
|
+
*/
|
|
1586
|
+
Second: number;
|
|
1587
|
+
/**
|
|
1588
|
+
* UTC date and time modified.
|
|
1589
|
+
*/
|
|
1590
|
+
Utc: "string";
|
|
1591
|
+
};
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* Defines a Pico remote device.
|
|
1596
|
+
* @public
|
|
1597
|
+
*/
|
|
1598
|
+
export declare interface Remote extends Remote_2 {
|
|
1599
|
+
readonly buttons: Button[];
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* List of available request types.
|
|
1604
|
+
* @private
|
|
1605
|
+
*/
|
|
1606
|
+
declare type RequestType = "CreateRequest" | "CreateResponse" | "DeleteRequest" | "DeleteResponse" | "ExceptionResponse" | "MetadataRequest" | "MetadataResponse" | "ReadRequest" | "ReadResponse" | "SubscribeRequest" | "SubscribeResponse" | "UnsubscribeRequest" | "UnsubscribeResponse" | "UpdateRequest" | "UpdateResponse";
|
|
1607
|
+
|
|
1608
|
+
/**
|
|
1609
|
+
* Defines a processor response.
|
|
1610
|
+
* @private
|
|
1611
|
+
*/
|
|
1612
|
+
declare class Response_2 {
|
|
1613
|
+
CommuniqueType?: RequestType;
|
|
1614
|
+
Body?: Body_2.BodyType;
|
|
1615
|
+
Header: ResponseHeader;
|
|
1616
|
+
/**
|
|
1617
|
+
* Creates a new response object.
|
|
1618
|
+
*/
|
|
1619
|
+
constructor();
|
|
1620
|
+
/**
|
|
1621
|
+
* Parses complete responses to a response object.
|
|
1622
|
+
*
|
|
1623
|
+
* @param value The assembled response.
|
|
1624
|
+
*
|
|
1625
|
+
* @returns Returns a response object.
|
|
1626
|
+
*/
|
|
1627
|
+
static parse(value: string): Response_2;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/**
|
|
1631
|
+
* Creates a response header object.
|
|
1632
|
+
* @private
|
|
1633
|
+
*/
|
|
1634
|
+
declare class ResponseHeader {
|
|
1635
|
+
StatusCode?: ResponseStatus;
|
|
1636
|
+
Url?: string;
|
|
1637
|
+
MessageBodyType?: MessageType;
|
|
1638
|
+
ClientTag?: string;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
/**
|
|
1642
|
+
* Creates a response status object.
|
|
1643
|
+
* @private
|
|
1644
|
+
*/
|
|
1645
|
+
declare class ResponseStatus {
|
|
1646
|
+
/**
|
|
1647
|
+
* Status message
|
|
1648
|
+
*/
|
|
1649
|
+
message?: string;
|
|
1650
|
+
/**
|
|
1651
|
+
* Status code
|
|
1652
|
+
*/
|
|
1653
|
+
code?: number;
|
|
1654
|
+
/**
|
|
1655
|
+
* Creates a response status object.
|
|
1656
|
+
*
|
|
1657
|
+
* @param message Complete response.
|
|
1658
|
+
* @param code Response code from the message.
|
|
1659
|
+
*/
|
|
1660
|
+
constructor(message?: string, code?: number);
|
|
1661
|
+
/**
|
|
1662
|
+
* Creates a response status object from a string.
|
|
1663
|
+
*
|
|
1664
|
+
* @param value Status string.
|
|
1665
|
+
*
|
|
1666
|
+
* @returns A response status object.
|
|
1667
|
+
*/
|
|
1668
|
+
static fromString(value?: string): ResponseStatus;
|
|
1669
|
+
/**
|
|
1670
|
+
* Is the status successful.
|
|
1671
|
+
*
|
|
1672
|
+
* @returns True if successful, false if not.
|
|
1673
|
+
*/
|
|
1674
|
+
isSuccessful(): boolean;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
/**
|
|
1678
|
+
* Defines a window shade device.
|
|
1679
|
+
* @public
|
|
1680
|
+
*/
|
|
1681
|
+
export declare interface Shade extends Shade_2 {
|
|
1682
|
+
/**
|
|
1683
|
+
* Recieves a state response from the connection and updates the device
|
|
1684
|
+
* state.
|
|
1685
|
+
*
|
|
1686
|
+
* ```js
|
|
1687
|
+
* shade.update({ Level: 100 });
|
|
1688
|
+
* ```
|
|
1689
|
+
*
|
|
1690
|
+
* @param status The current device state.
|
|
1691
|
+
*/
|
|
1692
|
+
update(status: ZoneStatus_2): void;
|
|
1693
|
+
/**
|
|
1694
|
+
* Controls this device.
|
|
1695
|
+
*
|
|
1696
|
+
* ```js
|
|
1697
|
+
* shade.set({ state: "Open", level: 50, tilt: 50 });
|
|
1698
|
+
* ```
|
|
1699
|
+
*
|
|
1700
|
+
* @param status Desired device state.
|
|
1701
|
+
*/
|
|
1702
|
+
set(status: ShadeState): Promise<void>;
|
|
1703
|
+
/**
|
|
1704
|
+
* The current state of the device.
|
|
1705
|
+
*
|
|
1706
|
+
* @returns The device's state.
|
|
1707
|
+
*/
|
|
1708
|
+
readonly status: ShadeState;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
/**
|
|
1712
|
+
* Defines a shade's current status response.
|
|
1713
|
+
* @public
|
|
1714
|
+
*/
|
|
1715
|
+
export declare interface ShadeState extends DeviceState {
|
|
1716
|
+
/**
|
|
1717
|
+
* Is the shade open or closed.
|
|
1718
|
+
*/
|
|
1719
|
+
state: "Open" | "Closed";
|
|
1720
|
+
/**
|
|
1721
|
+
* The shade's open level.
|
|
1722
|
+
*/
|
|
1723
|
+
level: number;
|
|
1724
|
+
/**
|
|
1725
|
+
* The shade's tilt level.
|
|
1726
|
+
*/
|
|
1727
|
+
tilt?: number;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
/**
|
|
1731
|
+
* Defines a LED strip device.
|
|
1732
|
+
* @public
|
|
1733
|
+
*/
|
|
1734
|
+
export declare interface Strip extends Strip_2 {
|
|
1735
|
+
/**
|
|
1736
|
+
* Recieves a state response from the connection and updates the device
|
|
1737
|
+
* state.
|
|
1738
|
+
*
|
|
1739
|
+
* ```js
|
|
1740
|
+
* strip.update({ Level: 100 });
|
|
1741
|
+
* ```
|
|
1742
|
+
*
|
|
1743
|
+
* @param status The current device state.
|
|
1744
|
+
*/
|
|
1745
|
+
update(status: ZoneStatus_2): void;
|
|
1746
|
+
/**
|
|
1747
|
+
* Controls this device.
|
|
1748
|
+
*
|
|
1749
|
+
* ```js
|
|
1750
|
+
* strip.set({ state: "On", level: 50, luminance: 3000 });
|
|
1751
|
+
* ```
|
|
1752
|
+
*
|
|
1753
|
+
* @param status Desired device state.
|
|
1754
|
+
*/
|
|
1755
|
+
set(status: StripState): Promise<void>;
|
|
1756
|
+
/**
|
|
1757
|
+
* The current state of the device.
|
|
1758
|
+
*
|
|
1759
|
+
* @returns The device's state.
|
|
1760
|
+
*/
|
|
1761
|
+
readonly status: StripState;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
/**
|
|
1765
|
+
* Defines a LED strip's current status response.
|
|
1766
|
+
* @public
|
|
1767
|
+
*/
|
|
1768
|
+
export declare interface StripState extends DeviceState {
|
|
1769
|
+
/**
|
|
1770
|
+
* Is the LED strip on or off.
|
|
1771
|
+
*/
|
|
1772
|
+
state: "On" | "Off";
|
|
1773
|
+
/**
|
|
1774
|
+
* The LED strip's brightness level.
|
|
1775
|
+
*/
|
|
1776
|
+
level: number;
|
|
1777
|
+
/**
|
|
1778
|
+
* The LED's color temperature luminance.
|
|
1779
|
+
*/
|
|
1780
|
+
luminance: number;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* Defines a on/off switch device.
|
|
1785
|
+
* @public
|
|
1786
|
+
*/
|
|
1787
|
+
export declare interface Switch extends Switch_2 {
|
|
1788
|
+
/**
|
|
1789
|
+
* Recieves a state response from the connection and updates the device
|
|
1790
|
+
* state.
|
|
1791
|
+
*
|
|
1792
|
+
* ```js
|
|
1793
|
+
* switch.update({ SwitchedLevel: "On" });
|
|
1794
|
+
* ```
|
|
1795
|
+
*
|
|
1796
|
+
* @param status The current device state.
|
|
1797
|
+
*/
|
|
1798
|
+
update(status: ZoneStatus_2): void;
|
|
1799
|
+
/**
|
|
1800
|
+
* Controls this device.
|
|
1801
|
+
*
|
|
1802
|
+
* ```js
|
|
1803
|
+
* switch.set({ state: "On" });
|
|
1804
|
+
* ```
|
|
1805
|
+
*
|
|
1806
|
+
* @param status Desired device state.
|
|
1807
|
+
*/
|
|
1808
|
+
set(status: SwitchState): Promise<void>;
|
|
1809
|
+
/**
|
|
1810
|
+
* The current state of the device.
|
|
1811
|
+
*
|
|
1812
|
+
* @returns The device's state.
|
|
1813
|
+
*/
|
|
1814
|
+
readonly status: SwitchState;
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* Defines a switch's current status response.
|
|
1819
|
+
* @public
|
|
1820
|
+
*/
|
|
1821
|
+
export declare interface SwitchState extends DeviceState {
|
|
1822
|
+
/**
|
|
1823
|
+
* Is the switch on or off.
|
|
1824
|
+
*/
|
|
1825
|
+
state: "On" | "Off";
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* Defines a blind tilt update object.
|
|
1830
|
+
* @private
|
|
1831
|
+
*/
|
|
1832
|
+
declare type TiltAssignment = Address & {
|
|
1833
|
+
/**
|
|
1834
|
+
* Parent node address.
|
|
1835
|
+
*/
|
|
1836
|
+
Parent: Address;
|
|
1837
|
+
/**
|
|
1838
|
+
* Assigned resource address.
|
|
1839
|
+
*/
|
|
1840
|
+
AssignableResource: Address;
|
|
1841
|
+
/**
|
|
1842
|
+
* Delay time.
|
|
1843
|
+
*/
|
|
1844
|
+
DelayTime: string;
|
|
1845
|
+
/**
|
|
1846
|
+
* Target tilt assignment.
|
|
1847
|
+
*/
|
|
1848
|
+
Tilt: number;
|
|
1849
|
+
};
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Defines a timeclock device.
|
|
1853
|
+
* @public
|
|
1854
|
+
*/
|
|
1855
|
+
export declare interface Timeclock extends Timeclock_2 {
|
|
1856
|
+
/**
|
|
1857
|
+
* Recieves a state response from the connection and updates the device
|
|
1858
|
+
* state.
|
|
1859
|
+
*
|
|
1860
|
+
* ```js
|
|
1861
|
+
* timeclock.update({ EnabledState: "Enabled" });
|
|
1862
|
+
* ```
|
|
1863
|
+
*
|
|
1864
|
+
* @param status The current device state.
|
|
1865
|
+
*/
|
|
1866
|
+
update(status: TimeclockStatus_2): void;
|
|
1867
|
+
/**
|
|
1868
|
+
* The current state of the device.
|
|
1869
|
+
*
|
|
1870
|
+
* @returns The device's state.
|
|
1871
|
+
*/
|
|
1872
|
+
readonly status: TimeclockState;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Defines a timeclock.
|
|
1877
|
+
* @private
|
|
1878
|
+
*/
|
|
1879
|
+
declare type TimeclockAddress = Address & {
|
|
1880
|
+
/**
|
|
1881
|
+
* Timeclock name.
|
|
1882
|
+
*/
|
|
1883
|
+
Name: string;
|
|
1884
|
+
/**
|
|
1885
|
+
* Parent node address.
|
|
1886
|
+
*/
|
|
1887
|
+
Parent: Address;
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
/**
|
|
1891
|
+
* Defines a timeclock's current status response.
|
|
1892
|
+
* @public
|
|
1893
|
+
*/
|
|
1894
|
+
export declare interface TimeclockState extends DeviceState {
|
|
1895
|
+
/**
|
|
1896
|
+
* Is the timeclock enabled or disabled.
|
|
1897
|
+
*/
|
|
1898
|
+
state: "On" | "Off";
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* Defines a timeclock status.
|
|
1903
|
+
* @private
|
|
1904
|
+
*/
|
|
1905
|
+
declare type TimeclockStatus = Address & {
|
|
1906
|
+
/**
|
|
1907
|
+
* Associated timeclock address.
|
|
1908
|
+
*/
|
|
1909
|
+
Timeclock: Address;
|
|
1910
|
+
/**
|
|
1911
|
+
* Is the timeclock enabled.
|
|
1912
|
+
*/
|
|
1913
|
+
EnabledState: string;
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* Defines trim tuning setting.
|
|
1918
|
+
* @private
|
|
1919
|
+
*/
|
|
1920
|
+
declare type TuningSetting = Address & {
|
|
1921
|
+
/**
|
|
1922
|
+
* Level max.
|
|
1923
|
+
*/
|
|
1924
|
+
HighEndTrim: number;
|
|
1925
|
+
/**
|
|
1926
|
+
* Level min.
|
|
1927
|
+
*/
|
|
1928
|
+
LowEndTrim: number;
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1931
|
+
/**
|
|
1932
|
+
* Defines an unknown device.
|
|
1933
|
+
* @public
|
|
1934
|
+
*/
|
|
1935
|
+
export declare interface Unknown extends Unknown_2 {
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Defines a virtual button.
|
|
1940
|
+
* @private
|
|
1941
|
+
*/
|
|
1942
|
+
declare type VirtualButton = Address & {
|
|
1943
|
+
/**
|
|
1944
|
+
* Button number.
|
|
1945
|
+
*/
|
|
1946
|
+
ButtonNumber: number;
|
|
1947
|
+
/**
|
|
1948
|
+
* Button category.
|
|
1949
|
+
*/
|
|
1950
|
+
Category: Category;
|
|
1951
|
+
/**
|
|
1952
|
+
* Is the button programmed.
|
|
1953
|
+
*/
|
|
1954
|
+
IsProgrammed: boolean;
|
|
1955
|
+
/**
|
|
1956
|
+
* Button name.
|
|
1957
|
+
*/
|
|
1958
|
+
Name: string;
|
|
1959
|
+
/**
|
|
1960
|
+
* Parent node address.
|
|
1961
|
+
*/
|
|
1962
|
+
Parent: Address;
|
|
1963
|
+
/**
|
|
1964
|
+
* Button's programming model.
|
|
1965
|
+
*/
|
|
1966
|
+
ProgrammingModel: Address;
|
|
1967
|
+
};
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* Defines a zone.
|
|
1971
|
+
* @private
|
|
1972
|
+
*/
|
|
1973
|
+
declare type ZoneAddress = Address & {
|
|
1974
|
+
/**
|
|
1975
|
+
* Zone name.
|
|
1976
|
+
*/
|
|
1977
|
+
Name: string;
|
|
1978
|
+
/**
|
|
1979
|
+
* Zone control type.
|
|
1980
|
+
*/
|
|
1981
|
+
ControlType: string;
|
|
1982
|
+
/**
|
|
1983
|
+
* (optional) Zone category if exists.
|
|
1984
|
+
*/
|
|
1985
|
+
Category?: Category;
|
|
1986
|
+
/**
|
|
1987
|
+
* (optional) Associated device if exists.
|
|
1988
|
+
*/
|
|
1989
|
+
Device?: Address;
|
|
1990
|
+
/**
|
|
1991
|
+
* (optional) Associated facade.
|
|
1992
|
+
*/
|
|
1993
|
+
AssociatedFacade?: Address;
|
|
1994
|
+
/**
|
|
1995
|
+
* (optional) Associated area.
|
|
1996
|
+
*/
|
|
1997
|
+
AssociatedArea?: Address;
|
|
1998
|
+
/**
|
|
1999
|
+
* (optional) Phase settings.
|
|
2000
|
+
*/
|
|
2001
|
+
PhaseSettings?: PhaseSetting;
|
|
2002
|
+
/**
|
|
2003
|
+
* Sort order amongst others.
|
|
2004
|
+
*/
|
|
2005
|
+
SortOrder?: number;
|
|
2006
|
+
/**
|
|
2007
|
+
* (optional) Associated trim tuning.
|
|
2008
|
+
*/
|
|
2009
|
+
TuningSettings?: TuningSetting;
|
|
2010
|
+
};
|
|
2011
|
+
|
|
2012
|
+
/**
|
|
2013
|
+
* Defines a zone status object.
|
|
2014
|
+
* @private
|
|
2015
|
+
*/
|
|
2016
|
+
declare type ZoneStatus = Address & {
|
|
2017
|
+
/**
|
|
2018
|
+
* Contact closure state.
|
|
2019
|
+
*/
|
|
2020
|
+
CCOLevel: "Open" | "Closed";
|
|
2021
|
+
/**
|
|
2022
|
+
* Brightness level.
|
|
2023
|
+
*/
|
|
2024
|
+
Level: number;
|
|
2025
|
+
/**
|
|
2026
|
+
* Binary switch state.
|
|
2027
|
+
*/
|
|
2028
|
+
SwitchedLevel: "On" | "Off";
|
|
2029
|
+
/**
|
|
2030
|
+
* Fan speed state.
|
|
2031
|
+
*/
|
|
2032
|
+
FanSpeed: FanSpeedType;
|
|
2033
|
+
/**
|
|
2034
|
+
* Associated zone address.
|
|
2035
|
+
*/
|
|
2036
|
+
Zone: Address;
|
|
2037
|
+
/**
|
|
2038
|
+
* Accuracy status (always good)
|
|
2039
|
+
*/
|
|
2040
|
+
StatusAccuracy: "Good";
|
|
2041
|
+
/**
|
|
2042
|
+
* Associated area address.
|
|
2043
|
+
*/
|
|
2044
|
+
AssociatedArea: Address;
|
|
2045
|
+
/**
|
|
2046
|
+
* Zone avaibility status.
|
|
2047
|
+
*/
|
|
2048
|
+
Availability: "Available" | "Unavailable" | "Mixed" | "Unknown";
|
|
2049
|
+
/**
|
|
2050
|
+
* Blind tilt state.
|
|
2051
|
+
*/
|
|
2052
|
+
Tilt: number;
|
|
2053
|
+
};
|
|
2054
|
+
|
|
2055
|
+
export { }
|