node-alarm-dot-com 2.2.0 → 2.3.0-beta.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/dist/_models/AuthOpts.js +1 -0
- package/dist/_models/AuthOpts.js.map +1 -0
- package/dist/_models/DeviceStates.d.ts +1 -1
- package/dist/_models/DeviceStates.js +1 -0
- package/dist/_models/DeviceStates.js.map +1 -0
- package/dist/_models/IdentityResponse.js +1 -0
- package/dist/_models/IdentityResponse.js.map +1 -0
- package/dist/_models/PartitionActionOptions.js +1 -0
- package/dist/_models/PartitionActionOptions.js.map +1 -0
- package/dist/_models/RequestOptions.d.ts +2 -3
- package/dist/_models/RequestOptions.js +1 -0
- package/dist/_models/RequestOptions.js.map +1 -0
- package/dist/_models/SensorType.js +1 -1
- package/dist/_models/SensorType.js.map +1 -0
- package/dist/_models/States.js +1 -1
- package/dist/_models/States.js.map +1 -0
- package/dist/_models/SystemState.js +1 -0
- package/dist/_models/SystemState.js.map +1 -0
- package/dist/_utils.d.ts +35 -0
- package/dist/_utils.js +158 -0
- package/dist/_utils.js.map +1 -0
- package/dist/core.d.ts +29 -0
- package/dist/core.js +163 -0
- package/dist/core.js.map +1 -0
- package/dist/garages.d.ts +17 -0
- package/dist/garages.js +38 -0
- package/dist/garages.js.map +1 -0
- package/dist/index.d.ts +8 -171
- package/dist/index.js +13 -629
- package/dist/index.js.map +1 -0
- package/dist/lights.d.ts +23 -0
- package/dist/lights.js +76 -0
- package/dist/lights.js.map +1 -0
- package/dist/locks.d.ts +19 -0
- package/dist/locks.js +44 -0
- package/dist/locks.js.map +1 -0
- package/dist/partitions.d.ts +40 -0
- package/dist/partitions.js +83 -0
- package/dist/partitions.js.map +1 -0
- package/dist/thermostats.d.ts +29 -0
- package/dist/thermostats.js +61 -0
- package/dist/thermostats.js.map +1 -0
- package/package.json +11 -6
package/dist/lights.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setLightOn = setLightOn;
|
|
4
|
+
exports.setLightOff = setLightOff;
|
|
5
|
+
const _utils_1 = require("./_utils");
|
|
6
|
+
/**
|
|
7
|
+
* Perform non-dimmable light actions, i.e. turn on, turn off
|
|
8
|
+
*
|
|
9
|
+
* @param {string} lightID Light ID string.
|
|
10
|
+
* @param {string} action Action (verb) to perform on the light.
|
|
11
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
12
|
+
*/
|
|
13
|
+
function lightAction(lightID, authOpts, action) {
|
|
14
|
+
const url = `${_utils_1.LIGHTS_URL}${lightID}/${action}`;
|
|
15
|
+
const postOpts = Object.assign({}, authOpts, {
|
|
16
|
+
body: {
|
|
17
|
+
statePollOnly: false
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return (0, _utils_1.authenticatedPost)(url, postOpts);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Perform dimmable light actions, e.g., turn on, turn off, change brightness level.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} lightID Light ID string.
|
|
26
|
+
* @param {string} action Action (verb) to perform on the light.
|
|
27
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
28
|
+
* @param {number} brightness An integer, 1-100, indicating brightness.
|
|
29
|
+
*/
|
|
30
|
+
function dimmerAction(lightID, authOpts, brightness, action) {
|
|
31
|
+
const url = `${_utils_1.LIGHTS_URL}${lightID}/${action}`;
|
|
32
|
+
const postOpts = Object.assign({}, authOpts, {
|
|
33
|
+
body: {
|
|
34
|
+
dimmerLevel: brightness,
|
|
35
|
+
statePollOnly: false
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return (0, _utils_1.authenticatedPost)(url, postOpts);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Convenience Method:
|
|
42
|
+
* Sets a light to ON and adjusts brightness level (1-100) of dimmable lights.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} lightID Light ID string.
|
|
45
|
+
* @param {number} brightness An integer, 1-100, indicating brightness.
|
|
46
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
47
|
+
* @param {boolean} isDimmer Indicates whether or not light is dimmable.
|
|
48
|
+
* @returns {Promise}
|
|
49
|
+
*/
|
|
50
|
+
function setLightOn(lightID, authOpts, brightness, isDimmer) {
|
|
51
|
+
if (isDimmer) {
|
|
52
|
+
return dimmerAction(lightID, authOpts, brightness, 'turnOn');
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return lightAction(lightID, authOpts, 'turnOn');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Convenience Method:
|
|
60
|
+
* Sets a light to OFF. The brightness level is ignored.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} lightID Light ID string.
|
|
63
|
+
* @param {number} brightness An integer, 1-100, indicating brightness. Ignored.
|
|
64
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
65
|
+
* @param {boolean} isDimmer Indicates whether or not light is dimmable.
|
|
66
|
+
* @returns {Promise}
|
|
67
|
+
*/
|
|
68
|
+
function setLightOff(lightID, authOpts, brightness, isDimmer) {
|
|
69
|
+
if (isDimmer) {
|
|
70
|
+
return dimmerAction(lightID, authOpts, brightness, 'turnOff');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return lightAction(lightID, authOpts, 'turnOff');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=lights.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lights.js","sourceRoot":"","sources":["../src/lights.ts"],"names":[],"mappings":";;AAiDA,gCAMC;AAYD,kCAMC;AAxED,qCAAyD;AAEzD;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,OAAe,EAAE,QAAkB,EAAE,MAAc;IACtE,MAAM,GAAG,GAAG,GAAG,mBAAU,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC;IA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ACH,CAAC"}
|
package/dist/locks.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AuthOpts } from './_models/AuthOpts';
|
|
2
|
+
/**
|
|
3
|
+
* Convenience Method:
|
|
4
|
+
* Sets a lock to "locked" (SECURED).
|
|
5
|
+
*
|
|
6
|
+
* @param {string} lockID Lock ID string.
|
|
7
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
8
|
+
* @returns {Promise}
|
|
9
|
+
*/
|
|
10
|
+
export declare function setLockSecure(lockID: string, authOpts: AuthOpts): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* Convenience Method:
|
|
13
|
+
* Sets a lock to "unlocked" (UNSECURED).
|
|
14
|
+
*
|
|
15
|
+
* @param {string} lockID Lock ID string.
|
|
16
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
17
|
+
* @returns {Promise}
|
|
18
|
+
*/
|
|
19
|
+
export declare function setLockUnsecure(lockID: string, authOpts: AuthOpts): Promise<any>;
|
package/dist/locks.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setLockSecure = setLockSecure;
|
|
4
|
+
exports.setLockUnsecure = setLockUnsecure;
|
|
5
|
+
const _utils_1 = require("./_utils");
|
|
6
|
+
/**
|
|
7
|
+
* Perform lock actions, e.g., lock, unlock.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} lockID Lock ID string.
|
|
10
|
+
* @param {string} action Action (verb) to perform on the lock.
|
|
11
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
12
|
+
*/
|
|
13
|
+
function lockAction(lockID, authOpts, action) {
|
|
14
|
+
const url = `${_utils_1.LOCKS_URL}${lockID}/${action}`;
|
|
15
|
+
const postOpts = Object.assign({}, authOpts, {
|
|
16
|
+
body: {
|
|
17
|
+
statePollOnly: false
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return (0, _utils_1.authenticatedPost)(url, postOpts);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Convenience Method:
|
|
24
|
+
* Sets a lock to "locked" (SECURED).
|
|
25
|
+
*
|
|
26
|
+
* @param {string} lockID Lock ID string.
|
|
27
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
28
|
+
* @returns {Promise}
|
|
29
|
+
*/
|
|
30
|
+
function setLockSecure(lockID, authOpts) {
|
|
31
|
+
return lockAction(lockID, authOpts, 'lock');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Convenience Method:
|
|
35
|
+
* Sets a lock to "unlocked" (UNSECURED).
|
|
36
|
+
*
|
|
37
|
+
* @param {string} lockID Lock ID string.
|
|
38
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
39
|
+
* @returns {Promise}
|
|
40
|
+
*/
|
|
41
|
+
function setLockUnsecure(lockID, authOpts) {
|
|
42
|
+
return lockAction(lockID, authOpts, 'unlock');
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=locks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locks.js","sourceRoot":"","sources":["../src/locks.ts"],"names":[],"mappings":";;AA4BA,sCAEC;AAUD,0CAEC;AAzCD,qCAAwD;AAExD;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,MAAc,EAAE,QAAkB,EAAE,MAAc;IACpE,MAAM,GAAG,GAAG,GAAG,kBAAS,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE;QAC3C,IAAI,EAAE;YACJ,aAAa,EAAE,KAAK;SACrB;KACF,CAAC,CAAC;IACH,OAAO,IAAA,0BAAiB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,aAAa,CAAC,MAAc,EAAE,QAAkB;IAC9D,OAAO,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,MAAc,EAAE,QAAkB;IAChE,OAAO,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AuthOpts } from './_models/AuthOpts';
|
|
2
|
+
import { PartitionActionOptions } from './_models/PartitionActionOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Convenience Method:
|
|
5
|
+
* Arm a security system panel in "stay" mode. NOTE: This call generally takes
|
|
6
|
+
* 20-30 seconds to complete.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} partitionID Partition ID to arm.
|
|
9
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
10
|
+
* @param {Object} opts Optional arguments for arming the system.
|
|
11
|
+
* @param {boolean} opts.noEntryDelay Disable the 30-second entry delay.
|
|
12
|
+
* @param {boolean} opts.silentArming Disable audible beeps and double the exit
|
|
13
|
+
* delay.
|
|
14
|
+
* @returns {Promise}
|
|
15
|
+
*/
|
|
16
|
+
export declare function armStay(partitionID: string, authOpts: AuthOpts, opts: PartitionActionOptions): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Convenience Method:
|
|
19
|
+
* Arm a security system panel in "away" mode. NOTE: This call generally takes
|
|
20
|
+
* 20-30 seconds to complete.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} partitionID Partition ID to arm.
|
|
23
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
24
|
+
* @param {Object} opts Optional arguments for arming the system.
|
|
25
|
+
* @param {boolean} opts.noEntryDelay Disable the 30-second entry delay.
|
|
26
|
+
* @param {boolean} opts.silentArming Disable audible beeps and double the exit
|
|
27
|
+
* delay.
|
|
28
|
+
* @returns {Promise}
|
|
29
|
+
*/
|
|
30
|
+
export declare function armAway(partitionID: string, authOpts: AuthOpts, opts: PartitionActionOptions): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Convenience Method:
|
|
33
|
+
* Disarm a security system panel. NOTE: This call generally takes 20-30 seconds
|
|
34
|
+
* to complete.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} partitionID Partition ID to disarm.
|
|
37
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
38
|
+
* @returns {Promise}
|
|
39
|
+
*/
|
|
40
|
+
export declare function disarm(partitionID: string, authOpts: AuthOpts): Promise<any>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.armStay = armStay;
|
|
4
|
+
exports.armAway = armAway;
|
|
5
|
+
exports.disarm = disarm;
|
|
6
|
+
const _utils_1 = require("./_utils");
|
|
7
|
+
/**
|
|
8
|
+
* Perform partition actions, e.g., armAway, armStay, disarm.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} partitionID Partition ID to perform action on.
|
|
11
|
+
* @param {string} action Action (verb) to perform on partition.
|
|
12
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
13
|
+
* @param {Object} opts Additional options for the action.
|
|
14
|
+
*/
|
|
15
|
+
function partitionAction(partitionID, action, authOpts, opts) {
|
|
16
|
+
opts = opts || {
|
|
17
|
+
noEntryDelay: false,
|
|
18
|
+
silentArming: false,
|
|
19
|
+
nightArming: false,
|
|
20
|
+
forceBypass: false
|
|
21
|
+
};
|
|
22
|
+
const url = `${_utils_1.PARTITIONS_URL}${partitionID}/${action}`;
|
|
23
|
+
const body = {
|
|
24
|
+
noEntryDelay: action === 'disarm' ? undefined : Boolean(opts.noEntryDelay),
|
|
25
|
+
silentArming: action === 'disarm' ? undefined : Boolean(opts.silentArming),
|
|
26
|
+
statePollOnly: false
|
|
27
|
+
};
|
|
28
|
+
// We only want to set nightArming when told to do so
|
|
29
|
+
//This is because calling nightArm when not supported will break the action
|
|
30
|
+
if (opts.nightArming === true) {
|
|
31
|
+
body['nightArming'] = true;
|
|
32
|
+
}
|
|
33
|
+
if (opts.forceBypass === true) {
|
|
34
|
+
body['forceBypass'] = true;
|
|
35
|
+
}
|
|
36
|
+
const postOpts = Object.assign({}, authOpts, { body });
|
|
37
|
+
return (0, _utils_1.authenticatedPost)(url, postOpts);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Convenience Method:
|
|
41
|
+
* Arm a security system panel in "stay" mode. NOTE: This call generally takes
|
|
42
|
+
* 20-30 seconds to complete.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} partitionID Partition ID to arm.
|
|
45
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
46
|
+
* @param {Object} opts Optional arguments for arming the system.
|
|
47
|
+
* @param {boolean} opts.noEntryDelay Disable the 30-second entry delay.
|
|
48
|
+
* @param {boolean} opts.silentArming Disable audible beeps and double the exit
|
|
49
|
+
* delay.
|
|
50
|
+
* @returns {Promise}
|
|
51
|
+
*/
|
|
52
|
+
function armStay(partitionID, authOpts, opts) {
|
|
53
|
+
return partitionAction(partitionID, 'armStay', authOpts, opts);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Convenience Method:
|
|
57
|
+
* Arm a security system panel in "away" mode. NOTE: This call generally takes
|
|
58
|
+
* 20-30 seconds to complete.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} partitionID Partition ID to arm.
|
|
61
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
62
|
+
* @param {Object} opts Optional arguments for arming the system.
|
|
63
|
+
* @param {boolean} opts.noEntryDelay Disable the 30-second entry delay.
|
|
64
|
+
* @param {boolean} opts.silentArming Disable audible beeps and double the exit
|
|
65
|
+
* delay.
|
|
66
|
+
* @returns {Promise}
|
|
67
|
+
*/
|
|
68
|
+
function armAway(partitionID, authOpts, opts) {
|
|
69
|
+
return partitionAction(partitionID, 'armAway', authOpts, opts);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Convenience Method:
|
|
73
|
+
* Disarm a security system panel. NOTE: This call generally takes 20-30 seconds
|
|
74
|
+
* to complete.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} partitionID Partition ID to disarm.
|
|
77
|
+
* @param {Object} authOpts Authentication object returned from the login.
|
|
78
|
+
* @returns {Promise}
|
|
79
|
+
*/
|
|
80
|
+
function disarm(partitionID, authOpts) {
|
|
81
|
+
return partitionAction(partitionID, 'disarm', authOpts);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=partitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partitions.js","sourceRoot":"","sources":["../src/partitions.ts"],"names":[],"mappings":";;AA0DA,0BAEC;AAeD,0BAEC;AAWD,wBAEC;AAxFD,qCAA6D;AAE7D;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,WAAmB,EAAE,MAAc,EAAE,QAAkB,EAAE,IAA6B;IAC7G,IAAI,GAAG,IAAI,IAAI;QACb,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;QACnB,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,KAAK;KACnB,CAAC;IACF,MAAM,GAAG,GAAG,GAAG,uBAAc,GAAG,WAAW,IAAI,MAAM,EAAE,CAAC;IACxD,MAAM,IAAI,GAMN;QACF,YAAY,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;QAC1E,YAAY,EAAE,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC;QAC1E,aAAa,EAAE,KAAK;KACrB,CAAC;IACF,qDAAqD;IACrD,2EAA2E;IAC3E,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAC7B,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,OAAO,IAAA,0BAAiB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,OAAO,CAAC,WAAmB,EAAE,QAAkB,EAAE,IAA4B;IAC3F,OAAO,eAAe,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,OAAO,CAAC,WAAmB,EAAE,QAAkB,EAAE,IAA4B;IAC3F,OAAO,eAAe,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,MAAM,CAAC,WAAmB,EAAE,QAAkB;IAC5D,OAAO,eAAe,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AuthOpts } from './_models/AuthOpts';
|
|
2
|
+
import { THERMOSTAT_STATES } from './_models/States';
|
|
3
|
+
/**
|
|
4
|
+
* Update thermostat state
|
|
5
|
+
*
|
|
6
|
+
* @param {string} thermostatID Thermostat ID string.
|
|
7
|
+
* @param {Object} newState New desired state.
|
|
8
|
+
* @param {Object} authOpts Authentication object returned from the `login` method.
|
|
9
|
+
* @returns {Promise}
|
|
10
|
+
*/
|
|
11
|
+
export declare function setThermostatState(thermostatID: string, newState: THERMOSTAT_STATES, authOpts: AuthOpts): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Sets a thermostat target heat temperature.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} thermostatID Thermostat ID string.
|
|
16
|
+
* @param {number} newTemp New target temperature.
|
|
17
|
+
* @param {Object} authOpts Authentication object returned from the `login` method.
|
|
18
|
+
* @returns {Promise}
|
|
19
|
+
*/
|
|
20
|
+
export declare function setThermostatTargetHeatTemperature(thermostatID: string, newTemp: number, authOpts: AuthOpts): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Sets a thermostat target cool temperature.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} thermostatID Thermostat ID string.
|
|
25
|
+
* @param {number} newTemp New target temperature.
|
|
26
|
+
* @param {Object} authOpts Authentication object returned from the `login` method.
|
|
27
|
+
* @returns {Promise}
|
|
28
|
+
*/
|
|
29
|
+
export declare function setThermostatTargetCoolTemperature(thermostatID: string, newTemp: number, authOpts: AuthOpts): Promise<any>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setThermostatState = setThermostatState;
|
|
4
|
+
exports.setThermostatTargetHeatTemperature = setThermostatTargetHeatTemperature;
|
|
5
|
+
exports.setThermostatTargetCoolTemperature = setThermostatTargetCoolTemperature;
|
|
6
|
+
const _utils_1 = require("./_utils");
|
|
7
|
+
/**
|
|
8
|
+
* Update thermostat state
|
|
9
|
+
*
|
|
10
|
+
* @param {string} thermostatID Thermostat ID string.
|
|
11
|
+
* @param {Object} newState New desired state.
|
|
12
|
+
* @param {Object} authOpts Authentication object returned from the `login` method.
|
|
13
|
+
* @returns {Promise}
|
|
14
|
+
*/
|
|
15
|
+
function setThermostatState(thermostatID, newState, authOpts) {
|
|
16
|
+
const url = `${_utils_1.THERMOSTAT_URL}${thermostatID}/setState`;
|
|
17
|
+
const postOpts = Object.assign({}, authOpts, {
|
|
18
|
+
body: {
|
|
19
|
+
desiredState: newState,
|
|
20
|
+
statePollOnly: false
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return (0, _utils_1.authenticatedPost)(url, postOpts);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sets a thermostat target heat temperature.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} thermostatID Thermostat ID string.
|
|
29
|
+
* @param {number} newTemp New target temperature.
|
|
30
|
+
* @param {Object} authOpts Authentication object returned from the `login` method.
|
|
31
|
+
* @returns {Promise}
|
|
32
|
+
*/
|
|
33
|
+
function setThermostatTargetHeatTemperature(thermostatID, newTemp, authOpts) {
|
|
34
|
+
const url = `${_utils_1.THERMOSTAT_URL}${thermostatID}/setState`;
|
|
35
|
+
const postOpts = Object.assign({}, authOpts, {
|
|
36
|
+
body: {
|
|
37
|
+
desiredHeatSetpoint: newTemp,
|
|
38
|
+
statePollOnly: false
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return (0, _utils_1.authenticatedPost)(url, postOpts);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sets a thermostat target cool temperature.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} thermostatID Thermostat ID string.
|
|
47
|
+
* @param {number} newTemp New target temperature.
|
|
48
|
+
* @param {Object} authOpts Authentication object returned from the `login` method.
|
|
49
|
+
* @returns {Promise}
|
|
50
|
+
*/
|
|
51
|
+
function setThermostatTargetCoolTemperature(thermostatID, newTemp, authOpts) {
|
|
52
|
+
const url = `${_utils_1.THERMOSTAT_URL}${thermostatID}/setState`;
|
|
53
|
+
const postOpts = Object.assign({}, authOpts, {
|
|
54
|
+
body: {
|
|
55
|
+
desiredCoolSetpoint: newTemp,
|
|
56
|
+
statePollOnly: false
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return (0, _utils_1.authenticatedPost)(url, postOpts);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=thermostats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thermostats.js","sourceRoot":"","sources":["../src/thermostats.ts"],"names":[],"mappings":";;AAYA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,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-alarm-dot-com",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-beta.1",
|
|
4
4
|
"description": "An interface module written in node.js to arm and disarm Alarm.com security systems.",
|
|
5
5
|
"author": {
|
|
6
|
-
"name": "Chase
|
|
6
|
+
"name": "Chase Christiansen",
|
|
7
7
|
"url": "https://github.com/chase9"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
@@ -37,28 +37,33 @@
|
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"clean": "rimraf ./dist",
|
|
40
|
+
"lint": "eslint src/**.ts",
|
|
40
41
|
"build": "rimraf ./dist && tsc",
|
|
41
|
-
"prepublishOnly": "npm run build",
|
|
42
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
42
43
|
"postpublish": "npm run clean",
|
|
43
44
|
"start": "ts-node src/index.ts",
|
|
44
45
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
45
46
|
},
|
|
46
47
|
"engines": {
|
|
47
|
-
"node": ">=
|
|
48
|
+
"node": ">=22.0.0"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
51
|
"node-fetch": "^2.7.0",
|
|
51
52
|
"semver": "^7.7.4"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
55
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
56
|
+
"@eslint/js": "^10.0.1",
|
|
54
57
|
"@types/node": "^25.6.0",
|
|
55
58
|
"@types/node-fetch": "^2.6.13",
|
|
56
59
|
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
57
60
|
"@typescript-eslint/parser": "^8.58.1",
|
|
58
|
-
"eslint": "10.2.0",
|
|
61
|
+
"eslint": "^10.2.0",
|
|
62
|
+
"eslint-config-prettier": "^10.1.8",
|
|
63
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
59
64
|
"rimraf": "^6.1.3",
|
|
60
65
|
"ts-node": "^10.9.2",
|
|
61
66
|
"typescript": "^6.0.2",
|
|
62
67
|
"yargs": "^18.0.0"
|
|
63
68
|
}
|
|
64
|
-
}
|
|
69
|
+
}
|