homebridge-carrier-infinity 1.6.7 → 1.6.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/README.md +2 -2
- package/dist/accessory_base.d.ts +2 -2
- package/dist/accessory_base.d.ts.map +1 -1
- package/dist/accessory_base.js.map +1 -1
- package/dist/accessory_comfort_activity.js +6 -6
- package/dist/accessory_comfort_activity.js.map +1 -1
- package/dist/accessory_thermostat.d.ts +0 -3
- package/dist/accessory_thermostat.d.ts.map +1 -1
- package/dist/accessory_thermostat.js +11 -14
- package/dist/accessory_thermostat.js.map +1 -1
- package/dist/api/constants.d.ts +26 -0
- package/dist/api/constants.d.ts.map +1 -0
- package/dist/api/constants.js +29 -0
- package/dist/api/constants.js.map +1 -0
- package/dist/api/interface_config.d.ts +185 -0
- package/dist/api/interface_config.d.ts.map +1 -0
- package/dist/api/interface_config.js +5 -0
- package/dist/api/interface_config.js.map +1 -0
- package/dist/api/interface_locations.d.ts +45 -0
- package/dist/api/interface_locations.d.ts.map +1 -0
- package/dist/api/interface_locations.js +5 -0
- package/dist/api/interface_locations.js.map +1 -0
- package/dist/api/interface_profile.d.ts +80 -0
- package/dist/api/interface_profile.d.ts.map +1 -0
- package/dist/api/interface_profile.js +5 -0
- package/dist/api/interface_profile.js.map +1 -0
- package/dist/api/interface_status.d.ts +90 -0
- package/dist/api/interface_status.d.ts.map +1 -0
- package/dist/api/interface_status.js +5 -0
- package/dist/api/interface_status.js.map +1 -0
- package/dist/{infinityApi.d.ts → api/models.d.ts} +27 -56
- package/dist/api/models.d.ts.map +1 -0
- package/dist/{infinityApi.js → api/models.js} +53 -215
- package/dist/api/models.js.map +1 -0
- package/dist/api/oauth.d.ts +6 -0
- package/dist/api/oauth.d.ts.map +1 -0
- package/dist/api/oauth.js +52 -0
- package/dist/api/oauth.js.map +1 -0
- package/dist/api/rest_client.d.ts +15 -0
- package/dist/api/rest_client.d.ts.map +1 -0
- package/dist/api/rest_client.js +110 -0
- package/dist/api/rest_client.js.map +1 -0
- package/dist/characteristics_ac.js +22 -22
- package/dist/characteristics_ac.js.map +1 -1
- package/dist/characteristics_base.d.ts +2 -2
- package/dist/characteristics_base.d.ts.map +1 -1
- package/dist/characteristics_base.js +3 -3
- package/dist/characteristics_base.js.map +1 -1
- package/dist/characteristics_fan.js +19 -19
- package/dist/characteristics_fan.js.map +1 -1
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +20 -15
- package/dist/helpers.js.map +1 -1
- package/dist/platform.d.ts +4 -3
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +7 -6
- package/dist/platform.js.map +1 -1
- package/package.json +4 -2
- package/scripts/xml2ts.ts +38 -0
- package/testdata/config.xml +2022 -0
- package/testdata/locations.xml +20 -0
- package/testdata/profile.xml +112 -0
- package/testdata/status.xml +180 -0
- package/dist/infinityApi.d.ts.map +0 -1
- package/dist/infinityApi.js.map +0 -1
package/dist/helpers.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processSetpointDeadband = exports.convertCharFan2SystemFan = exports.convertSystemFan2CharFan = exports.areCharTempsClose = exports.convertCharTemp2SystemTemp = exports.convertSystemTemp2CharTemp = void 0;
|
|
4
|
-
const
|
|
3
|
+
exports.range = exports.processSetpointDeadband = exports.convertCharFan2SystemFan = exports.convertSystemFan2CharFan = exports.areCharTempsClose = exports.convertCharTemp2SystemTemp = exports.convertSystemTemp2CharTemp = void 0;
|
|
4
|
+
const constants_1 = require("./api/constants");
|
|
5
5
|
function convertSystemTemp2CharTemp(temp, units) {
|
|
6
6
|
if (units === 'F') {
|
|
7
|
-
return 5.0 / 9.0 * (temp - 32);
|
|
7
|
+
return Math.round(5.0 / 9.0 * (temp - 32) * 10) / 10;
|
|
8
8
|
}
|
|
9
9
|
else {
|
|
10
10
|
return temp;
|
|
@@ -13,20 +13,21 @@ function convertSystemTemp2CharTemp(temp, units) {
|
|
|
13
13
|
exports.convertSystemTemp2CharTemp = convertSystemTemp2CharTemp;
|
|
14
14
|
function convertCharTemp2SystemTemp(temp, units) {
|
|
15
15
|
temp = Number(temp);
|
|
16
|
+
// HK keeps track in C, but carrier can be either C or F. Convert if needed.
|
|
16
17
|
if (units === 'F') {
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
return Math.
|
|
18
|
+
// Round to integer degree for carrier.
|
|
19
|
+
const rounded = Math.round((9.0 / 5.0 * temp) + 32);
|
|
20
|
+
return Math.abs(rounded) < Number.EPSILON ? 0 : rounded; // get rid of -0
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
22
|
-
// Round C to half degree for
|
|
23
|
+
// Round C to half degree for carrier.
|
|
23
24
|
return Math.round(temp * 2) / 2;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
exports.convertCharTemp2SystemTemp = convertCharTemp2SystemTemp;
|
|
27
28
|
function areCharTempsClose(t1, t2) {
|
|
28
29
|
if (t1 && t2) {
|
|
29
|
-
return Math.abs(Number(t1) - Number(t2)) < .
|
|
30
|
+
return Math.abs(Number(t1) - Number(t2)) < Number.EPSILON;
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
33
|
return false;
|
|
@@ -35,11 +36,11 @@ function areCharTempsClose(t1, t2) {
|
|
|
35
36
|
exports.areCharTempsClose = areCharTempsClose;
|
|
36
37
|
function convertSystemFan2CharFan(fan) {
|
|
37
38
|
switch (fan) {
|
|
38
|
-
case
|
|
39
|
+
case constants_1.FAN_MODE.LOW:
|
|
39
40
|
return 1;
|
|
40
|
-
case
|
|
41
|
+
case constants_1.FAN_MODE.MED:
|
|
41
42
|
return 2;
|
|
42
|
-
case
|
|
43
|
+
case constants_1.FAN_MODE.HIGH:
|
|
43
44
|
return 3;
|
|
44
45
|
default:
|
|
45
46
|
return 0;
|
|
@@ -49,13 +50,13 @@ exports.convertSystemFan2CharFan = convertSystemFan2CharFan;
|
|
|
49
50
|
function convertCharFan2SystemFan(fan) {
|
|
50
51
|
switch (fan) {
|
|
51
52
|
case 1:
|
|
52
|
-
return
|
|
53
|
+
return constants_1.FAN_MODE.LOW;
|
|
53
54
|
case 2:
|
|
54
|
-
return
|
|
55
|
+
return constants_1.FAN_MODE.MED;
|
|
55
56
|
case 3:
|
|
56
|
-
return
|
|
57
|
+
return constants_1.FAN_MODE.HIGH;
|
|
57
58
|
default:
|
|
58
|
-
return
|
|
59
|
+
return constants_1.FAN_MODE.OFF;
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
exports.convertCharFan2SystemFan = convertCharFan2SystemFan;
|
|
@@ -72,4 +73,8 @@ function processSetpointDeadband(htsp, clsp, units, sticky_clsp) {
|
|
|
72
73
|
return [htsp, clsp];
|
|
73
74
|
}
|
|
74
75
|
exports.processSetpointDeadband = processSetpointDeadband;
|
|
76
|
+
function range(start, end) {
|
|
77
|
+
return Array.from({ length: (end - start) + 1 }, (_, i) => start + i);
|
|
78
|
+
}
|
|
79
|
+
exports.range = range;
|
|
75
80
|
//# sourceMappingURL=helpers.js.map
|
package/dist/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AACA,+
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AACA,+CAA2C;AAE3C,SAAgB,0BAA0B,CAAC,IAAY,EAAE,KAAa;IACpE,IAAI,KAAK,KAAK,GAAG,EAAE;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;KACtD;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAND,gEAMC;AAED,SAAgB,0BAA0B,CAAC,IAAyB,EAAE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AC;QACtB,KAAK,CAAC;YACJ,OAAO,oBAAQ,CAAC,IAAI,CAAC;QACvB;YACE,OAAO,oBAAQ,CAAC,GAAG,CAAC;KACvB;AACH,CAAC;AAXD,4DAWC;AAED,SAAgB,uBAAuB,CACrC,IAAY,EACZ,IAAY,EACZ,KAAa,EACb,WAAoB;IAEpB,MAAM,QAAQ,GAAG,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,IAAI,IAAI,GAAG,IAAI,GAAG,QAAQ,EAAE;QAC1B,IAAI,WAAW,EAAE;YACf,IAAI,GAAG,IAAI,GAAG,QAAQ,CAAC;SACxB;aAAM;YACL,IAAI,GAAG,IAAI,GAAG,QAAQ,CAAC;SACxB;KACF;IACD,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtB,CAAC;AAfD,0DAeC;AAED,SAAgB,KAAK,CAAC,KAAa,EAAE,GAAW;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACtE,CAAC;AAFD,sBAEC"}
|
package/dist/platform.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge';
|
|
2
|
-
import {
|
|
2
|
+
import { SystemModel } from './api/models';
|
|
3
3
|
import { BaseAccessory } from './accessory_base';
|
|
4
|
+
import { InfinityRestClient } from './api/rest_client';
|
|
4
5
|
export declare class CarrierInfinityHomebridgePlatform implements DynamicPlatformPlugin {
|
|
5
6
|
readonly log: Logger;
|
|
6
7
|
readonly config: PlatformConfig;
|
|
@@ -9,8 +10,8 @@ export declare class CarrierInfinityHomebridgePlatform implements DynamicPlatfor
|
|
|
9
10
|
readonly Characteristic: typeof Characteristic;
|
|
10
11
|
readonly restored_accessories: Record<string, PlatformAccessory>;
|
|
11
12
|
readonly accessories: Record<string, BaseAccessory>;
|
|
12
|
-
|
|
13
|
-
systems: Record<string,
|
|
13
|
+
infinity_client: InfinityRestClient;
|
|
14
|
+
systems: Record<string, SystemModel>;
|
|
14
15
|
constructor(log: Logger, config: PlatformConfig, api: API);
|
|
15
16
|
configureAccessory(accessory: PlatformAccessory): void;
|
|
16
17
|
discoverSystems(): Promise<void>;
|
package/dist/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAK5H,OAAO,
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,qBAAqB,EAAE,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAK5H,OAAO,EAEL,WAAW,EACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,qBAAa,iCAAkC,YAAW,qBAAqB;aAc3D,GAAG,EAAE,MAAM;aACX,MAAM,EAAE,cAAc;aACtB,GAAG,EAAE,GAAG;IAf1B,SAAgB,OAAO,EAAE,OAAO,OAAO,CAAwB;IAC/D,SAAgB,cAAc,EAAE,OAAO,cAAc,CAA+B;IAGpF,SAAgB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAM;IAE7E,SAAgB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAM;IAGzD,eAAe,EAAE,kBAAkB,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAM;gBAG/B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG;IA0B1B,kBAAkB,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAIhD,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAqEvC"}
|
package/dist/platform.js
CHANGED
|
@@ -4,9 +4,10 @@ exports.CarrierInfinityHomebridgePlatform = void 0;
|
|
|
4
4
|
const settings_1 = require("./settings");
|
|
5
5
|
const accessory_thermostat_1 = require("./accessory_thermostat");
|
|
6
6
|
const accessory_oat_1 = require("./accessory_oat");
|
|
7
|
-
const
|
|
7
|
+
const models_1 = require("./api/models");
|
|
8
8
|
const accessory_envsensor_1 = require("./accessory_envsensor");
|
|
9
9
|
const accessory_comfort_activity_1 = require("./accessory_comfort_activity");
|
|
10
|
+
const rest_client_1 = require("./api/rest_client");
|
|
10
11
|
class CarrierInfinityHomebridgePlatform {
|
|
11
12
|
constructor(log, config, api) {
|
|
12
13
|
this.log = log;
|
|
@@ -22,8 +23,8 @@ class CarrierInfinityHomebridgePlatform {
|
|
|
22
23
|
if (!config.username || !config.password) {
|
|
23
24
|
this.log.error('Username and password do not appear to be set in config. This is not going to work.');
|
|
24
25
|
}
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
26
|
+
this.infinity_client = new rest_client_1.InfinityRestClient(config['username'], config['password'], this.log);
|
|
27
|
+
this.infinity_client.forceRefreshToken().then().catch(error => {
|
|
27
28
|
this.log.error('Login failed: ' + error.message);
|
|
28
29
|
});
|
|
29
30
|
this.api.on('didFinishLaunching', () => {
|
|
@@ -36,17 +37,17 @@ class CarrierInfinityHomebridgePlatform {
|
|
|
36
37
|
// know how to push changes to HK yet.
|
|
37
38
|
// TODO: try to move this into the api class when we have event based
|
|
38
39
|
setInterval(() => {
|
|
39
|
-
this.
|
|
40
|
+
this.infinity_client.activate();
|
|
40
41
|
}, 30 * 60 * 1000); // every 30 min
|
|
41
42
|
}
|
|
42
43
|
configureAccessory(accessory) {
|
|
43
44
|
this.restored_accessories[accessory.UUID] = accessory;
|
|
44
45
|
}
|
|
45
46
|
async discoverSystems() {
|
|
46
|
-
const systems = await new
|
|
47
|
+
const systems = await new models_1.LocationsModel(this.infinity_client).getSystems();
|
|
47
48
|
for (const serialNumber of systems) {
|
|
48
49
|
// Create system api object, and save for later reference
|
|
49
|
-
const system = new
|
|
50
|
+
const system = new models_1.SystemModel(this.infinity_client, serialNumber);
|
|
50
51
|
this.systems[serialNumber] = system;
|
|
51
52
|
// Add system based accessories
|
|
52
53
|
const context_system = { serialNumber: system.serialNumber };
|
package/dist/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;AAEA,yCAAwD;AACxD,iEAA6D;AAC7D,mDAA8D;AAC9D
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";;;AAEA,yCAAwD;AACxD,iEAA6D;AAC7D,mDAA8D;AAC9D,yCAGsB;AACtB,+DAA2D;AAE3D,6EAAwE;AACxE,mDAAuD;AAEvD,MAAa,iCAAiC;IAa5C,YACkB,GAAW,EACX,MAAsB,EACtB,GAAQ;QAFR,QAAG,GAAH,GAAG,CAAQ;QACX,WAAM,GAAN,MAAM,CAAgB;QACtB,QAAG,GAAH,GAAG,CAAK;QAfV,YAAO,GAAmB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QAC/C,mBAAc,GAA0B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAEpF,oDAAoD;QACpC,yBAAoB,GAAsC,EAAE,CAAC;QAC7E,mDAAmD;QACnC,gBA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3
3
|
"name": "homebridge-carrier-infinity",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.9",
|
|
5
5
|
"description": "Standalone homebridge plugin for Carrier Infinity / Bryant Evolution / ICP Brands Ion thermostats.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"watch": "npm run build && (sudo hb-service link || true) && nodemon",
|
|
23
23
|
"build": "rimraf ./dist && tsc",
|
|
24
24
|
"prepublishOnly": "npm run lint && npm run build",
|
|
25
|
-
"test": "jest"
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"xml2ts": "find testdata/*.xml -exec sh -c 'node scripts/xml2ts.ts {} src/api/interface_$(basename {} .xml).ts' \\;"
|
|
26
27
|
},
|
|
27
28
|
"nodemonConfig": {
|
|
28
29
|
"watch": [
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"eslint-plugin-spellcheck": "^0.0.19",
|
|
71
72
|
"homebridge": "^1.2.3",
|
|
72
73
|
"jest": "^27.0.4",
|
|
74
|
+
"json-to-ts": "^1.7.0",
|
|
73
75
|
"nodemon": "^2.0.6",
|
|
74
76
|
"rimraf": "^3.0.2",
|
|
75
77
|
"semantic-release": "^19.0.2",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This script converts an example xml file to a TS interface.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
6
|
+
/* eslint-disable no-console */
|
|
7
|
+
/* eslint-disable spellcheck/spell-checker */
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const xml2js = require('xml2js');
|
|
10
|
+
const JsonToTS = require('json-to-ts');
|
|
11
|
+
|
|
12
|
+
const xmlFile = process.argv[2];
|
|
13
|
+
const tsFile = process.argv[3];
|
|
14
|
+
|
|
15
|
+
const xml = fs.readFileSync(xmlFile, 'utf-8');
|
|
16
|
+
|
|
17
|
+
xml2js.parseString(xml, (err, json) => {
|
|
18
|
+
if (err) {
|
|
19
|
+
console.error(err);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
fs.writeFileSync(
|
|
24
|
+
tsFile,
|
|
25
|
+
'/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable spellcheck/spell-checker */\n\n',
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
JsonToTS(json).forEach(typeInterface => {
|
|
29
|
+
if (typeInterface.includes('RootObject')){
|
|
30
|
+
fs.appendFileSync(tsFile, 'export default ');
|
|
31
|
+
} else {
|
|
32
|
+
fs.appendFileSync(tsFile, 'export ');
|
|
33
|
+
}
|
|
34
|
+
fs.appendFileSync(tsFile, typeInterface);
|
|
35
|
+
fs.appendFileSync(tsFile, '\n\n');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|