@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Michael Kellsy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Lutron LEAP Client
|
|
2
|
+
|
|
3
|
+
Publishes devices, states and actions to an event emitter using the Lutron LEAP protocol.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
[**API Documentation**](docs/README.md)
|
|
8
|
+
|
|
9
|
+
Pairing a processor or bridge
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { pair } from "@mkellsy/leap-client";
|
|
13
|
+
|
|
14
|
+
console.log("Press the pairing button on the main processor or smart bridge");
|
|
15
|
+
|
|
16
|
+
await pair();
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This will autopmatically discover processors. You will need to press the pairing button on your processor or bridge.
|
|
20
|
+
|
|
21
|
+
If you have multiple systems Caseta and RA3, you can pair other processors or bridges by runnging the pair command again, and pressing the pairing button on the other device.
|
|
22
|
+
|
|
23
|
+
> Systems that have more than one processor, such as RA3, you will only need to pair the first bridge. Devices programed for other bridges are vended from all processors.
|
|
24
|
+
|
|
25
|
+
After you have a processor or bridge paired, you can connect.
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import { connect } from "@mkellsy/leap-client";
|
|
29
|
+
|
|
30
|
+
const location = connect();
|
|
31
|
+
|
|
32
|
+
location.on("Available", (processor): void => {
|
|
33
|
+
// event fired when all devices are available
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
location.on("Update", (device, state): void => {
|
|
37
|
+
// event fired when the device state updates
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
location.on("Action", (device, button, action): void => {
|
|
41
|
+
// event fired when a device action occurs
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> The processor will cache slow changing data, to refresh the areas, zones, remotes, etc... you can set the refresh flag when calling connect `connect(true)`.
|
|
46
|
+
|
|
47
|
+
Fetch a list of processors.
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
for (const id of location.processors) {
|
|
51
|
+
// the id is the processor id string
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Accessing the processor
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
const processor = location.processor(id);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Pinging the a processor or bridge
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
const response = await processor.ping();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Processor details.
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
const system = await processor.system();
|
|
71
|
+
const project = await processor.project();
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Fetch a list of areas
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const areas = await processor.areas();
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Fetch all statuses
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
const statuses = await processor.statuses();
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Fetch zones in an area
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
const zones = await processor.zones(area);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Fetch a zone or area status
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
const areaStatus = await processor.status(area);
|
|
96
|
+
const zoneStatus = await processor.status(zone);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Fetch an area's controls
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
const controls = await processor.controls(area);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Fetching ganged controls
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
const controls = await processor.controls(area);
|
|
109
|
+
|
|
110
|
+
for (const gangedDevice of control.AssociatedGangedDevices) {
|
|
111
|
+
const address = gangedDevice.Device;
|
|
112
|
+
|
|
113
|
+
// the the address can be used to fetch the pico remote, sensor, keypad
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Fetching a device
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
const device = await processor.device(address);
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Fetching a devices buttons
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
const buttons = await processor.buttons(device);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Executing a command
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
await processor.command(deviceOrZone, commandObject);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Fetching a discovered device
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
const device = processor.devices.get(id);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Update the status of a device
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
device.update(state);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Set a property(s) of a device
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
device.set(state);
|
|
151
|
+
```
|
package/authority
ADDED
|
Binary file
|
package/lib/api.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
## API Report File for "@vldmit/leap-client"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
|
|
9
|
+
import { Action } from '@mkellsy/hap-device';
|
|
10
|
+
import { Address as Address_2 } from '@mkellsy/hap-device';
|
|
11
|
+
import { AreaStatus as AreaStatus_2 } from '@mkellsy/hap-device';
|
|
12
|
+
import { Button } from '@mkellsy/hap-device';
|
|
13
|
+
import { Contact as Contact_2 } from '@mkellsy/hap-device';
|
|
14
|
+
import { Device } from '@mkellsy/hap-device';
|
|
15
|
+
import { DeviceState } from '@mkellsy/hap-device';
|
|
16
|
+
import { Dimmer as Dimmer_2 } from '@mkellsy/hap-device';
|
|
17
|
+
import { EventEmitter } from '@mkellsy/event-emitter';
|
|
18
|
+
import { Fan as Fan_2 } from '@mkellsy/hap-device';
|
|
19
|
+
import { ILogger } from 'js-logger';
|
|
20
|
+
import { Keypad as Keypad_2 } from '@mkellsy/hap-device';
|
|
21
|
+
import { Occupancy as Occupancy_2 } from '@mkellsy/hap-device';
|
|
22
|
+
import { pki } from 'node-forge';
|
|
23
|
+
import { Remote as Remote_2 } from '@mkellsy/hap-device';
|
|
24
|
+
import { Shade as Shade_2 } from '@mkellsy/hap-device';
|
|
25
|
+
import { Strip as Strip_2 } from '@mkellsy/hap-device';
|
|
26
|
+
import { Switch as Switch_2 } from '@mkellsy/hap-device';
|
|
27
|
+
import { Timeclock as Timeclock_2 } from '@mkellsy/hap-device';
|
|
28
|
+
import { TimeclockStatus as TimeclockStatus_2 } from '@mkellsy/hap-device';
|
|
29
|
+
import { Unknown as Unknown_2 } from '@mkellsy/hap-device';
|
|
30
|
+
import { ZoneStatus as ZoneStatus_2 } from '@mkellsy/hap-device';
|
|
31
|
+
|
|
32
|
+
// @public
|
|
33
|
+
export class Client extends EventEmitter<{
|
|
34
|
+
Action: (device: Device, button: Button, action: Action) => void;
|
|
35
|
+
Available: (devices: Device[]) => void;
|
|
36
|
+
Message: (response: Response) => void;
|
|
37
|
+
Update: (device: Device, state: DeviceState) => void;
|
|
38
|
+
}> {
|
|
39
|
+
constructor(refresh?: boolean);
|
|
40
|
+
close(): void;
|
|
41
|
+
// Warning: (ae-forgotten-export) The symbol "Processor" needs to be exported by the entry point index.d.ts
|
|
42
|
+
processor(id: string): Processor | undefined;
|
|
43
|
+
get processors(): string[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// @public
|
|
47
|
+
export function connect(refresh?: boolean): Client;
|
|
48
|
+
|
|
49
|
+
// @public
|
|
50
|
+
export interface Contact extends Contact_2 {
|
|
51
|
+
set(status: ContactState): Promise<void>;
|
|
52
|
+
readonly status: ContactState;
|
|
53
|
+
update(status: ZoneStatus_2): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// @public
|
|
57
|
+
export interface ContactState extends DeviceState {
|
|
58
|
+
state: "Closed" | "Open";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// @public
|
|
62
|
+
export interface Dimmer extends Dimmer_2 {
|
|
63
|
+
set(status: DimmerState): Promise<void>;
|
|
64
|
+
readonly status: DimmerState;
|
|
65
|
+
update(status: ZoneStatus_2): void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// @public
|
|
69
|
+
export interface DimmerState extends DeviceState {
|
|
70
|
+
level: number;
|
|
71
|
+
state: "On" | "Off";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// @public
|
|
75
|
+
export interface Fan extends Fan_2 {
|
|
76
|
+
set(status: FanState): Promise<void>;
|
|
77
|
+
readonly status: FanState;
|
|
78
|
+
update(status: ZoneStatus_2): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// @public
|
|
82
|
+
export interface FanState extends DeviceState {
|
|
83
|
+
speed: number;
|
|
84
|
+
state: "On" | "Off";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// @public
|
|
88
|
+
export interface Keypad extends Keypad_2 {
|
|
89
|
+
// (undocumented)
|
|
90
|
+
readonly buttons: Button[];
|
|
91
|
+
set(status: KeypadState): Promise<void>;
|
|
92
|
+
readonly status: KeypadState;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// @public
|
|
96
|
+
export interface KeypadState extends DeviceState {
|
|
97
|
+
led: Address_2;
|
|
98
|
+
state: "On" | "Off";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// @public
|
|
102
|
+
export interface Occupancy extends Occupancy_2 {
|
|
103
|
+
readonly status: OccupancyState;
|
|
104
|
+
update(status: AreaStatus_2): void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// @public
|
|
108
|
+
export interface OccupancyState extends DeviceState {
|
|
109
|
+
state: "Occupied" | "Unoccupied";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// @public
|
|
113
|
+
export function pair(): Promise<void>;
|
|
114
|
+
|
|
115
|
+
// @public
|
|
116
|
+
export interface Remote extends Remote_2 {
|
|
117
|
+
// (undocumented)
|
|
118
|
+
readonly buttons: Button[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// @public
|
|
122
|
+
export interface Shade extends Shade_2 {
|
|
123
|
+
set(status: ShadeState): Promise<void>;
|
|
124
|
+
readonly status: ShadeState;
|
|
125
|
+
update(status: ZoneStatus_2): void;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// @public
|
|
129
|
+
export interface ShadeState extends DeviceState {
|
|
130
|
+
level: number;
|
|
131
|
+
state: "Open" | "Closed";
|
|
132
|
+
tilt?: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// @public
|
|
136
|
+
export interface Strip extends Strip_2 {
|
|
137
|
+
set(status: StripState): Promise<void>;
|
|
138
|
+
readonly status: StripState;
|
|
139
|
+
update(status: ZoneStatus_2): void;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// @public
|
|
143
|
+
export interface StripState extends DeviceState {
|
|
144
|
+
level: number;
|
|
145
|
+
luminance: number;
|
|
146
|
+
state: "On" | "Off";
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// @public
|
|
150
|
+
export interface Switch extends Switch_2 {
|
|
151
|
+
set(status: SwitchState): Promise<void>;
|
|
152
|
+
readonly status: SwitchState;
|
|
153
|
+
update(status: ZoneStatus_2): void;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// @public
|
|
157
|
+
export interface SwitchState extends DeviceState {
|
|
158
|
+
state: "On" | "Off";
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// @public
|
|
162
|
+
export interface Timeclock extends Timeclock_2 {
|
|
163
|
+
readonly status: TimeclockState;
|
|
164
|
+
update(status: TimeclockStatus_2): void;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// @public
|
|
168
|
+
export interface TimeclockState extends DeviceState {
|
|
169
|
+
state: "On" | "Off";
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// @public
|
|
173
|
+
export interface Unknown extends Unknown_2 {
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
```
|