@lv426/homebridge-systemair-enhanced 1.0.3 → 1.0.4
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/index.js +35 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -25,6 +25,8 @@ class SystemairVentilator {
|
|
|
25
25
|
CURRENT_TEMP: '12543', // Current temperature sensor reading
|
|
26
26
|
TARGET_TEMP: '2000', // Target temperature setting
|
|
27
27
|
HUMIDITY: '12135', // Current humidity sensor reading
|
|
28
|
+
ECO_MODE: '2504', // Turning ECO mode on / off
|
|
29
|
+
FREE_COOLING: '4100', // Free Cooling activate / deactivate
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
this.axiosInstance = axios.create({
|
|
@@ -37,6 +39,9 @@ class SystemairVentilator {
|
|
|
37
39
|
// Refresh service
|
|
38
40
|
this.refreshService = new Service.Switch(this.config.name + ' Refresh');
|
|
39
41
|
|
|
42
|
+
// Refresh service
|
|
43
|
+
this.ecoModeService = new Service.Switch(this.config.name + ' Eco Mode');
|
|
44
|
+
|
|
40
45
|
// Thermostat service
|
|
41
46
|
this.thermostatService = new Service.Thermostat(
|
|
42
47
|
this.config.name + ' Thermostat'
|
|
@@ -67,6 +72,12 @@ class SystemairVentilator {
|
|
|
67
72
|
.getCharacteristic(Characteristic.On)
|
|
68
73
|
.onSet(this.setRefresh.bind(this));
|
|
69
74
|
|
|
75
|
+
// Eco Mode characteristic
|
|
76
|
+
this.ecoModeService
|
|
77
|
+
.getCharacteristic(Characteristic.On)
|
|
78
|
+
.onGet(this.getEcoMode.bind(this))
|
|
79
|
+
.onSet(this.setEcoMode.bind(this));
|
|
80
|
+
|
|
70
81
|
// Thermostat characteristics
|
|
71
82
|
this.thermostatService
|
|
72
83
|
.getCharacteristic(Characteristic.CurrentTemperature)
|
|
@@ -179,6 +190,22 @@ class SystemairVentilator {
|
|
|
179
190
|
}
|
|
180
191
|
}
|
|
181
192
|
|
|
193
|
+
async setEcoMode(value) {
|
|
194
|
+
const writeUrl = `http://${this.config.ip}/mwrite?{"${this.PARAM_IDS.ECO_MODE}":${value}}`;
|
|
195
|
+
this.log(`Eco Mode: Sending request to ${writeUrl}`);
|
|
196
|
+
await this.retryRequest(writeUrl);
|
|
197
|
+
this.log(`Eco Mode: Successfully started eco mode.`);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
async getEcoMode() {
|
|
201
|
+
const url = `http://${this.config.ip}/mread?{"${this.PARAM_IDS.ECO_MODE}":1}`;
|
|
202
|
+
this.log(`Eco Mode: Sending request to ${url}`);
|
|
203
|
+
const response = await this.retryRequest(url);
|
|
204
|
+
const isEcoMode = response.data[this.PARAM_IDS.ECO_MODE] > 0;
|
|
205
|
+
this.log(`Eco Mode: Current state is ${isEcoMode ? 'ON' : 'OFF'}`);
|
|
206
|
+
return isEcoMode ? 1 : 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
182
209
|
// Thermostat methods
|
|
183
210
|
async getCurrentTemperature() {
|
|
184
211
|
const url = `http://${this.config.ip}/mread?{"${this.PARAM_IDS.CURRENT_TEMP}":1}`;
|
|
@@ -243,6 +270,12 @@ class SystemairVentilator {
|
|
|
243
270
|
return 0; // Off
|
|
244
271
|
}
|
|
245
272
|
|
|
273
|
+
this.log(
|
|
274
|
+
`Getting Current Heating and Cooling State. Current temperature is ${currentTemperature}°C and target is set to ${targetTemperature}°C - ${
|
|
275
|
+
currentTemperature < targetTemperature ? 'Heating' : 'Cooling'
|
|
276
|
+
} is starting.`
|
|
277
|
+
);
|
|
278
|
+
|
|
246
279
|
if (currentTemperature < targetTemperature) {
|
|
247
280
|
return 1; // Heating
|
|
248
281
|
} else {
|
|
@@ -251,6 +284,7 @@ class SystemairVentilator {
|
|
|
251
284
|
}
|
|
252
285
|
|
|
253
286
|
async getTargetHeatingCoolingState() {
|
|
287
|
+
this.log(`Getting Target Heating and Cooling State`);
|
|
254
288
|
return this.getCurrentHeatingCoolingState();
|
|
255
289
|
}
|
|
256
290
|
|
|
@@ -287,6 +321,7 @@ class SystemairVentilator {
|
|
|
287
321
|
this.refreshService,
|
|
288
322
|
this.thermostatService,
|
|
289
323
|
this.humiditySensorService,
|
|
324
|
+
this.ecoModeService,
|
|
290
325
|
];
|
|
291
326
|
}
|
|
292
327
|
}
|