homebridge-verano 2.0.6 → 2.1.0
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 +6 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -63
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +73 -75
package/README.md
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
8
8
|
private readonly informationService;
|
|
9
9
|
private readonly name;
|
|
10
10
|
private readonly service;
|
|
11
|
-
private
|
|
12
|
-
private
|
|
11
|
+
private thermostatState;
|
|
12
|
+
private lastFetchTime;
|
|
13
13
|
private isAuthorized;
|
|
14
14
|
private sessionCookie;
|
|
15
15
|
private Characteristic;
|
|
@@ -17,9 +17,7 @@ export declare class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
17
17
|
identify?(): void;
|
|
18
18
|
getServices(): Service[];
|
|
19
19
|
getControllers?(): Controller[];
|
|
20
|
-
private
|
|
21
|
-
private fetchCurrentTemperature;
|
|
22
|
-
private clearCache;
|
|
20
|
+
private requestThermostatState;
|
|
23
21
|
private fetchDataTiles;
|
|
24
22
|
private requestAuthorization;
|
|
25
23
|
private requestTemperatureChange;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AAa/F,qBAAa,qBAAsB,YAAW,eAAe;IAoBrD,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IApBxB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAc;IAClD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAc;IAEtD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAM;IACzC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,eAAe,CAIrB;IACF,OAAO,CAAC,aAAa,CAAc;IAEnC,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,cAAc,CAAM;gBAGP,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,GAAG;IAmG7B,QAAQ,CAAC,IAAI,IAAI;IAIjB,WAAW,IAAI,OAAO,EAAE;IAOxB,cAAc,CAAC,IAAI,UAAU,EAAE;YAIjB,sBAAsB;YAatB,cAAc;YAmCd,oBAAoB;YAwBpB,wBAAwB;CA4BzC"}
|
package/dist/index.js
CHANGED
|
@@ -15,79 +15,82 @@ class VeranoAccessoryPlugin {
|
|
|
15
15
|
this.api = api;
|
|
16
16
|
this.TEMPERATURE_DIVIDER = 10;
|
|
17
17
|
this.TURN_ON_OFF_TEMPERATURE = 10;
|
|
18
|
-
this.
|
|
18
|
+
this.thermostatState = {
|
|
19
|
+
currentTemperature: 0,
|
|
20
|
+
targetTemperature: 0,
|
|
21
|
+
heating: false
|
|
22
|
+
};
|
|
23
|
+
this.lastFetchTime = -1;
|
|
19
24
|
this.log = log;
|
|
25
|
+
this.log.info('Verano accessory plugin initializing');
|
|
20
26
|
this.config = config;
|
|
21
27
|
this.name = config.name;
|
|
22
28
|
this.api = api;
|
|
23
29
|
this.isAuthorized = false;
|
|
24
30
|
this.sessionCookie = '';
|
|
25
|
-
this.
|
|
31
|
+
this.requestThermostatState()
|
|
32
|
+
.then(thermostatState => this.log.info('Fetched initial thermostat state', thermostatState));
|
|
26
33
|
this.Characteristic = this.api.hap.Characteristic;
|
|
27
34
|
this.informationService = new this.api.hap.Service.AccessoryInformation()
|
|
28
35
|
.setCharacteristic(this.api.hap.Characteristic.Manufacturer, "Verano")
|
|
29
36
|
.setCharacteristic(this.api.hap.Characteristic.Model, "VER-24 WiFi");
|
|
30
37
|
this.service = new this.api.hap.Service.Thermostat(this.name);
|
|
38
|
+
// GET CURRENT STATE
|
|
31
39
|
this.service.getCharacteristic(this.Characteristic.CurrentHeatingCoolingState)
|
|
32
40
|
.on('get', (callback) => {
|
|
33
|
-
this.log.debug('
|
|
34
|
-
const
|
|
35
|
-
callback(null,
|
|
41
|
+
this.log.debug('Get CurrentHeatingCoolingState');
|
|
42
|
+
const heatingState = this.thermostatState.heating ? this.Characteristic.CurrentHeatingCoolingState.HEAT : this.Characteristic.CurrentHeatingCoolingState.OFF;
|
|
43
|
+
callback(null, heatingState);
|
|
36
44
|
});
|
|
45
|
+
// GET TARGET STATE
|
|
37
46
|
this.service.getCharacteristic(this.Characteristic.TargetHeatingCoolingState)
|
|
38
47
|
.setProps({
|
|
39
48
|
validValues: [
|
|
40
49
|
this.Characteristic.TargetHeatingCoolingState.OFF,
|
|
41
50
|
this.Characteristic.TargetHeatingCoolingState.HEAT
|
|
42
51
|
]
|
|
43
|
-
})
|
|
44
|
-
this.service.getCharacteristic(this.Characteristic.TargetHeatingCoolingState)
|
|
52
|
+
})
|
|
45
53
|
.on('get', (callback) => {
|
|
46
|
-
this.log.debug('
|
|
47
|
-
this.
|
|
48
|
-
.then(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
this.log.debug('Get TargetHeatingCoolingState');
|
|
55
|
+
this.requestThermostatState()
|
|
56
|
+
.then(thermostatState => {
|
|
57
|
+
const heatingState = thermostatState.heating ? this.Characteristic.TargetHeatingCoolingState.HEAT : this.Characteristic.TargetHeatingCoolingState.OFF;
|
|
58
|
+
callback(null, heatingState);
|
|
59
|
+
})
|
|
60
|
+
.catch(error => callback(error));
|
|
53
61
|
})
|
|
54
62
|
.on('set', (value, callback) => {
|
|
55
|
-
this.
|
|
56
|
-
if (this.
|
|
63
|
+
this.thermostatState.heating = value === this.Characteristic.TargetHeatingCoolingState.HEAT;
|
|
64
|
+
if (this.thermostatState.heating) {
|
|
57
65
|
callback(null);
|
|
58
66
|
return;
|
|
59
67
|
}
|
|
60
|
-
this.log.info('Turning off');
|
|
68
|
+
this.log.info('Turning off heating...');
|
|
61
69
|
this.requestTemperatureChange(this.TURN_ON_OFF_TEMPERATURE)
|
|
62
|
-
.then(() =>
|
|
70
|
+
.then(() => {
|
|
71
|
+
this.log.info('Heating turned off');
|
|
72
|
+
callback(null);
|
|
73
|
+
})
|
|
63
74
|
.catch(error => callback(error));
|
|
64
75
|
});
|
|
76
|
+
// GET TEMPERATURE
|
|
65
77
|
this.service.getCharacteristic(this.Characteristic.CurrentTemperature)
|
|
66
78
|
.on('get', (callback) => {
|
|
67
|
-
this.log.debug('
|
|
68
|
-
this.
|
|
69
|
-
.then(
|
|
70
|
-
callback(
|
|
71
|
-
})
|
|
72
|
-
.catch(error => {
|
|
73
|
-
this.log.error('Error during current temperature fetch', error);
|
|
74
|
-
callback(error);
|
|
75
|
-
});
|
|
79
|
+
this.log.debug('Get CurrentTemperature');
|
|
80
|
+
this.requestThermostatState()
|
|
81
|
+
.then(thermostatState => callback(null, thermostatState.currentTemperature))
|
|
82
|
+
.catch(error => callback(error));
|
|
76
83
|
});
|
|
84
|
+
// GET TARGET TEMPERATURE
|
|
77
85
|
this.service.getCharacteristic(this.Characteristic.TargetTemperature)
|
|
78
86
|
.on('get', (callback) => {
|
|
79
|
-
this.log.debug('
|
|
80
|
-
this.
|
|
81
|
-
.then(
|
|
82
|
-
callback(
|
|
83
|
-
})
|
|
84
|
-
.catch(error => {
|
|
85
|
-
this.log.error('Error during current temperature fetch', error);
|
|
86
|
-
callback(error);
|
|
87
|
-
});
|
|
87
|
+
this.log.debug('Get TargetTemperature');
|
|
88
|
+
this.requestThermostatState()
|
|
89
|
+
.then(thermostatState => callback(null, thermostatState.targetTemperature))
|
|
90
|
+
.catch(error => callback(error));
|
|
88
91
|
})
|
|
89
92
|
.on('set', (value, callback) => {
|
|
90
|
-
this.log.debug('
|
|
93
|
+
this.log.debug('Set TargetTemperature:', value);
|
|
91
94
|
this.requestTemperatureChange(value)
|
|
92
95
|
.then(() => callback(null))
|
|
93
96
|
.catch(error => callback(error));
|
|
@@ -103,11 +106,7 @@ class VeranoAccessoryPlugin {
|
|
|
103
106
|
})
|
|
104
107
|
.on('set', (value, callback) => {
|
|
105
108
|
});
|
|
106
|
-
|
|
107
|
-
this.clearCache();
|
|
108
|
-
}, 5000);
|
|
109
|
-
this.log.debug('Verano accessory plugin initialized');
|
|
110
|
-
this.requestAuthorization();
|
|
109
|
+
this.log.info('Verano accessory plugin initialized');
|
|
111
110
|
}
|
|
112
111
|
identify() {
|
|
113
112
|
this.log('Identify!');
|
|
@@ -121,25 +120,26 @@ class VeranoAccessoryPlugin {
|
|
|
121
120
|
getControllers() {
|
|
122
121
|
return [];
|
|
123
122
|
}
|
|
124
|
-
async
|
|
123
|
+
async requestThermostatState() {
|
|
125
124
|
const tiles = await this.fetchDataTiles();
|
|
126
125
|
const foundTile = tiles.filter(tile => tile.id === 58)[0];
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.cachedState = null;
|
|
126
|
+
const targetTemperature = foundTile.params.widget1.value / this.TEMPERATURE_DIVIDER;
|
|
127
|
+
const currentTemperature = foundTile.params.widget2.value / this.TEMPERATURE_DIVIDER;
|
|
128
|
+
this.thermostatState = {
|
|
129
|
+
currentTemperature: currentTemperature,
|
|
130
|
+
targetTemperature: targetTemperature,
|
|
131
|
+
heating: targetTemperature > this.TURN_ON_OFF_TEMPERATURE
|
|
132
|
+
};
|
|
133
|
+
return this.thermostatState;
|
|
136
134
|
}
|
|
137
135
|
async fetchDataTiles() {
|
|
138
|
-
|
|
139
|
-
if (this.
|
|
140
|
-
this.log.
|
|
141
|
-
return this.
|
|
136
|
+
const currentTime = new Date().getTime();
|
|
137
|
+
if (this.lastFetchTime > 0 && currentTime - this.lastFetchTime < 2500) {
|
|
138
|
+
this.log.debug('Returning cached thermostat state', this.thermostatState);
|
|
139
|
+
return this.thermostatState;
|
|
142
140
|
}
|
|
141
|
+
this.log.debug('Fetching data tiles...');
|
|
142
|
+
this.lastFetchTime = currentTime;
|
|
143
143
|
if (!this.isAuthorized) {
|
|
144
144
|
this.log.error('Not authorized, cannot get tiles, trying to authorize');
|
|
145
145
|
await this.requestAuthorization();
|
|
@@ -148,14 +148,14 @@ class VeranoAccessoryPlugin {
|
|
|
148
148
|
headers: {
|
|
149
149
|
'Cookie': this.sessionCookie
|
|
150
150
|
},
|
|
151
|
-
withCredentials: true
|
|
151
|
+
withCredentials: true,
|
|
152
152
|
};
|
|
153
153
|
return axios_1.default
|
|
154
154
|
.get('https://emodul.pl/frontend/module_data', config)
|
|
155
155
|
.then(response => {
|
|
156
156
|
const tiles = response.data.tiles;
|
|
157
|
-
this.log.
|
|
158
|
-
this.
|
|
157
|
+
this.log.debug("Fetched", tiles.length, "data tiles");
|
|
158
|
+
this.log.debug(tiles);
|
|
159
159
|
return tiles;
|
|
160
160
|
}).catch(error => {
|
|
161
161
|
this.log.error("Error during tiles fetch", error);
|
|
@@ -175,20 +175,21 @@ class VeranoAccessoryPlugin {
|
|
|
175
175
|
return axios_1.default
|
|
176
176
|
.post('https://emodul.pl/login', requestBody)
|
|
177
177
|
.then(loginResponse => {
|
|
178
|
-
this.log.info('Successfully authorized');
|
|
178
|
+
this.log.info('Successfully authorized', requestBody.username);
|
|
179
179
|
const cookies = loginResponse.headers['set-cookie'];
|
|
180
180
|
this.sessionCookie = cookies.filter(cookie => cookie.includes('session'))[0];
|
|
181
181
|
this.isAuthorized = true;
|
|
182
182
|
return loginResponse;
|
|
183
183
|
})
|
|
184
184
|
.catch(error => {
|
|
185
|
-
this.log.error("Error during authorization", error);
|
|
185
|
+
this.log.error("Error during authorization", requestBody.username, error);
|
|
186
186
|
this.isAuthorized = false;
|
|
187
187
|
throw error;
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
async requestTemperatureChange(targetTemperature) {
|
|
191
|
-
this.log.info('Changing temperature to', targetTemperature);
|
|
191
|
+
this.log.info('Changing temperature to', targetTemperature + '°C');
|
|
192
|
+
this.lastFetchTime = -1;
|
|
192
193
|
const requestBody = [
|
|
193
194
|
{
|
|
194
195
|
ido: 139,
|
|
@@ -205,7 +206,7 @@ class VeranoAccessoryPlugin {
|
|
|
205
206
|
return axios_1.default
|
|
206
207
|
.post('https://emodul.pl/send_control_data', requestBody, config)
|
|
207
208
|
.then(response => {
|
|
208
|
-
this.log.info('Successfully changed temperature');
|
|
209
|
+
this.log.info('Successfully changed temperature to', targetTemperature + '°C');
|
|
209
210
|
return response === null || response === void 0 ? void 0 : response.data;
|
|
210
211
|
})
|
|
211
212
|
.catch(error => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AACA,kDAA0B;AAE1B,MAAM,CAAC,OAAO,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC1B,GAAG,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC1E,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AACA,kDAA0B;AAE1B,MAAM,CAAC,OAAO,GAAG,CAAC,GAAQ,EAAE,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AO,EAAE;gBACL,QAAQ,EAAE,IAAI,CAAC,aAAa;aAC/B;YACD,eAAe,EAAE,IAAI;SACxB,CAAC;QACF,OAAO,eAAK;aACP,IAAI,CAAC,qCAAqC,EAAE,WAAW,EAAE,MAAM,CAAC;aAChE,IAAI,CAAC,QAAQ,CAAC,EAAE;YACb,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,EAAE,iBAAiB,GAAG,IAAI,CAAC,CAAC;YAC/E,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC;QAC1B,CAAC,CAAC;aACD,KAAK,CAAC,KAAK,CAAC,EAAE;YACX,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACzD,MAAM,KAAK,CAAC;QAChB,CAAC,CAAC,CAAA;IACV,CAAC;CAEJ;AA5OD,sDA4OC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -5,17 +5,27 @@ module.exports = (api: API) => {
|
|
|
5
5
|
api.registerAccessory('VeranoAccessoryPlugin', VeranoAccessoryPlugin);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
interface ThermostatState {
|
|
9
|
+
currentTemperature: number;
|
|
10
|
+
targetTemperature: number;
|
|
11
|
+
heating: boolean;
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
export class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
10
15
|
|
|
11
16
|
private readonly TEMPERATURE_DIVIDER: number = 10;
|
|
12
17
|
private readonly TURN_ON_OFF_TEMPERATURE: number = 10;
|
|
18
|
+
|
|
13
19
|
private readonly informationService: any;
|
|
14
20
|
private readonly name: string;
|
|
15
21
|
private readonly service: Service;
|
|
16
|
-
private
|
|
22
|
+
private thermostatState: ThermostatState = {
|
|
23
|
+
currentTemperature: 0,
|
|
24
|
+
targetTemperature: 0,
|
|
25
|
+
heating: false
|
|
26
|
+
};
|
|
27
|
+
private lastFetchTime: number = -1;
|
|
17
28
|
|
|
18
|
-
private isOn: boolean;
|
|
19
29
|
private isAuthorized: boolean;
|
|
20
30
|
private sessionCookie: string;
|
|
21
31
|
private Characteristic: any;
|
|
@@ -25,14 +35,16 @@ export class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
25
35
|
private readonly config: AccessoryConfig,
|
|
26
36
|
private readonly api: API,
|
|
27
37
|
) {
|
|
28
|
-
this.log.debug('Verano accessory plugin initializing');
|
|
29
38
|
this.log = log;
|
|
39
|
+
this.log.info('Verano accessory plugin initializing');
|
|
30
40
|
this.config = config;
|
|
31
41
|
this.name = config.name;
|
|
32
42
|
this.api = api;
|
|
33
43
|
this.isAuthorized = false;
|
|
34
44
|
this.sessionCookie = '';
|
|
35
|
-
|
|
45
|
+
|
|
46
|
+
this.requestThermostatState()
|
|
47
|
+
.then(thermostatState => this.log.info('Fetched initial thermostat state', thermostatState))
|
|
36
48
|
|
|
37
49
|
this.Characteristic = this.api.hap.Characteristic;
|
|
38
50
|
|
|
@@ -42,72 +54,65 @@ export class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
42
54
|
|
|
43
55
|
this.service = new this.api.hap.Service.Thermostat(this.name);
|
|
44
56
|
|
|
57
|
+
// GET CURRENT STATE
|
|
45
58
|
this.service.getCharacteristic(this.Characteristic.CurrentHeatingCoolingState)
|
|
46
59
|
.on('get', (callback) => {
|
|
47
|
-
this.log.debug('
|
|
48
|
-
const
|
|
49
|
-
callback(null,
|
|
60
|
+
this.log.debug('Get CurrentHeatingCoolingState');
|
|
61
|
+
const heatingState = this.thermostatState.heating ? this.Characteristic.CurrentHeatingCoolingState.HEAT : this.Characteristic.CurrentHeatingCoolingState.OFF;
|
|
62
|
+
callback(null, heatingState);
|
|
50
63
|
});
|
|
51
64
|
|
|
65
|
+
// GET TARGET STATE
|
|
52
66
|
this.service.getCharacteristic(this.Characteristic.TargetHeatingCoolingState)
|
|
53
67
|
.setProps({
|
|
54
68
|
validValues: [
|
|
55
69
|
this.Characteristic.TargetHeatingCoolingState.OFF,
|
|
56
70
|
this.Characteristic.TargetHeatingCoolingState.HEAT
|
|
57
71
|
]
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
this.service.getCharacteristic(this.Characteristic.TargetHeatingCoolingState)
|
|
72
|
+
})
|
|
61
73
|
.on('get', (callback) => {
|
|
62
|
-
this.log.debug('
|
|
63
|
-
this.
|
|
64
|
-
.then(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
this.log.debug('Get TargetHeatingCoolingState');
|
|
75
|
+
this.requestThermostatState()
|
|
76
|
+
.then(thermostatState => {
|
|
77
|
+
const heatingState = thermostatState.heating ? this.Characteristic.TargetHeatingCoolingState.HEAT : this.Characteristic.TargetHeatingCoolingState.OFF;
|
|
78
|
+
callback(null, heatingState);
|
|
79
|
+
})
|
|
80
|
+
.catch(error => callback(error));
|
|
69
81
|
})
|
|
70
82
|
.on('set', (value, callback) => {
|
|
71
|
-
this.
|
|
72
|
-
if (this.
|
|
83
|
+
this.thermostatState.heating = value === this.Characteristic.TargetHeatingCoolingState.HEAT;
|
|
84
|
+
if (this.thermostatState.heating) {
|
|
73
85
|
callback(null);
|
|
74
86
|
return;
|
|
75
87
|
}
|
|
76
|
-
this.log.info('Turning off');
|
|
88
|
+
this.log.info('Turning off heating...');
|
|
77
89
|
this.requestTemperatureChange(this.TURN_ON_OFF_TEMPERATURE)
|
|
78
|
-
.then(() =>
|
|
90
|
+
.then(() => {
|
|
91
|
+
this.log.info('Heating turned off');
|
|
92
|
+
callback(null);
|
|
93
|
+
})
|
|
79
94
|
.catch(error => callback(error));
|
|
80
|
-
|
|
81
|
-
|
|
82
95
|
});
|
|
83
96
|
|
|
97
|
+
// GET TEMPERATURE
|
|
84
98
|
this.service.getCharacteristic(this.Characteristic.CurrentTemperature)
|
|
85
99
|
.on('get', (callback) => {
|
|
86
|
-
this.log.debug('
|
|
87
|
-
this.
|
|
88
|
-
.then(
|
|
89
|
-
|
|
90
|
-
})
|
|
91
|
-
.catch(error => {
|
|
92
|
-
this.log.error('Error during current temperature fetch', error);
|
|
93
|
-
callback(error);
|
|
94
|
-
});
|
|
100
|
+
this.log.debug('Get CurrentTemperature');
|
|
101
|
+
this.requestThermostatState()
|
|
102
|
+
.then(thermostatState => callback(null, thermostatState.currentTemperature))
|
|
103
|
+
.catch(error => callback(error));
|
|
95
104
|
});
|
|
96
105
|
|
|
106
|
+
// GET TARGET TEMPERATURE
|
|
97
107
|
this.service.getCharacteristic(this.Characteristic.TargetTemperature)
|
|
98
108
|
.on('get', (callback) => {
|
|
99
|
-
this.log.debug('
|
|
100
|
-
this.
|
|
101
|
-
.then(
|
|
102
|
-
|
|
103
|
-
})
|
|
104
|
-
.catch(error => {
|
|
105
|
-
this.log.error('Error during current temperature fetch', error);
|
|
106
|
-
callback(error);
|
|
107
|
-
});
|
|
109
|
+
this.log.debug('Get TargetTemperature');
|
|
110
|
+
this.requestThermostatState()
|
|
111
|
+
.then(thermostatState => callback(null, thermostatState.targetTemperature))
|
|
112
|
+
.catch(error => callback(error));
|
|
108
113
|
})
|
|
109
114
|
.on('set', (value, callback) => {
|
|
110
|
-
this.log.debug('
|
|
115
|
+
this.log.debug('Set TargetTemperature:', value);
|
|
111
116
|
this.requestTemperatureChange(value as number)
|
|
112
117
|
.then(() => callback(null))
|
|
113
118
|
.catch(error => callback(error));
|
|
@@ -124,13 +129,7 @@ export class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
124
129
|
})
|
|
125
130
|
.on('set', (value, callback) => {
|
|
126
131
|
});
|
|
127
|
-
|
|
128
|
-
setInterval(() => {
|
|
129
|
-
this.clearCache();
|
|
130
|
-
}, 5000);
|
|
131
|
-
|
|
132
|
-
this.log.debug('Verano accessory plugin initialized');
|
|
133
|
-
this.requestAuthorization();
|
|
132
|
+
this.log.info('Verano accessory plugin initialized');
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
identify?(): void {
|
|
@@ -148,30 +147,28 @@ export class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
148
147
|
return [];
|
|
149
148
|
}
|
|
150
149
|
|
|
151
|
-
private async
|
|
152
|
-
const tiles = await this.fetchDataTiles()
|
|
153
|
-
const foundTile = tiles.filter(tile => tile.id === 58)[0]
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
private clearCache() {
|
|
164
|
-
|
|
165
|
-
this.cachedState = null;
|
|
150
|
+
private async requestThermostatState() {
|
|
151
|
+
const tiles = await this.fetchDataTiles();
|
|
152
|
+
const foundTile = tiles.filter(tile => tile.id === 58)[0];
|
|
153
|
+
const targetTemperature = foundTile.params.widget1.value / this.TEMPERATURE_DIVIDER;
|
|
154
|
+
const currentTemperature = foundTile.params.widget2.value / this.TEMPERATURE_DIVIDER;
|
|
155
|
+
this.thermostatState = {
|
|
156
|
+
currentTemperature: currentTemperature,
|
|
157
|
+
targetTemperature: targetTemperature,
|
|
158
|
+
heating: targetTemperature > this.TURN_ON_OFF_TEMPERATURE
|
|
159
|
+
};
|
|
160
|
+
return this.thermostatState;
|
|
166
161
|
}
|
|
167
162
|
|
|
168
163
|
private async fetchDataTiles() {
|
|
169
|
-
this.log.info('Fetching data tiles');
|
|
170
164
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
const currentTime = new Date().getTime();
|
|
166
|
+
if (this.lastFetchTime > 0 && currentTime - this.lastFetchTime < 2500) {
|
|
167
|
+
this.log.debug('Returning cached thermostat state', this.thermostatState);
|
|
168
|
+
return this.thermostatState;
|
|
174
169
|
}
|
|
170
|
+
this.log.debug('Fetching data tiles...');
|
|
171
|
+
this.lastFetchTime = currentTime;
|
|
175
172
|
|
|
176
173
|
if (!this.isAuthorized) {
|
|
177
174
|
this.log.error('Not authorized, cannot get tiles, trying to authorize');
|
|
@@ -182,14 +179,14 @@ export class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
182
179
|
headers: {
|
|
183
180
|
'Cookie': this.sessionCookie
|
|
184
181
|
},
|
|
185
|
-
withCredentials: true
|
|
182
|
+
withCredentials: true,
|
|
186
183
|
};
|
|
187
184
|
return axios
|
|
188
185
|
.get('https://emodul.pl/frontend/module_data', config)
|
|
189
186
|
.then(response => {
|
|
190
187
|
const tiles = response.data.tiles;
|
|
191
|
-
this.log.
|
|
192
|
-
this.
|
|
188
|
+
this.log.debug("Fetched", tiles.length, "data tiles");
|
|
189
|
+
this.log.debug(tiles);
|
|
193
190
|
return tiles;
|
|
194
191
|
}).catch(error => {
|
|
195
192
|
this.log.error("Error during tiles fetch", error);
|
|
@@ -209,21 +206,22 @@ export class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
209
206
|
return axios
|
|
210
207
|
.post('https://emodul.pl/login', requestBody)
|
|
211
208
|
.then(loginResponse => {
|
|
212
|
-
this.log.info('Successfully authorized');
|
|
209
|
+
this.log.info('Successfully authorized', requestBody.username);
|
|
213
210
|
const cookies = loginResponse.headers['set-cookie'];
|
|
214
211
|
this.sessionCookie = cookies.filter(cookie => cookie.includes('session'))[0];
|
|
215
212
|
this.isAuthorized = true;
|
|
216
213
|
return loginResponse;
|
|
217
214
|
})
|
|
218
215
|
.catch(error => {
|
|
219
|
-
this.log.error("Error during authorization", error);
|
|
216
|
+
this.log.error("Error during authorization", requestBody.username, error);
|
|
220
217
|
this.isAuthorized = false;
|
|
221
218
|
throw error;
|
|
222
219
|
});
|
|
223
220
|
}
|
|
224
221
|
|
|
225
222
|
private async requestTemperatureChange(targetTemperature: number) {
|
|
226
|
-
this.log.info('Changing temperature to', targetTemperature);
|
|
223
|
+
this.log.info('Changing temperature to', targetTemperature + '°C');
|
|
224
|
+
this.lastFetchTime = -1;
|
|
227
225
|
const requestBody = [
|
|
228
226
|
{
|
|
229
227
|
ido: 139,
|
|
@@ -240,7 +238,7 @@ export class VeranoAccessoryPlugin implements AccessoryPlugin {
|
|
|
240
238
|
return axios
|
|
241
239
|
.post('https://emodul.pl/send_control_data', requestBody, config)
|
|
242
240
|
.then(response => {
|
|
243
|
-
this.log.info('Successfully changed temperature');
|
|
241
|
+
this.log.info('Successfully changed temperature to', targetTemperature + '°C');
|
|
244
242
|
return response?.data;
|
|
245
243
|
})
|
|
246
244
|
.catch(error => {
|