node-alarm-dot-com 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -131
- package/dist/_models/DeviceStates.d.ts +68 -2
- package/dist/_models/IdentityResponse.d.ts +1 -1
- package/dist/_models/RequestOptions.d.ts +1 -1
- package/dist/_models/States.d.ts +3 -2
- package/dist/_models/States.js +1 -0
- package/dist/_models/SystemState.d.ts +2 -1
- package/dist/_models/SystemState.js +1 -0
- package/dist/index.js +18 -19
- package/package.json +9 -9
package/README.md
CHANGED
@@ -1,36 +1,33 @@
|
|
1
|
-
Node.js Alarm.com Interface
|
2
|
-
===========================
|
1
|
+
# Node.js Alarm.com Interface
|
3
2
|
|
4
3
|
Unofficial interface module written in Node.js to access and operate [Alarm.com](https://www.alarm.com/) security systems.
|
5
4
|
|
6
|
-
This interface works best with the fork: [https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com](https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com), based off of John Hurliman's FrontPoint
|
5
|
+
This interface works best with the fork: [https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com](https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com), based off of John Hurliman's FrontPoint\* plugin for Homebridge<small>[↗](https://github.com/jhurliman/homebridge-frontpoint)</small>. This variation <del>adds</del> changes the default login authentication <del>for</del> to Alarm.com. <del>with a switch to use the FrontPoint login authentication process if desired.</del>
|
7
6
|
|
8
|
-
<small
|
7
|
+
<small>\*FrontPoint is simply a rebranded service provider for Alarm.com.</small>
|
9
8
|
|
10
9
|
Originally intended for use with the fork: [https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com](https://github.com/node-alarm-dot-com/homebridge-node-alarm-dot-com), originally created by Bryan Bartow for his Alarm.com plugin for Homebridge<small>[↗](https://github.com/bryan-bartow/homebridge-alarm.com)</small>.
|
11
10
|
|
12
|
-
Supported Features
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
Usage
|
33
|
-
-----
|
11
|
+
## Supported Features
|
12
|
+
|
13
|
+
- Querying panels
|
14
|
+
- Arming
|
15
|
+
- Disarming
|
16
|
+
- Sensors
|
17
|
+
- Contact states
|
18
|
+
- <del>Occupancy states</del> (this does not work due to lag in the Alarm.com webAPI itself)
|
19
|
+
- Water Leak states
|
20
|
+
- Lights
|
21
|
+
- On/Off switch
|
22
|
+
- Dimmer switch
|
23
|
+
- Locks
|
24
|
+
- Lock/Unlock switch
|
25
|
+
- Thermostats
|
26
|
+
- State (Off, Heat, Cool, Auto)
|
27
|
+
- Desired Heat setpoint
|
28
|
+
- Desired Cool setpoint
|
29
|
+
|
30
|
+
## Usage
|
34
31
|
|
35
32
|
**Install:**
|
36
33
|
|
@@ -39,192 +36,200 @@ Usage
|
|
39
36
|
**Querying:**
|
40
37
|
|
41
38
|
```js
|
42
|
-
const nodeADC = require('node-alarm-dot-com')
|
39
|
+
const nodeADC = require('node-alarm-dot-com');
|
43
40
|
|
44
41
|
nodeADC
|
45
42
|
.login('your_username', 'your_password')
|
46
|
-
.then(authOpts => nodeADC.getCurrentState(authOpts.systems[0], authOpts))
|
47
|
-
.then(res => {
|
48
|
-
console.log('Security Systems:', res.partitions)
|
49
|
-
console.log('Sensors:', res.sensors)
|
43
|
+
.then((authOpts) => nodeADC.getCurrentState(authOpts.systems[0], authOpts))
|
44
|
+
.then((res) => {
|
45
|
+
console.log('Security Systems:', res.partitions);
|
46
|
+
console.log('Sensors:', res.sensors);
|
50
47
|
})
|
51
|
-
.catch(err => console.error(err))
|
48
|
+
.catch((err) => console.error(err));
|
52
49
|
```
|
53
50
|
|
54
51
|
**Arming:**
|
55
52
|
|
56
53
|
```js
|
57
|
-
const nodeADC = require('node-alarm-dot-com')
|
54
|
+
const nodeADC = require('node-alarm-dot-com');
|
58
55
|
|
59
56
|
nodeADC
|
60
57
|
.login('your_username', 'your_password')
|
61
|
-
.then(authOpts => {
|
62
|
-
return nodeADC
|
63
|
-
|
64
|
-
.then(res => {
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
})
|
69
|
-
})
|
58
|
+
.then((authOpts) => {
|
59
|
+
return nodeADC.getCurrentState(authOpts.systems[0], authOpts).then((res) => {
|
60
|
+
// This will take 20-30 seconds
|
61
|
+
nodeADC.armStay(res.partitions[0].id, authOpts).then((res) => {
|
62
|
+
console.log(res);
|
63
|
+
});
|
64
|
+
});
|
70
65
|
})
|
71
|
-
.catch(err => console.error(err))
|
66
|
+
.catch((err) => console.error(err));
|
72
67
|
```
|
73
68
|
|
74
|
-
Documentation
|
75
|
-
-----
|
69
|
+
## Documentation
|
76
70
|
|
77
71
|
<a name="module_nodeADC"></a>
|
78
72
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
73
|
+
- [nodeADC](#module_nodeADC)
|
74
|
+
- [~login(username, password)](#module_nodeADCmodule_nodeADC..login) ⇒ <code>Promise</code>
|
75
|
+
- [~getCurrentState(systemID, authOpts)](#module_nodeADC..getCurrentState) ⇒ <code>Promise</code>
|
76
|
+
- [~getPartition(partitionID, authOpts)](#module_nodeADC..getPartition) ⇒ <code>Promise</code>
|
77
|
+
- [~getSensors(sensorIDs, authOpts)](#module_nodeADC..getSensors) ⇒ <code>Promise</code>
|
78
|
+
- [~getLights(lightIDs, authOpts)](#module_nodeADC..getLights) ⇒ <code>Promise</code>
|
79
|
+
- [~turnOnLight(lightID, brightness, authOpts)](#module_nodeADC..turnOnLight) ⇒ <code>Promise</code>
|
80
|
+
- [~turnOffLight(lightID, brightness, authOpts)](#module_nodeADC..turnOffLight) ⇒ <code>Promise</code>
|
81
|
+
- [~getLocks(lockIDs, authOpts)](#module_nodeADC..getLocks) ⇒ <code>Promise</code>
|
82
|
+
- [~setLockSecure(lockID, authOpts)](#module_nodeADC..setLockSecure) ⇒ <code>Promise</code>
|
83
|
+
- [~setLockUnsecure(lockID, authOpts)](#module_nodeADC..setLockUnsecure) ⇒ <code>Promise</code>
|
84
|
+
- [~setThermostatState(thermostatID, newState, authOpts)](#module_nodeADC..setThermostatState) ⇒ <code>Promise</code>
|
85
|
+
- [~setThermostatTargetHeatTemperature(thermostatID, newTemp, authOpts)](#module_nodeADC..setThermostatTargetHeatTemperature) ⇒ <code>Promise</code>
|
86
|
+
- [~setThermostatTargetCoolTemperature(thermostatID, newTemp, authOpts)](#module_nodeADC..setThermostatTargetCoolTemperature) ⇒ <code>Promise</code>
|
87
|
+
- [~armStay(partitionID, authOpts, opts)](#module_nodeADC..armStay) ⇒ <code>Promise</code>
|
88
|
+
- [~armAway(partitionID, authOpts, opts)](#module_nodeADC..armAway) ⇒ <code>Promise</code>
|
89
|
+
- [~disarm(partitionID, authOpts)](#module_nodeADC..disarm) ⇒ <code>Promise</code>
|
96
90
|
|
97
91
|
<a name="module_nodeADC..login"></a>
|
98
92
|
|
99
93
|
### nodeADC~login(username, password) ⇒ <code>Promise</code>
|
94
|
+
|
100
95
|
Authenticate with alarm.com using the mobile webpage login form (loads faster than the desktop webpage login form). Returns an authentication object that can be passed to other methods.
|
101
96
|
|
102
97
|
**Kind**: inner method of [<code>module_nodeADC</code>](#module_nodeADC)
|
103
98
|
|
104
|
-
| Param
|
105
|
-
|
|
99
|
+
| Param | Type | Description |
|
100
|
+
| -------- | ------------------- | -------------------- |
|
106
101
|
| username | <code>string</code> | FrontPoint username. |
|
107
102
|
| password | <code>string</code> | FrontPoint password. |
|
108
103
|
|
109
104
|
<a name="module_nodeADC..getCurrentState"></a>
|
110
105
|
|
111
106
|
### nodeADC~getCurrentState(systemID, authOpts) ⇒ <code>Promise</code>
|
107
|
+
|
112
108
|
Retrieve information about the current state of a security system including attributes, partitions, sensors, and relationships.
|
113
109
|
|
114
110
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
115
111
|
|
116
|
-
| Param
|
117
|
-
|
|
118
|
-
| systemID | <code>string</code> | ID of the FrontPoint system to query. The
|
119
|
-
| authOpts | <code>Object</code> | Authentication object returned from the `login` method.
|
112
|
+
| Param | Type | Description |
|
113
|
+
| -------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
114
|
+
| systemID | <code>string</code> | ID of the FrontPoint system to query. The Authentication object returned from the `login` method contains a `systems` property which is an array of system IDs. |
|
115
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
120
116
|
|
121
117
|
<a name="module_nodeADC..getPartition"></a>
|
122
118
|
|
123
119
|
### nodeADC~getPartition(partitionID, authOpts) ⇒ <code>Promise</code>
|
120
|
+
|
124
121
|
Get information for a single security system partition.
|
125
122
|
|
126
123
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
127
124
|
|
128
|
-
| Param
|
129
|
-
|
|
130
|
-
| partitionID | <code>string</code> | Partition ID to retrieve
|
131
|
-
| authOpts
|
125
|
+
| Param | Type | Description |
|
126
|
+
| ----------- | ------------------- | ------------------------------------------------------- |
|
127
|
+
| partitionID | <code>string</code> | Partition ID to retrieve |
|
128
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
132
129
|
|
133
130
|
<a name="module_nodeADC..getSensors"></a>
|
134
131
|
|
135
132
|
### nodeADC~getSensors(sensorIDs, authOpts) ⇒ <code>Promise</code>
|
133
|
+
|
136
134
|
Get information for one or more sensors.
|
137
135
|
|
138
136
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
139
137
|
|
140
|
-
| Param
|
141
|
-
|
|
142
|
-
| sensorIDs | <code>string</code> \| <code>Array.<string></code> | Array of sensor ID strings.
|
143
|
-
| authOpts
|
138
|
+
| Param | Type | Description |
|
139
|
+
| --------- | -------------------------------------------------------- | ------------------------------------------------------- |
|
140
|
+
| sensorIDs | <code>string</code> \| <code>Array.<string></code> | Array of sensor ID strings. |
|
141
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
144
142
|
|
145
143
|
<a name="module_nodeADC..getLights"></a>
|
146
144
|
|
147
145
|
### nodeADC~getLights(lightIDs, authOpts) ⇒ <code>Promise</code>
|
146
|
+
|
148
147
|
Get information for one or more lights.
|
149
148
|
|
150
149
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
151
150
|
|
152
|
-
| Param
|
153
|
-
|
|
154
|
-
| lightIDs | <code>string</code> \| <code>Array.<string></code> | Array of light ID strings.
|
155
|
-
| authOpts | <code>Object</code>
|
151
|
+
| Param | Type | Description |
|
152
|
+
| -------- | -------------------------------------------------------- | ------------------------------------------------------- |
|
153
|
+
| lightIDs | <code>string</code> \| <code>Array.<string></code> | Array of light ID strings. |
|
154
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
156
155
|
|
157
156
|
<a name="module_nodeADC..turnOnLight"></a>
|
158
157
|
|
159
158
|
### nodeADC~turnOnLight(lightID, brightness, authOpts) ⇒ <code>Promise</code>
|
159
|
+
|
160
160
|
Sets a light to ON and adjusts brightness level (1-100) of dimmable lights.
|
161
161
|
|
162
162
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
163
163
|
|
164
|
-
| Param
|
165
|
-
|
|
166
|
-
| lightID
|
167
|
-
| brightness | <code>number</code> | An integer, 1-100, indicating brightness.
|
168
|
-
| authOpts
|
164
|
+
| Param | Type | Description |
|
165
|
+
| ---------- | ------------------- | ------------------------------------------------------- |
|
166
|
+
| lightID | <code>string</code> | Light ID string. |
|
167
|
+
| brightness | <code>number</code> | An integer, 1-100, indicating brightness. |
|
168
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
169
169
|
|
170
170
|
<a name="module_nodeADC..turnOffLight"></a>
|
171
171
|
|
172
172
|
### nodeADC~turnOffLight(lightID, brightness, authOpts) ⇒ <code>Promise</code>
|
173
|
+
|
173
174
|
Sets a light to OFF. The brightness level is ignored.
|
174
175
|
|
175
176
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
176
177
|
|
177
|
-
| Param
|
178
|
-
|
|
179
|
-
| lightID
|
178
|
+
| Param | Type | Description |
|
179
|
+
| ---------- | ------------------- | ------------------------------------------------------------- |
|
180
|
+
| lightID | <code>string</code> | Light ID string. |
|
180
181
|
| brightness | <code>number</code> | <del>An integer, 1-100, indicating brightness.</del> Ignored. |
|
181
|
-
| authOpts
|
182
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
182
183
|
|
183
184
|
<a name="module_nodeADC..getLocks"></a>
|
184
185
|
|
185
186
|
### nodeADC~getLocks(lightIDs, authOpts) ⇒ <code>Promise</code>
|
187
|
+
|
186
188
|
Get information for one or more locks.
|
187
189
|
|
188
190
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
189
191
|
|
190
|
-
| Param
|
191
|
-
|
|
192
|
-
| lockIDs
|
193
|
-
| authOpts | <code>Object</code>
|
192
|
+
| Param | Type | Description |
|
193
|
+
| -------- | -------------------------------------------------------- | ------------------------------------------------------- |
|
194
|
+
| lockIDs | <code>string</code> \| <code>Array.<string></code> | Array of lock ID strings. |
|
195
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
194
196
|
|
195
|
-
<a name="module_nodeADC..
|
197
|
+
<a name="module_nodeADC..setLockSecure"></a>
|
198
|
+
|
199
|
+
### nodeADC~setLockSecure(lockID, authOpts) ⇒ <code>Promise</code>
|
196
200
|
|
197
|
-
### nodeADC~secureLock(lockID, authOpts) ⇒ <code>Promise</code>
|
198
201
|
Sets a lock to "locked" (SECURED).
|
199
202
|
|
200
203
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
201
204
|
|
202
|
-
| Param
|
203
|
-
|
|
204
|
-
| lockID
|
205
|
+
| Param | Type | Description |
|
206
|
+
| -------- | ------------------- | ------------------------------------------------------- |
|
207
|
+
| lockID | <code>string</code> | Lock ID string. |
|
205
208
|
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
206
209
|
|
207
|
-
<a name="module_nodeADC..
|
210
|
+
<a name="module_nodeADC..setLockUnsecure"></a>
|
211
|
+
|
212
|
+
### nodeADC~setLockUnsecure(lockID, authOpts) ⇒ <code>Promise</code>
|
208
213
|
|
209
|
-
### nodeADC~unsecureLock(lockID, authOpts) ⇒ <code>Promise</code>
|
210
214
|
Sets a lock to "unlocked" (UNSECURED).
|
211
215
|
|
212
216
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
213
217
|
|
214
|
-
| Param
|
215
|
-
|
|
216
|
-
| lockID
|
218
|
+
| Param | Type | Description |
|
219
|
+
| -------- | ------------------- | ------------------------------------------------------- |
|
220
|
+
| lockID | <code>string</code> | Lock ID string. |
|
217
221
|
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
218
222
|
|
219
223
|
<a name="module_nodeADC..setThermostatState"></a>
|
220
224
|
|
221
225
|
### nodeADC~setThermostatState(thermostatID, newState, authOpts) ⇒ <code>Promise</code>
|
226
|
+
|
222
227
|
Update Thermostat State (see `THERMOSTAT_STATES`)
|
223
228
|
|
224
229
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
225
230
|
|
226
231
|
| Param | Type | Description |
|
227
|
-
|
232
|
+
| ------------ | ------------------------------ | ----------------------------------------------------------- |
|
228
233
|
| thermostatID | <code>string</code> | Thermostat ID string. |
|
229
234
|
| newState | <code>THERMOSTAT_STATES</code> | Desired state, `THERMOSTAT_STATES.OFF`/`HEAT`/`COOL`/`AUTO` |
|
230
235
|
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
@@ -232,12 +237,13 @@ Update Thermostat State (see `THERMOSTAT_STATES`)
|
|
232
237
|
<a name="module_nodeADC..setThermostatTargetHeatTemperature"></a>
|
233
238
|
|
234
239
|
### nodeADC~setThermostatTargetHeatTemperature(thermostatID, newTemp, authOpts) ⇒ <code>Promise</code>
|
240
|
+
|
235
241
|
Set desired Heat setpoint temperature for Thermostat
|
236
242
|
|
237
243
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
238
244
|
|
239
245
|
| Param | Type | Description |
|
240
|
-
|
246
|
+
| ------------ | ------------------- | ------------------------------------------------------- |
|
241
247
|
| thermostatID | <code>string</code> | Thermostat ID string. |
|
242
248
|
| newTemp | <code>number</code> | Desired temperature |
|
243
249
|
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
@@ -245,12 +251,13 @@ Set desired Heat setpoint temperature for Thermostat
|
|
245
251
|
<a name="module_nodeADC..setThermostatTargetCoolTemperature"></a>
|
246
252
|
|
247
253
|
### nodeADC~setThermostatTargetCoolTemperature(thermostatID, newTemp, authOpts) ⇒ <code>Promise</code>
|
254
|
+
|
248
255
|
Set desired Cool setpoint temperature for Thermostat
|
249
256
|
|
250
257
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
251
258
|
|
252
259
|
| Param | Type | Description |
|
253
|
-
|
260
|
+
| ------------ | ------------------- | ------------------------------------------------------- |
|
254
261
|
| thermostatID | <code>string</code> | Thermostat ID string. |
|
255
262
|
| newTemp | <code>number</code> | Desired temperature |
|
256
263
|
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
@@ -258,56 +265,55 @@ Set desired Cool setpoint temperature for Thermostat
|
|
258
265
|
<a name="module_nodeADC..armStay"></a>
|
259
266
|
|
260
267
|
### nodeADC~armStay(partitionID, authOpts, opts) ⇒ <code>Promise</code>
|
268
|
+
|
261
269
|
Arm a security system panel in "stay" mode. NOTE: This call may take 20-30 seconds to complete.
|
262
270
|
|
263
271
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
264
272
|
|
265
|
-
| Param
|
266
|
-
|
|
267
|
-
| partitionID
|
268
|
-
| authOpts
|
269
|
-
| opts
|
270
|
-
| opts.noEntryDelay | <code>boolean</code> | Disable the 30-second entry delay.
|
271
|
-
| opts.silentArming | <code>boolean</code> | Disable audible beeps and double the exit delay.
|
273
|
+
| Param | Type | Description |
|
274
|
+
| ----------------- | -------------------- | ------------------------------------------------------- |
|
275
|
+
| partitionID | <code>string</code> | Partition ID to arm. |
|
276
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
277
|
+
| opts | <code>Object</code> | Optional arguments for arming the system. |
|
278
|
+
| opts.noEntryDelay | <code>boolean</code> | Disable the 30-second entry delay. |
|
279
|
+
| opts.silentArming | <code>boolean</code> | Disable audible beeps and double the exit delay. |
|
272
280
|
|
273
281
|
<a name="module_nodeADC..armAway"></a>
|
274
282
|
|
275
283
|
### nodeADC~armAway(partitionID, authOpts, opts) ⇒ <code>Promise</code>
|
284
|
+
|
276
285
|
Arm a security system panel in "away" mode. NOTE: This call may take 20-30 seconds to complete.
|
277
286
|
|
278
287
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
279
288
|
|
280
|
-
| Param
|
281
|
-
|
|
282
|
-
| partitionID
|
283
|
-
| authOpts
|
284
|
-
| opts
|
285
|
-
| opts.noEntryDelay | <code>boolean</code> | Disable the 30-second entry delay.
|
286
|
-
| opts.silentArming | <code>boolean</code> | Disable audible beeps and double the exit delay.
|
289
|
+
| Param | Type | Description |
|
290
|
+
| ----------------- | -------------------- | ------------------------------------------------------- |
|
291
|
+
| partitionID | <code>string</code> | Partition ID to arm. |
|
292
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
293
|
+
| opts | <code>Object</code> | Optional arguments for arming the system. |
|
294
|
+
| opts.noEntryDelay | <code>boolean</code> | Disable the 30-second entry delay. |
|
295
|
+
| opts.silentArming | <code>boolean</code> | Disable audible beeps and double the exit delay. |
|
287
296
|
|
288
297
|
<a name="module_nodeADC..disarm"></a>
|
289
298
|
|
290
299
|
### nodeADC~disarm(partitionID, authOpts) ⇒ <code>Promise</code>
|
300
|
+
|
291
301
|
Disarm a security system panel.
|
292
302
|
|
293
303
|
**Kind**: inner method of [<code>nodeADC</code>](#module_nodeADC)
|
294
304
|
|
295
|
-
| Param
|
296
|
-
|
|
297
|
-
| partitionID | <code>string</code> | Partition ID to disarm.
|
298
|
-
| authOpts
|
305
|
+
| Param | Type | Description |
|
306
|
+
| ----------- | ------------------- | ------------------------------------------------------- |
|
307
|
+
| partitionID | <code>string</code> | Partition ID to disarm. |
|
308
|
+
| authOpts | <code>Object</code> | Authentication object returned from the `login` method. |
|
309
|
+
|
310
|
+
## Notes
|
299
311
|
|
300
|
-
Notes
|
301
|
-
-----
|
302
312
|
In efforts to maintain this project as a native Alarm.com implementation, authentication and reference to FrontPoint have been removed altogether within the code as of versions 1.6.0. This allows for the codebase to be cleaner without having to solve everyone else's extraneous Alarm.com Verified-Partner setups, encouraging separate forks and augmentation for those unique scenarios.
|
303
313
|
|
304
|
-
Acknowledgements
|
305
|
-
----------------
|
314
|
+
## Acknowledgements
|
306
315
|
|
307
316
|
- **Original Code:** [https://github.com/jhurliman/node-frontpoint](https://github.com/jhurliman/node-frontpoint)
|
308
317
|
- **Alarm.com Login Process:** [Schwark Satyavolu](https://github.com/schwark), original author of [pyalarmcom](https://github.com/schwark/pyalarmcom)
|
309
318
|
- **Alarm.com Mobile Login Tips:** [Bryan Bartow](https://github.com/bryan-bartow), original author of [homebridge-alarm.com](https://github.com/bryan-bartow/homebridge-alarm.com)
|
310
319
|
- **Lights/Locks Implementation:** [Chase Lau](https://github.com/chase9)
|
311
|
-
|
312
|
-
|
313
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Relationship } from './IdentityResponse';
|
2
|
-
import { AutomationType, RelationshipType } from './SystemState';
|
3
|
-
import { GARAGE_STATES, LIGHT_STATES, LOCK_STATES, SENSOR_STATES, SYSTEM_STATES, THERMOSTAT_STATES } from './States';
|
4
2
|
import { SensorType } from './SensorType';
|
3
|
+
import { GARAGE_STATES, LIGHT_STATES, LOCK_STATES, SENSOR_STATES, SYSTEM_STATES, THERMOSTAT_STATES } from './States';
|
4
|
+
import { AutomationType, RelationshipType } from './SystemState';
|
5
5
|
export interface ApiLightState extends ApiDeviceState {
|
6
6
|
data: {
|
7
7
|
id: string;
|
@@ -1052,6 +1052,72 @@ export interface ThermostatState extends DeviceState {
|
|
1052
1052
|
};
|
1053
1053
|
};
|
1054
1054
|
}
|
1055
|
+
export interface ApiAccessControlState extends ApiDeviceState {
|
1056
|
+
data: {
|
1057
|
+
id: string;
|
1058
|
+
type: RelationshipType.AccessControl;
|
1059
|
+
attributes: {
|
1060
|
+
managedDeviceType: number;
|
1061
|
+
state: LOCK_STATES;
|
1062
|
+
desiredState: LOCK_STATES;
|
1063
|
+
canBuzz: boolean;
|
1064
|
+
canLockUnlock: boolean;
|
1065
|
+
readerAntiPassbackEnabled: boolean;
|
1066
|
+
apbDelay: number;
|
1067
|
+
twoPersonAccessEnabled: boolean;
|
1068
|
+
hasMiwaLock: boolean;
|
1069
|
+
twoPersonAccessSupported: boolean;
|
1070
|
+
hasState: boolean;
|
1071
|
+
canBeRenamed: boolean;
|
1072
|
+
canBeDeleted: boolean;
|
1073
|
+
canAccessWebSettings: boolean;
|
1074
|
+
canAccessAppSettings: boolean;
|
1075
|
+
webSettings: number;
|
1076
|
+
canAccessTroubleshootingWizard: boolean;
|
1077
|
+
troubleshootingWizard: null;
|
1078
|
+
addDeviceResource: number;
|
1079
|
+
canBeAssociatedToVideoDevice: boolean;
|
1080
|
+
associatedCameraDeviceIds: {};
|
1081
|
+
macAddress: string;
|
1082
|
+
manufacturer: string;
|
1083
|
+
isAssignedToCareReceiver: boolean;
|
1084
|
+
isOAuth: boolean;
|
1085
|
+
isZWave: boolean;
|
1086
|
+
supportsCommandClassBasic: boolean;
|
1087
|
+
isMalfunctioning: boolean;
|
1088
|
+
isZWaveWakeupNode: boolean;
|
1089
|
+
unitSupportsRemovingWakeupNode: boolean;
|
1090
|
+
primaryAssociatedDeviceIds: null;
|
1091
|
+
canBeSaved: boolean;
|
1092
|
+
canChangeDescription: boolean;
|
1093
|
+
description: string;
|
1094
|
+
deviceModelId: number;
|
1095
|
+
canConfirmStateChange: boolean;
|
1096
|
+
canReceiveCommands: boolean;
|
1097
|
+
remoteCommandsEnabled: boolean;
|
1098
|
+
hasPermissionToChangeState: boolean;
|
1099
|
+
deviceIcon: {
|
1100
|
+
"icon": number;
|
1101
|
+
};
|
1102
|
+
batteryLevelNull: null;
|
1103
|
+
batteryLevelClassification: null;
|
1104
|
+
};
|
1105
|
+
relationships: {
|
1106
|
+
system: {
|
1107
|
+
data: {
|
1108
|
+
id: string;
|
1109
|
+
type: RelationshipType.System;
|
1110
|
+
};
|
1111
|
+
};
|
1112
|
+
stateInfo: {
|
1113
|
+
data: {
|
1114
|
+
id: string;
|
1115
|
+
type: RelationshipType.State;
|
1116
|
+
};
|
1117
|
+
};
|
1118
|
+
};
|
1119
|
+
};
|
1120
|
+
}
|
1055
1121
|
/**
|
1056
1122
|
* Base interface for retrieving device state from Alarm.com's API
|
1057
1123
|
* All devices retrieved contain these properties.
|
@@ -123,5 +123,5 @@ export interface IdentityData {
|
|
123
123
|
}
|
124
124
|
export interface Relationship {
|
125
125
|
id: string;
|
126
|
-
type: 'devices/partition' | 'devices/lock' | 'video/camera' | 'devices/garage-door' | 'automation/scene' | 'devices/sensor' | 'devices/light' | 'devices/thermostat' | 'geolocation/geo-device' | 'geolocation/fence' | 'systems/configuration' | 'navigation/route-item' | 'dealers/dealer' | 'ui/color' | 'profile/profile' | 'accountInformation/account-information';
|
126
|
+
type: 'devices/partition' | 'devices/lock' | 'video/camera' | 'devices/garage-door' | 'automation/scene' | 'devices/sensor' | 'devices/light' | 'devices/thermostat' | 'geolocation/geo-device' | 'geolocation/fence' | 'systems/configuration' | 'navigation/route-item' | 'devices/access-control-access-point-device' | 'dealers/dealer' | 'ui/color' | 'profile/profile' | 'accountInformation/account-information';
|
127
127
|
}
|
package/dist/_models/States.d.ts
CHANGED
@@ -48,7 +48,7 @@ export declare enum LOCK_STATES {
|
|
48
48
|
* @enum {number}
|
49
49
|
*/
|
50
50
|
export declare enum GARAGE_STATES {
|
51
|
-
OPEN = 1
|
51
|
+
OPEN = 1,//double check
|
52
52
|
CLOSED = 2
|
53
53
|
}
|
54
54
|
/***
|
@@ -78,5 +78,6 @@ export declare enum REL_TYPES {
|
|
78
78
|
THERMOSTAT = "devices/thermostat",
|
79
79
|
GEO_DEVICE = "geolocation/geo-device",
|
80
80
|
GEO_FENCE = "geolocation/fence",
|
81
|
-
SCENE = "automation/scene"
|
81
|
+
SCENE = "automation/scene",
|
82
|
+
ACCESS_CONTROL = "devices/access-control-access-point-device"
|
82
83
|
}
|
package/dist/_models/States.js
CHANGED
@@ -91,4 +91,5 @@ var REL_TYPES;
|
|
91
91
|
REL_TYPES["GEO_DEVICE"] = "geolocation/geo-device";
|
92
92
|
REL_TYPES["GEO_FENCE"] = "geolocation/fence";
|
93
93
|
REL_TYPES["SCENE"] = "automation/scene";
|
94
|
+
REL_TYPES["ACCESS_CONTROL"] = "devices/access-control-access-point-device";
|
94
95
|
})(REL_TYPES || (exports.REL_TYPES = REL_TYPES = {}));
|
@@ -203,7 +203,8 @@ export declare enum RelationshipType {
|
|
203
203
|
GeoFence = "geolocation/fence",
|
204
204
|
SystemConfig = "systems/configuration",
|
205
205
|
System = "systems/system",
|
206
|
-
State = "devices/state-info"
|
206
|
+
State = "devices/state-info",
|
207
|
+
AccessControl = "devices/access-control-access-point-device"
|
207
208
|
}
|
208
209
|
export declare enum AutomationType {
|
209
210
|
PeakProtect = "automation/peak-protect",
|
@@ -16,6 +16,7 @@ var RelationshipType;
|
|
16
16
|
RelationshipType["SystemConfig"] = "systems/configuration";
|
17
17
|
RelationshipType["System"] = "systems/system";
|
18
18
|
RelationshipType["State"] = "devices/state-info";
|
19
|
+
RelationshipType["AccessControl"] = "devices/access-control-access-point-device";
|
19
20
|
})(RelationshipType || (exports.RelationshipType = RelationshipType = {}));
|
20
21
|
var AutomationType;
|
21
22
|
(function (AutomationType) {
|
package/dist/index.js
CHANGED
@@ -20,7 +20,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
20
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
21
21
|
};
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
23
|
-
exports.
|
23
|
+
exports.login = login;
|
24
|
+
exports.getIdentitiesState = getIdentitiesState;
|
25
|
+
exports.getCurrentState = getCurrentState;
|
26
|
+
exports.getComponents = getComponents;
|
27
|
+
exports.armStay = armStay;
|
28
|
+
exports.armAway = armAway;
|
29
|
+
exports.disarm = disarm;
|
30
|
+
exports.setLightOn = setLightOn;
|
31
|
+
exports.setLightOff = setLightOff;
|
32
|
+
exports.setLockSecure = setLockSecure;
|
33
|
+
exports.setLockUnsecure = setLockUnsecure;
|
34
|
+
exports.closeGarage = closeGarage;
|
35
|
+
exports.openGarage = openGarage;
|
36
|
+
exports.setThermostatState = setThermostatState;
|
37
|
+
exports.setThermostatTargetHeatTemperature = setThermostatTargetHeatTemperature;
|
38
|
+
exports.setThermostatTargetCoolTemperature = setThermostatTargetCoolTemperature;
|
39
|
+
exports.authenticatedGet = authenticatedGet;
|
40
|
+
exports.authenticatedPost = authenticatedPost;
|
24
41
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
25
42
|
__exportStar(require("./_models/AuthOpts"), exports);
|
26
43
|
__exportStar(require("./_models/DeviceStates"), exports);
|
@@ -125,7 +142,6 @@ async function login(username, password, existingMfaToken) {
|
|
125
142
|
identities: identities
|
126
143
|
};
|
127
144
|
}
|
128
|
-
exports.login = login;
|
129
145
|
/**
|
130
146
|
* This function returns the alarm.com system identity for the currently logged in system.
|
131
147
|
* The information returned is useful for finding current systems and global config.
|
@@ -150,7 +166,6 @@ async function getIdentitiesState(loginCookies, ajaxKey) {
|
|
150
166
|
throw new Error(`GET ${IDENTITIES_URL} failed: ${err.message || err}`);
|
151
167
|
});
|
152
168
|
}
|
153
|
-
exports.getIdentitiesState = getIdentitiesState;
|
154
169
|
/**
|
155
170
|
* Retrieve information about the current state of a security system including
|
156
171
|
* attributes, partitions, accessory components and relationships.
|
@@ -204,7 +219,6 @@ async function getCurrentState(systemID, authOpts) {
|
|
204
219
|
relationships: rels
|
205
220
|
};
|
206
221
|
}
|
207
|
-
exports.getCurrentState = getCurrentState;
|
208
222
|
/**
|
209
223
|
* Get information about groups of components e.g., sensors, lights, locks, garages, etc.
|
210
224
|
*
|
@@ -233,7 +247,6 @@ async function getComponents(url, componentIDs, authOpts) {
|
|
233
247
|
}
|
234
248
|
return await combineAPIDeviceAPICalls(requests);
|
235
249
|
}
|
236
|
-
exports.getComponents = getComponents;
|
237
250
|
async function combineAPIDeviceAPICalls(apiCalls) {
|
238
251
|
const apiStateCalls = await Promise.all(apiCalls);
|
239
252
|
const stateToReturn = {
|
@@ -300,7 +313,6 @@ function partitionAction(partitionID, action, authOpts, opts) {
|
|
300
313
|
function armStay(partitionID, authOpts, opts) {
|
301
314
|
return partitionAction(partitionID, 'armStay', authOpts, opts);
|
302
315
|
}
|
303
|
-
exports.armStay = armStay;
|
304
316
|
/**
|
305
317
|
* Convenience Method:
|
306
318
|
* Arm a security system panel in "away" mode. NOTE: This call generally takes
|
@@ -317,7 +329,6 @@ exports.armStay = armStay;
|
|
317
329
|
function armAway(partitionID, authOpts, opts) {
|
318
330
|
return partitionAction(partitionID, 'armAway', authOpts, opts);
|
319
331
|
}
|
320
|
-
exports.armAway = armAway;
|
321
332
|
/**
|
322
333
|
* Convenience Method:
|
323
334
|
* Disarm a security system panel. NOTE: This call generally takes 20-30 seconds
|
@@ -330,7 +341,6 @@ exports.armAway = armAway;
|
|
330
341
|
function disarm(partitionID, authOpts) {
|
331
342
|
return partitionAction(partitionID, 'disarm', authOpts);
|
332
343
|
}
|
333
|
-
exports.disarm = disarm;
|
334
344
|
// Sensor methods //////////////////////////////////////////////////////////////
|
335
345
|
// Sensors don't do anything, but they report state when we get information
|
336
346
|
// about any of the components, sensors included.
|
@@ -387,7 +397,6 @@ function setLightOn(lightID, authOpts, brightness, isDimmer) {
|
|
387
397
|
return lightAction(lightID, authOpts, 'turnOn');
|
388
398
|
}
|
389
399
|
}
|
390
|
-
exports.setLightOn = setLightOn;
|
391
400
|
/**
|
392
401
|
* Convenience Method:
|
393
402
|
* Sets a light to OFF. The brightness level is ignored.
|
@@ -406,7 +415,6 @@ function setLightOff(lightID, authOpts, brightness, isDimmer) {
|
|
406
415
|
return lightAction(lightID, authOpts, 'turnOff');
|
407
416
|
}
|
408
417
|
}
|
409
|
-
exports.setLightOff = setLightOff;
|
410
418
|
// Lock methods ////////////////////////////////////////////////////////////////
|
411
419
|
/**
|
412
420
|
* Perform lock actions, e.g., lock, unlock.
|
@@ -435,7 +443,6 @@ function lockAction(lockID, authOpts, action) {
|
|
435
443
|
function setLockSecure(lockID, authOpts) {
|
436
444
|
return lockAction(lockID, authOpts, 'lock');
|
437
445
|
}
|
438
|
-
exports.setLockSecure = setLockSecure;
|
439
446
|
/**
|
440
447
|
* Convenience Method:
|
441
448
|
* Sets a lock to "unlocked" (UNSECURED).
|
@@ -447,7 +454,6 @@ exports.setLockSecure = setLockSecure;
|
|
447
454
|
function setLockUnsecure(lockID, authOpts) {
|
448
455
|
return lockAction(lockID, authOpts, 'unlock');
|
449
456
|
}
|
450
|
-
exports.setLockUnsecure = setLockUnsecure;
|
451
457
|
// Garage methods ////////////////////////////////////////////////////////////////
|
452
458
|
/**
|
453
459
|
* Get information for one or more garages.
|
@@ -483,7 +489,6 @@ function closeGarage(garageID, authOpts) {
|
|
483
489
|
});
|
484
490
|
return authenticatedPost(url, postOpts);
|
485
491
|
}
|
486
|
-
exports.closeGarage = closeGarage;
|
487
492
|
/**
|
488
493
|
* Sets a garage to OPEN.
|
489
494
|
*
|
@@ -501,7 +506,6 @@ function openGarage(garageID, authOpts) {
|
|
501
506
|
});
|
502
507
|
return authenticatedPost(url, postOpts);
|
503
508
|
}
|
504
|
-
exports.openGarage = openGarage;
|
505
509
|
// Thermostat methods ////////////////////////////////////////////////////////////////
|
506
510
|
/**
|
507
511
|
* Update thermostat state
|
@@ -522,7 +526,6 @@ function setThermostatState(thermostatID, newState, authOpts) {
|
|
522
526
|
});
|
523
527
|
return authenticatedPost(url, postOpts);
|
524
528
|
}
|
525
|
-
exports.setThermostatState = setThermostatState;
|
526
529
|
/**
|
527
530
|
* Sets a thermostat target heat temperature.
|
528
531
|
*
|
@@ -542,7 +545,6 @@ function setThermostatTargetHeatTemperature(thermostatID, newTemp, authOpts) {
|
|
542
545
|
});
|
543
546
|
return authenticatedPost(url, postOpts);
|
544
547
|
}
|
545
|
-
exports.setThermostatTargetHeatTemperature = setThermostatTargetHeatTemperature;
|
546
548
|
/**
|
547
549
|
* Sets a thermostat target cool temperature.
|
548
550
|
*
|
@@ -562,7 +564,6 @@ function setThermostatTargetCoolTemperature(thermostatID, newTemp, authOpts) {
|
|
562
564
|
});
|
563
565
|
return authenticatedPost(url, postOpts);
|
564
566
|
}
|
565
|
-
exports.setThermostatTargetCoolTemperature = setThermostatTargetCoolTemperature;
|
566
567
|
// Helper methods //////////////////////////////////////////////////////////////
|
567
568
|
function getValue(data, path) {
|
568
569
|
if (typeof path === 'string') {
|
@@ -584,7 +585,6 @@ async function authenticatedGet(url, opts) {
|
|
584
585
|
const res = await get(url, opts);
|
585
586
|
return res.body;
|
586
587
|
}
|
587
|
-
exports.authenticatedGet = authenticatedGet;
|
588
588
|
async function authenticatedPost(url, opts) {
|
589
589
|
opts = opts || {};
|
590
590
|
opts.headers = opts.headers || {};
|
@@ -597,7 +597,6 @@ async function authenticatedPost(url, opts) {
|
|
597
597
|
const res = await post(url, opts);
|
598
598
|
return res.body;
|
599
599
|
}
|
600
|
-
exports.authenticatedPost = authenticatedPost;
|
601
600
|
async function get(url, opts) {
|
602
601
|
opts = opts || {};
|
603
602
|
let status;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "node-alarm-dot-com",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.1",
|
4
4
|
"description": "An interface module written in node.js to arm and disarm Alarm.com security systems.",
|
5
5
|
"author": {
|
6
6
|
"name": "Chase Lau",
|
@@ -44,21 +44,21 @@
|
|
44
44
|
"test": "echo \"Error: no test specified\" && exit 1"
|
45
45
|
},
|
46
46
|
"engines": {
|
47
|
-
"node": ">=
|
47
|
+
"node": ">=18.0.0"
|
48
48
|
},
|
49
49
|
"dependencies": {
|
50
|
-
"@types/node": "^
|
51
|
-
"@types/node-fetch": "^
|
52
|
-
"node-fetch": "^2.
|
53
|
-
"semver": "^7.
|
50
|
+
"@types/node": "^22.5.5",
|
51
|
+
"@types/node-fetch": "^2.6.11",
|
52
|
+
"node-fetch": "^2.7.0",
|
53
|
+
"semver": "^7.6.3"
|
54
54
|
},
|
55
55
|
"devDependencies": {
|
56
56
|
"@typescript-eslint/eslint-plugin": "^6.5.0",
|
57
57
|
"@typescript-eslint/parser": "^6.5.0",
|
58
58
|
"eslint": "8.48.0",
|
59
|
-
"rimraf": "^
|
60
|
-
"ts-node": "^10.9.
|
61
|
-
"typescript": "^5.
|
59
|
+
"rimraf": "^6.0.1",
|
60
|
+
"ts-node": "^10.9.2",
|
61
|
+
"typescript": "^5.6.2",
|
62
62
|
"yargs": "^17.7.2"
|
63
63
|
}
|
64
64
|
}
|