homebridge-carrier-infinity 1.6.7 → 1.6.8
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/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.js +8 -8
- 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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export default interface RootObject {
|
|
2
|
+
status: Status;
|
|
3
|
+
}
|
|
4
|
+
export interface Status {
|
|
5
|
+
'$': _;
|
|
6
|
+
'atom:link': Atomlink[];
|
|
7
|
+
timestamp: string[];
|
|
8
|
+
pingRate: string[];
|
|
9
|
+
iduStatusPingRate: string[];
|
|
10
|
+
iduFaultsPingRate: string[];
|
|
11
|
+
oduStatusPingRate: string[];
|
|
12
|
+
oduFaultsPingRate: string[];
|
|
13
|
+
historyPingRate: string[];
|
|
14
|
+
equipEventsPingRate: string[];
|
|
15
|
+
rootCausePingRate: string[];
|
|
16
|
+
serverHasChanges: string[];
|
|
17
|
+
configHasChanges: string[];
|
|
18
|
+
dealerHasChanges: string[];
|
|
19
|
+
dealerLogoHasChanges: string[];
|
|
20
|
+
oduConfigHasChanges: string[];
|
|
21
|
+
iduConfigHasChanges: string[];
|
|
22
|
+
utilityEventsHasChanges: string[];
|
|
23
|
+
sensorConfigHasChanges: string[];
|
|
24
|
+
sensorProfileHasChanges: string[];
|
|
25
|
+
sensorDiagnosticHasChanges: string[];
|
|
26
|
+
name: string[];
|
|
27
|
+
oat: string[];
|
|
28
|
+
mode: string[];
|
|
29
|
+
cfgem: string[];
|
|
30
|
+
cfgtype: string[];
|
|
31
|
+
vacatrunning: string[];
|
|
32
|
+
filtrlvl: string[];
|
|
33
|
+
uvlvl: string[];
|
|
34
|
+
humlvl: string[];
|
|
35
|
+
ventlvl: string[];
|
|
36
|
+
humid: string[];
|
|
37
|
+
vent: string[];
|
|
38
|
+
localTime: string[];
|
|
39
|
+
oprstsmsg: string[];
|
|
40
|
+
isDisconnected: string[];
|
|
41
|
+
idu: Idu[];
|
|
42
|
+
odu: Odu[];
|
|
43
|
+
isActive: string[];
|
|
44
|
+
zones: Zone2[];
|
|
45
|
+
}
|
|
46
|
+
export interface Zone2 {
|
|
47
|
+
zone: Zone[];
|
|
48
|
+
}
|
|
49
|
+
export interface Zone {
|
|
50
|
+
'$': _3;
|
|
51
|
+
name: string[];
|
|
52
|
+
enabled: string[];
|
|
53
|
+
currentActivity: string[];
|
|
54
|
+
rt: string[];
|
|
55
|
+
rh: string[];
|
|
56
|
+
fan: string[];
|
|
57
|
+
hold: string[];
|
|
58
|
+
htsp: string[];
|
|
59
|
+
clsp: string[];
|
|
60
|
+
otmr: string[];
|
|
61
|
+
zoneconditioning: string[];
|
|
62
|
+
damperposition: string[];
|
|
63
|
+
occupancy: string[];
|
|
64
|
+
occupancyOverride: string[];
|
|
65
|
+
}
|
|
66
|
+
export interface _3 {
|
|
67
|
+
id: string;
|
|
68
|
+
}
|
|
69
|
+
export interface Odu {
|
|
70
|
+
type: string[];
|
|
71
|
+
opstat: string[];
|
|
72
|
+
opmode: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface Idu {
|
|
75
|
+
type: string[];
|
|
76
|
+
opstat: string[];
|
|
77
|
+
cfm: string[];
|
|
78
|
+
}
|
|
79
|
+
export interface Atomlink {
|
|
80
|
+
'$': _2;
|
|
81
|
+
}
|
|
82
|
+
export interface _2 {
|
|
83
|
+
rel: string;
|
|
84
|
+
href: string;
|
|
85
|
+
}
|
|
86
|
+
export interface _ {
|
|
87
|
+
'xmlns:atom': string;
|
|
88
|
+
version: string;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=interface_status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface_status.d.ts","sourceRoot":"","sources":["../../src/api/interface_status.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,WAAW,UAAU;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,CAAC,CAAC;IACP,WAAW,EAAE,QAAQ,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAClC,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAClC,0BAA0B,EAAE,MAAM,EAAE,CAAC;IACrC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,EAAE,CAA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AAC;CAC7B;AAED,MAAM,WAAW,EAAE;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,EAAE,CAAC;CACT;AAED,MAAM,WAAW,EAAE;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface_status.js","sourceRoot":"","sources":["../../src/api/interface_status.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,6CAA6C"}
|
|
@@ -1,70 +1,39 @@
|
|
|
1
|
-
import { AxiosInstance } from 'axios';
|
|
2
1
|
import { Mutex } from 'async-mutex';
|
|
3
2
|
import { Logger } from 'homebridge';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
HOME: string;
|
|
13
|
-
AWAY: string;
|
|
14
|
-
SLEEP: string;
|
|
15
|
-
WAKE: string;
|
|
16
|
-
MANUAL: string;
|
|
17
|
-
VACATION: string;
|
|
18
|
-
};
|
|
19
|
-
export declare const FAN_MODE: {
|
|
20
|
-
OFF: string;
|
|
21
|
-
LOW: string;
|
|
22
|
-
MED: string;
|
|
23
|
-
HIGH: string;
|
|
24
|
-
};
|
|
25
|
-
export declare const STATUS: {
|
|
26
|
-
ON: string;
|
|
27
|
-
OFF: string;
|
|
28
|
-
};
|
|
29
|
-
export declare class InfinityEvolutionApiConnection {
|
|
30
|
-
username: string;
|
|
31
|
-
private password;
|
|
32
|
-
readonly log: Logger;
|
|
33
|
-
private token;
|
|
34
|
-
axios: AxiosInstance;
|
|
35
|
-
constructor(username: string, password: string, log: Logger);
|
|
36
|
-
activate(): Promise<void>;
|
|
37
|
-
forceActivate(): Promise<void>;
|
|
38
|
-
refreshToken(): Promise<void>;
|
|
39
|
-
forceRefreshToken(): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
declare abstract class BaseInfinityEvolutionApiModel {
|
|
42
|
-
protected readonly api_connection: InfinityEvolutionApiConnection;
|
|
43
|
-
protected data_object: any;
|
|
3
|
+
import { InfinityRestClient } from './rest_client';
|
|
4
|
+
import Config from './interface_config';
|
|
5
|
+
import Location from './interface_locations';
|
|
6
|
+
import Profile from './interface_profile';
|
|
7
|
+
import Status from './interface_status';
|
|
8
|
+
declare abstract class BaseModel {
|
|
9
|
+
protected readonly infinity_client: InfinityRestClient;
|
|
10
|
+
protected data_object: object;
|
|
44
11
|
protected data_object_hash?: string;
|
|
45
12
|
protected HASH_IGNORE_KEYS: Set<string>;
|
|
46
13
|
protected write_lock: Mutex;
|
|
47
14
|
protected log: Logger;
|
|
48
|
-
constructor(
|
|
15
|
+
constructor(infinity_client: InfinityRestClient);
|
|
49
16
|
abstract getPath(): string;
|
|
50
17
|
protected hashDataObject(): string;
|
|
51
18
|
fetch(): Promise<void>;
|
|
52
19
|
protected forceFetch(): Promise<void>;
|
|
53
20
|
}
|
|
54
|
-
export declare class
|
|
21
|
+
export declare class LocationsModel extends BaseModel {
|
|
22
|
+
protected data_object: Location;
|
|
55
23
|
getPath(): string;
|
|
56
24
|
getSystems(): Promise<string[]>;
|
|
57
25
|
}
|
|
58
|
-
declare abstract class
|
|
59
|
-
protected readonly
|
|
26
|
+
declare abstract class BaseSystemModel extends BaseModel {
|
|
27
|
+
protected readonly infinity_client: InfinityRestClient;
|
|
60
28
|
readonly serialNumber: string;
|
|
61
29
|
protected readonly log: Logger;
|
|
62
30
|
private last_updated;
|
|
63
31
|
protected HASH_IGNORE_KEYS: Set<string>;
|
|
64
|
-
constructor(
|
|
32
|
+
constructor(infinity_client: InfinityRestClient, serialNumber: string, log: Logger);
|
|
65
33
|
protected forceFetch(): Promise<void>;
|
|
66
34
|
}
|
|
67
|
-
export declare class
|
|
35
|
+
export declare class SystemProfileModel extends BaseSystemModel {
|
|
36
|
+
protected data_object: Profile;
|
|
68
37
|
getPath(): string;
|
|
69
38
|
getName(): Promise<string>;
|
|
70
39
|
getBrand(): Promise<string>;
|
|
@@ -72,7 +41,8 @@ export declare class InfinityEvolutionSystemProfile extends BaseInfinityEvolutio
|
|
|
72
41
|
getFirmware(): Promise<string>;
|
|
73
42
|
getZones(): Promise<Array<string>>;
|
|
74
43
|
}
|
|
75
|
-
export declare class
|
|
44
|
+
export declare class SystemStatusModel extends BaseSystemModel {
|
|
45
|
+
protected data_object: Status;
|
|
76
46
|
getPath(): string;
|
|
77
47
|
getUnits(): Promise<string>;
|
|
78
48
|
getOutdoorTemp(): Promise<number>;
|
|
@@ -88,7 +58,8 @@ export declare class InfinityEvolutionSystemStatus extends BaseInfinityEvolution
|
|
|
88
58
|
getZoneCoolSetpoint(zone: string): Promise<number>;
|
|
89
59
|
getZoneHeatSetpoint(zone: string): Promise<number>;
|
|
90
60
|
}
|
|
91
|
-
export declare class
|
|
61
|
+
export declare class SystemConfigModel extends BaseSystemModel {
|
|
62
|
+
protected data_object: Config;
|
|
92
63
|
getPath(): string;
|
|
93
64
|
getUnits(): Promise<string>;
|
|
94
65
|
getTempBounds(): Promise<[number, number]>;
|
|
@@ -113,14 +84,14 @@ export declare class InfinityEvolutionSystemConfig extends BaseInfinityEvolution
|
|
|
113
84
|
setZoneActivityManualHold(zone: string, clsp: number | null, htsp: number | null, hold_until: string | null, fan?: string | null): Promise<void>;
|
|
114
85
|
private mutateZoneActivityManualHold;
|
|
115
86
|
}
|
|
116
|
-
export declare class
|
|
117
|
-
protected readonly
|
|
87
|
+
export declare class SystemModel {
|
|
88
|
+
protected readonly infinity_client: InfinityRestClient;
|
|
118
89
|
readonly serialNumber: string;
|
|
119
|
-
status:
|
|
120
|
-
config:
|
|
121
|
-
profile:
|
|
90
|
+
status: SystemStatusModel;
|
|
91
|
+
config: SystemConfigModel;
|
|
92
|
+
profile: SystemProfileModel;
|
|
122
93
|
log: Logger;
|
|
123
|
-
constructor(
|
|
94
|
+
constructor(infinity_client: InfinityRestClient, serialNumber: string);
|
|
124
95
|
}
|
|
125
96
|
export {};
|
|
126
|
-
//# sourceMappingURL=
|
|
97
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/api/models.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAuD,MAAM,aAAa,CAAC;AAEzF,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,MAA+C,MAAM,oBAAoB,CAAC;AACjF,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,MAAuB,MAAM,oBAAoB,CAAC;AAGzD,uBAAe,SAAS;IAQpB,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,kBAAkB;IAPxD,SAAS,CAAC,WAAW,EAAG,MAAM,CAAC;IAC/B,SAAS,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACpC,SAAS,CAAC,gBAAgB,cAAqB;IAC/C,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC;IAC5B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAqD;gBAGrD,eAAe,EAAE,kBAAkB;IAKxD,QAAQ,CAAC,OAAO,IAAI,MAAM;IA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34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.
|
|
36
|
-
const helpers_1 = require("
|
|
37
|
-
const settings_1 = require("./settings");
|
|
38
|
-
const axios_1 = __importDefault(require("axios"));
|
|
39
|
-
const oauth_signature_1 = __importDefault(require("oauth-signature"));
|
|
35
|
+
exports.SystemModel = exports.SystemConfigModel = exports.SystemStatusModel = exports.SystemProfileModel = exports.LocationsModel = void 0;
|
|
36
|
+
const helpers_1 = require("../helpers");
|
|
40
37
|
const typescript_memoize_1 = require("typescript-memoize");
|
|
41
38
|
const async_mutex_1 = require("async-mutex");
|
|
42
39
|
const xml2js = __importStar(require("xml2js"));
|
|
43
40
|
const object_hash_1 = __importDefault(require("object-hash"));
|
|
44
|
-
const helper_logging_1 = require("
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
FAN_ONLY: 'fanonly',
|
|
51
|
-
};
|
|
52
|
-
exports.ACTIVITY = {
|
|
53
|
-
HOME: 'home',
|
|
54
|
-
AWAY: 'away',
|
|
55
|
-
SLEEP: 'sleep',
|
|
56
|
-
WAKE: 'wake',
|
|
57
|
-
MANUAL: 'manual',
|
|
58
|
-
VACATION: 'vacation',
|
|
59
|
-
};
|
|
60
|
-
exports.FAN_MODE = {
|
|
61
|
-
OFF: 'off',
|
|
62
|
-
LOW: 'low',
|
|
63
|
-
MED: 'med',
|
|
64
|
-
HIGH: 'high',
|
|
65
|
-
};
|
|
66
|
-
exports.STATUS = {
|
|
67
|
-
ON: 'on',
|
|
68
|
-
OFF: 'off',
|
|
69
|
-
};
|
|
70
|
-
class OAuthHeaders {
|
|
71
|
-
static genHeader(httpMethod, url, username, token, data) {
|
|
72
|
-
// Needed for header and sig
|
|
73
|
-
const sig_header_params = {
|
|
74
|
-
oauth_consumer_key: settings_1.INFINITY_API_CONSUMER_KEY,
|
|
75
|
-
oauth_token: username,
|
|
76
|
-
oauth_signature_method: 'HMAC-SHA1',
|
|
77
|
-
oauth_timestamp: Math.floor(Date.now() / 1000),
|
|
78
|
-
// TODO: make nonce bigger
|
|
79
|
-
oauth_nonce: Math.floor(Math.random() * 100000000000) + 1,
|
|
80
|
-
oauth_version: '1.0',
|
|
81
|
-
};
|
|
82
|
-
// If there is post data, we need to include it
|
|
83
|
-
const sig_body_params = {};
|
|
84
|
-
if (data) {
|
|
85
|
-
const pairs = data.split('&');
|
|
86
|
-
for (const i in pairs) {
|
|
87
|
-
const pair = pairs[i].split('=');
|
|
88
|
-
sig_body_params[pair[0]] = decodeURIComponent(pair[1]);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const sig_params = Object.assign({}, sig_header_params, sig_body_params);
|
|
92
|
-
// Make the sig
|
|
93
|
-
const signature = oauth_signature_1.default.generate(httpMethod, url, sig_params, settings_1.INFINITY_API_CONSUMER_SECRET, token);
|
|
94
|
-
// Turn into header
|
|
95
|
-
const header_params = [
|
|
96
|
-
`realm=${encodeURIComponent(url)}`,
|
|
97
|
-
];
|
|
98
|
-
for (const k in sig_header_params) {
|
|
99
|
-
header_params.push(`${k}=${sig_params[k]}`);
|
|
100
|
-
}
|
|
101
|
-
header_params.push(`oauth_signature=${signature}`);
|
|
102
|
-
return `OAuth ${header_params.join(',')}`;
|
|
103
|
-
}
|
|
104
|
-
static intercept(config, username, token) {
|
|
105
|
-
if (config.headers === undefined) {
|
|
106
|
-
config.headers = {};
|
|
107
|
-
}
|
|
108
|
-
config.headers.Authorization = this.genHeader(config.method || 'GET', config.url || '/', username, token, config.data);
|
|
109
|
-
return config;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
class InfinityEvolutionApiConnection {
|
|
113
|
-
constructor(username, password, log) {
|
|
114
|
-
this.username = username;
|
|
115
|
-
this.password = password;
|
|
116
|
-
this.log = log;
|
|
117
|
-
this.token = '';
|
|
118
|
-
this.axios = axios_1.default.create({
|
|
119
|
-
baseURL: settings_1.INFINITY_API_BASE_URL,
|
|
120
|
-
headers: {
|
|
121
|
-
featureset: 'CONSUMER_PORTAL',
|
|
122
|
-
Accept: 'application/xml',
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
// Axios debug logging and error handling
|
|
126
|
-
this.axios.interceptors.response.use(
|
|
127
|
-
// Success
|
|
128
|
-
response => {
|
|
129
|
-
var _a, _b;
|
|
130
|
-
this.log.debug(`${(_a = response.request) === null || _a === void 0 ? void 0 : _a.method} ${response.request.host}${(_b = response.request) === null || _b === void 0 ? void 0 : _b.path}`, `${response.status} ${response.statusText}`);
|
|
131
|
-
return response;
|
|
132
|
-
},
|
|
133
|
-
// Failure
|
|
134
|
-
error => {
|
|
135
|
-
var _a, _b, _c, _d, _e;
|
|
136
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
137
|
-
this.log.debug(`${(_a = error.request) === null || _a === void 0 ? void 0 : _a.method} ${(_b = error.request) === null || _b === void 0 ? void 0 : _b.host}${(_c = error.request) === null || _c === void 0 ? void 0 : _c.path}`, `${(_d = error.response) === null || _d === void 0 ? void 0 : _d.status} ${(_e = error.response) === null || _e === void 0 ? void 0 : _e.statusText}`);
|
|
138
|
-
}
|
|
139
|
-
return Promise.reject(error); // this makes http errors raise
|
|
140
|
-
});
|
|
141
|
-
// Oauth header add
|
|
142
|
-
this.axios.interceptors.request.use(config => {
|
|
143
|
-
return OAuthHeaders.intercept(config, this.username, this.token);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
// Api seems to expect this every min or so. more frequent doesn't seem to
|
|
147
|
-
// make any difference.
|
|
148
|
-
async activate() {
|
|
149
|
-
try {
|
|
150
|
-
await this.forceActivate();
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
this.log.error('[API] Failure sending activation signal: ', axios_1.default.isAxiosError(error) ? error.message : error);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
async forceActivate() {
|
|
157
|
-
await this.axios.post(`/users/${this.username}/activateSystems`, null, {
|
|
158
|
-
headers: {
|
|
159
|
-
Accept: 'application/json',
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
async refreshToken() {
|
|
164
|
-
try {
|
|
165
|
-
await this.forceRefreshToken();
|
|
166
|
-
}
|
|
167
|
-
catch (error) {
|
|
168
|
-
this.log.error('[API] Could not refresh access token: ', axios_1.default.isAxiosError(error) ? error.message : error);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
// TODO: on some api errors, force a refresh
|
|
172
|
-
async forceRefreshToken() {
|
|
173
|
-
var _a;
|
|
174
|
-
const builder = new xml2js.Builder({ cdata: true, headless: true });
|
|
175
|
-
const new_xml = builder.buildObject({
|
|
176
|
-
credentials: {
|
|
177
|
-
username: this.username,
|
|
178
|
-
password: this.password,
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
const data = `data=${encodeURIComponent(new_xml)}`;
|
|
182
|
-
const response = await this.axios.post('/users/authenticated', data, {
|
|
183
|
-
headers: {
|
|
184
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
185
|
-
Accept: 'application/json',
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
if ((_a = response.data.result) === null || _a === void 0 ? void 0 : _a.accessToken) {
|
|
189
|
-
this.token = response.data.result.accessToken;
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
this.log.debug(response.data);
|
|
193
|
-
throw new Error('User authentication error.');
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
__decorate([
|
|
198
|
-
(0, typescript_memoize_1.MemoizeExpiring)(1 * 60 * 1000)
|
|
199
|
-
], InfinityEvolutionApiConnection.prototype, "activate", null);
|
|
200
|
-
__decorate([
|
|
201
|
-
(0, typescript_memoize_1.MemoizeExpiring)(24 * 60 * 60 * 1000) // every 24 hrs
|
|
202
|
-
], InfinityEvolutionApiConnection.prototype, "refreshToken", null);
|
|
203
|
-
exports.InfinityEvolutionApiConnection = InfinityEvolutionApiConnection;
|
|
204
|
-
class BaseInfinityEvolutionApiModel {
|
|
205
|
-
constructor(api_connection) {
|
|
206
|
-
this.api_connection = api_connection;
|
|
207
|
-
// TODO make unknown and handle type checking in get methods
|
|
208
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
209
|
-
this.data_object = null;
|
|
41
|
+
const helper_logging_1 = require("../helper_logging");
|
|
42
|
+
const axios_1 = __importDefault(require("axios"));
|
|
43
|
+
const constants_1 = require("./constants");
|
|
44
|
+
class BaseModel {
|
|
45
|
+
constructor(infinity_client) {
|
|
46
|
+
this.infinity_client = infinity_client;
|
|
210
47
|
this.HASH_IGNORE_KEYS = new Set();
|
|
211
|
-
this.log = new helper_logging_1.PrefixLogger(this.
|
|
48
|
+
this.log = new helper_logging_1.PrefixLogger(this.infinity_client.log, 'API');
|
|
212
49
|
this.write_lock = new async_mutex_1.Mutex();
|
|
213
50
|
}
|
|
214
51
|
hashDataObject() {
|
|
@@ -236,9 +73,9 @@ class BaseInfinityEvolutionApiModel {
|
|
|
236
73
|
}
|
|
237
74
|
}
|
|
238
75
|
async forceFetch() {
|
|
239
|
-
await this.
|
|
240
|
-
await this.
|
|
241
|
-
const response = await this.
|
|
76
|
+
await this.infinity_client.refreshToken();
|
|
77
|
+
await this.infinity_client.activate();
|
|
78
|
+
const response = await this.infinity_client.axios.get(this.getPath());
|
|
242
79
|
if (response.data) {
|
|
243
80
|
this.data_object = await xml2js.parseStringPromise(response.data);
|
|
244
81
|
this.data_object_hash = this.hashDataObject();
|
|
@@ -251,10 +88,10 @@ class BaseInfinityEvolutionApiModel {
|
|
|
251
88
|
}
|
|
252
89
|
__decorate([
|
|
253
90
|
(0, typescript_memoize_1.MemoizeExpiring)(10 * 1000)
|
|
254
|
-
],
|
|
255
|
-
class
|
|
91
|
+
], BaseModel.prototype, "fetch", null);
|
|
92
|
+
class LocationsModel extends BaseModel {
|
|
256
93
|
getPath() {
|
|
257
|
-
return `/users/${this.
|
|
94
|
+
return `/users/${this.infinity_client.username}/locations`;
|
|
258
95
|
}
|
|
259
96
|
async getSystems() {
|
|
260
97
|
await this.fetch();
|
|
@@ -268,11 +105,11 @@ class InfinityEvolutionLocations extends BaseInfinityEvolutionApiModel {
|
|
|
268
105
|
return systems;
|
|
269
106
|
}
|
|
270
107
|
}
|
|
271
|
-
exports.
|
|
272
|
-
class
|
|
273
|
-
constructor(
|
|
274
|
-
super(
|
|
275
|
-
this.
|
|
108
|
+
exports.LocationsModel = LocationsModel;
|
|
109
|
+
class BaseSystemModel extends BaseModel {
|
|
110
|
+
constructor(infinity_client, serialNumber, log) {
|
|
111
|
+
super(infinity_client);
|
|
112
|
+
this.infinity_client = infinity_client;
|
|
276
113
|
this.serialNumber = serialNumber;
|
|
277
114
|
this.log = log;
|
|
278
115
|
this.last_updated = 0; // TODO use this
|
|
@@ -286,7 +123,7 @@ class BaseInfinityEvolutionSystemApiModel extends BaseInfinityEvolutionApiModel
|
|
|
286
123
|
this.log.debug(`TIMESTAMP ${this.getPath()} reports ${ts} (${this.last_updated})`);
|
|
287
124
|
}
|
|
288
125
|
}
|
|
289
|
-
class
|
|
126
|
+
class SystemProfileModel extends BaseSystemModel {
|
|
290
127
|
getPath() {
|
|
291
128
|
return `/systems/${this.serialNumber}/profile`;
|
|
292
129
|
}
|
|
@@ -308,11 +145,11 @@ class InfinityEvolutionSystemProfile extends BaseInfinityEvolutionSystemApiModel
|
|
|
308
145
|
}
|
|
309
146
|
async getZones() {
|
|
310
147
|
await this.fetch();
|
|
311
|
-
return this.data_object.system_profile.zones[0].zone.filter((zone) => zone['present'][0] ===
|
|
148
|
+
return this.data_object.system_profile.zones[0].zone.filter((zone) => zone['present'][0] === constants_1.STATUS.ON).map((zone) => zone['$'].id);
|
|
312
149
|
}
|
|
313
150
|
}
|
|
314
|
-
exports.
|
|
315
|
-
class
|
|
151
|
+
exports.SystemProfileModel = SystemProfileModel;
|
|
152
|
+
class SystemStatusModel extends BaseSystemModel {
|
|
316
153
|
getPath() {
|
|
317
154
|
return `/systems/${this.serialNumber}/status`;
|
|
318
155
|
}
|
|
@@ -335,9 +172,9 @@ class InfinityEvolutionSystemStatus extends BaseInfinityEvolutionSystemApiModel
|
|
|
335
172
|
case 'gasheat':
|
|
336
173
|
case 'electric':
|
|
337
174
|
case 'hpheat':
|
|
338
|
-
return
|
|
175
|
+
return constants_1.SYSTEM_MODE.HEAT;
|
|
339
176
|
case 'dehumidify':
|
|
340
|
-
return
|
|
177
|
+
return constants_1.SYSTEM_MODE.COOL;
|
|
341
178
|
default:
|
|
342
179
|
return raw_mode;
|
|
343
180
|
}
|
|
@@ -352,13 +189,13 @@ class InfinityEvolutionSystemStatus extends BaseInfinityEvolutionSystemApiModel
|
|
|
352
189
|
case 'active_heat':
|
|
353
190
|
case 'prep_heat':
|
|
354
191
|
case 'pending_heat':
|
|
355
|
-
return
|
|
192
|
+
return constants_1.SYSTEM_MODE.HEAT;
|
|
356
193
|
case 'active_cool':
|
|
357
194
|
case 'prep_cool':
|
|
358
195
|
case 'pending_cool':
|
|
359
|
-
return
|
|
196
|
+
return constants_1.SYSTEM_MODE.COOL;
|
|
360
197
|
case 'idle':
|
|
361
|
-
return
|
|
198
|
+
return constants_1.SYSTEM_MODE.OFF;
|
|
362
199
|
default:
|
|
363
200
|
return raw_mode;
|
|
364
201
|
}
|
|
@@ -366,7 +203,7 @@ class InfinityEvolutionSystemStatus extends BaseInfinityEvolutionSystemApiModel
|
|
|
366
203
|
async getZoneFan(zone) {
|
|
367
204
|
const zone_obj = await this.getZone(zone);
|
|
368
205
|
if (zone_obj.damperposition[0] === '0') {
|
|
369
|
-
return
|
|
206
|
+
return constants_1.FAN_MODE.OFF;
|
|
370
207
|
}
|
|
371
208
|
else {
|
|
372
209
|
return zone_obj.fan[0];
|
|
@@ -391,8 +228,8 @@ class InfinityEvolutionSystemStatus extends BaseInfinityEvolutionSystemApiModel
|
|
|
391
228
|
return Number((await this.getZone(zone)).htsp[0]);
|
|
392
229
|
}
|
|
393
230
|
}
|
|
394
|
-
exports.
|
|
395
|
-
class
|
|
231
|
+
exports.SystemStatusModel = SystemStatusModel;
|
|
232
|
+
class SystemConfigModel extends BaseSystemModel {
|
|
396
233
|
constructor() {
|
|
397
234
|
super(...arguments);
|
|
398
235
|
/* Write APIs */
|
|
@@ -428,13 +265,13 @@ class InfinityEvolutionSystemConfig extends BaseInfinityEvolutionSystemApiModel
|
|
|
428
265
|
}
|
|
429
266
|
async getZoneActivity(zone) {
|
|
430
267
|
const zone_obj = await this.getZone(zone);
|
|
431
|
-
if (zone_obj.hold[0] ===
|
|
268
|
+
if (zone_obj.hold[0] === constants_1.STATUS.ON) {
|
|
432
269
|
return zone_obj.holdActivity[0];
|
|
433
270
|
}
|
|
434
271
|
else {
|
|
435
272
|
const now = new Date();
|
|
436
273
|
const program_obj = (await this.getZone(zone)).program[0];
|
|
437
|
-
const today_schedule = program_obj.day[now.getDay()].period.filter(period => period.enabled[0] ===
|
|
274
|
+
const today_schedule = program_obj.day[now.getDay()].period.filter(period => period.enabled[0] === constants_1.STATUS.ON).reverse();
|
|
438
275
|
for (const i in today_schedule) {
|
|
439
276
|
const time = today_schedule[i].time[0];
|
|
440
277
|
const split = time.split(':');
|
|
@@ -447,19 +284,20 @@ class InfinityEvolutionSystemConfig extends BaseInfinityEvolutionSystemApiModel
|
|
|
447
284
|
}
|
|
448
285
|
}
|
|
449
286
|
// If we got to the end without finding the next activity, it means the activity is the last from yesterday
|
|
450
|
-
const yesterday_schedule = program_obj['day'][(now.getDay() + 8) % 7].period.filter(period => period.enabled[0] ===
|
|
287
|
+
const yesterday_schedule = program_obj['day'][(now.getDay() + 8) % 7].period.filter(period => period.enabled[0] === constants_1.STATUS.ON).reverse();
|
|
451
288
|
return yesterday_schedule[0].activity[0];
|
|
452
289
|
}
|
|
453
290
|
}
|
|
454
291
|
async getZoneActivityConfig(zone, activity_name) {
|
|
455
292
|
await this.fetch();
|
|
456
293
|
// Vacation is stored somewhere else...
|
|
457
|
-
if (activity_name ===
|
|
294
|
+
if (activity_name === constants_1.ACTIVITY.VACATION) {
|
|
458
295
|
return {
|
|
459
|
-
'$': { id:
|
|
296
|
+
'$': { id: constants_1.ACTIVITY.VACATION },
|
|
460
297
|
clsp: this.data_object.config.vacmaxt,
|
|
461
298
|
htsp: this.data_object.config.vacmint,
|
|
462
299
|
fan: this.data_object.config.vacfan,
|
|
300
|
+
previousFan: [],
|
|
463
301
|
};
|
|
464
302
|
}
|
|
465
303
|
const activities_obj = (await this.getZone(zone)).activities[0];
|
|
@@ -573,7 +411,7 @@ class InfinityEvolutionSystemConfig extends BaseInfinityEvolutionSystemApiModel
|
|
|
573
411
|
const builder = new xml2js.Builder();
|
|
574
412
|
const new_xml = builder.buildObject(this.data_object);
|
|
575
413
|
const data = `data=${encodeURIComponent(new_xml)}`;
|
|
576
|
-
await this.
|
|
414
|
+
await this.infinity_client.axios.post(this.getPath(), data, {
|
|
577
415
|
headers: {
|
|
578
416
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
579
417
|
},
|
|
@@ -601,7 +439,7 @@ class InfinityEvolutionSystemConfig extends BaseInfinityEvolutionSystemApiModel
|
|
|
601
439
|
this.log.debug(`Setting zone ${zone} activity to ${activity} until ${hold_until}`);
|
|
602
440
|
const zone_obj = await this.getZone(zone);
|
|
603
441
|
zone_obj['holdActivity'][0] = activity;
|
|
604
|
-
zone_obj['hold'][0] = activity ?
|
|
442
|
+
zone_obj['hold'][0] = activity ? constants_1.STATUS.ON : constants_1.STATUS.OFF;
|
|
605
443
|
zone_obj['otmr'][0] = activity ? hold_until || '' : '';
|
|
606
444
|
}
|
|
607
445
|
async setZoneActivityManualHold(zone, clsp, htsp, hold_until, fan = null) {
|
|
@@ -611,7 +449,7 @@ class InfinityEvolutionSystemConfig extends BaseInfinityEvolutionSystemApiModel
|
|
|
611
449
|
});
|
|
612
450
|
// Set hold to MANUAL activity
|
|
613
451
|
this.mutations.push(async () => {
|
|
614
|
-
await this.mutateZoneActivityHold(zone,
|
|
452
|
+
await this.mutateZoneActivityHold(zone, constants_1.ACTIVITY.MANUAL, hold_until);
|
|
615
453
|
});
|
|
616
454
|
// Schedule the push event, but don't wait for it to return.
|
|
617
455
|
this.push();
|
|
@@ -620,8 +458,8 @@ class InfinityEvolutionSystemConfig extends BaseInfinityEvolutionSystemApiModel
|
|
|
620
458
|
this.log.debug(`Setting zone ${zone} to`, clsp ? `clsp=${clsp}` : '', htsp ? `htsp=${htsp}` : '', fan ? `fan=${fan}` : '', '.');
|
|
621
459
|
const zone_obj = await this.getZone(zone);
|
|
622
460
|
// When moving to manual activity, default to prev activity settings.
|
|
623
|
-
const manual_activity_obj = await this.getZoneActivityConfig(zone,
|
|
624
|
-
if (zone_obj['holdActivity'][0] !==
|
|
461
|
+
const manual_activity_obj = await this.getZoneActivityConfig(zone, constants_1.ACTIVITY.MANUAL);
|
|
462
|
+
if (zone_obj['holdActivity'][0] !== constants_1.ACTIVITY.MANUAL) {
|
|
625
463
|
const prev_activity_obj = await this.getZoneActivityConfig(zone, await this.getZoneActivity(zone));
|
|
626
464
|
manual_activity_obj['clsp'][0] = prev_activity_obj['clsp'][0];
|
|
627
465
|
manual_activity_obj['htsp'][0] = prev_activity_obj['htsp'][0];
|
|
@@ -639,17 +477,17 @@ class InfinityEvolutionSystemConfig extends BaseInfinityEvolutionSystemApiModel
|
|
|
639
477
|
}
|
|
640
478
|
}
|
|
641
479
|
}
|
|
642
|
-
exports.
|
|
643
|
-
class
|
|
644
|
-
constructor(
|
|
645
|
-
this.
|
|
480
|
+
exports.SystemConfigModel = SystemConfigModel;
|
|
481
|
+
class SystemModel {
|
|
482
|
+
constructor(infinity_client, serialNumber) {
|
|
483
|
+
this.infinity_client = infinity_client;
|
|
646
484
|
this.serialNumber = serialNumber;
|
|
647
|
-
this.log = new helper_logging_1.PrefixLogger(this.
|
|
485
|
+
this.log = new helper_logging_1.PrefixLogger(this.infinity_client.log, this.serialNumber);
|
|
648
486
|
const api_logger = new helper_logging_1.PrefixLogger(this.log, 'API');
|
|
649
|
-
this.status = new
|
|
650
|
-
this.config = new
|
|
651
|
-
this.profile = new
|
|
487
|
+
this.status = new SystemStatusModel(infinity_client, serialNumber, api_logger);
|
|
488
|
+
this.config = new SystemConfigModel(infinity_client, serialNumber, api_logger);
|
|
489
|
+
this.profile = new SystemProfileModel(infinity_client, serialNumber, api_logger);
|
|
652
490
|
}
|
|
653
491
|
}
|
|
654
|
-
exports.
|
|
655
|
-
//# sourceMappingURL=
|
|
492
|
+
exports.SystemModel = SystemModel;
|
|
493
|
+
//# sourceMappingURL=models.js.map
|