@lv426/homebridge-systemair-enhanced 1.0.0 → 1.0.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/index.js +39 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -88,9 +88,21 @@ class SystemairVentilator {
|
|
|
88
88
|
.setProps({
|
|
89
89
|
minValue: 10,
|
|
90
90
|
maxValue: 38,
|
|
91
|
-
minStep:
|
|
91
|
+
minStep: 1,
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
+
this.thermostatService
|
|
95
|
+
.getCharacteristic(Characteristic.TargetHeatingCoolingState)
|
|
96
|
+
.onGet(this.getTargetHeatingCoolingState.bind(this))
|
|
97
|
+
.onSet(this.setTargetHeatingCoolingState.bind(this))
|
|
98
|
+
.setProps({
|
|
99
|
+
validValues: [0, 3], // Only OFF and AUTO modes supported
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
this.thermostatService
|
|
103
|
+
.getCharacteristic(Characteristic.CurrentHeatingCoolingState)
|
|
104
|
+
.onGet(this.getCurrentHeatingCoolingState.bind(this));
|
|
105
|
+
|
|
94
106
|
// Humidity sensor characteristic
|
|
95
107
|
this.humiditySensorService
|
|
96
108
|
.getCharacteristic(Characteristic.CurrentRelativeHumidity)
|
|
@@ -204,10 +216,10 @@ class SystemairVentilator {
|
|
|
204
216
|
this.log(`getCurrentTemperature: Fetching from ${url}`);
|
|
205
217
|
try {
|
|
206
218
|
const response = await this.retryRequest(url);
|
|
207
|
-
let temperature = response.data[this.PARAM_IDS.CURRENT_TEMP] || 20; // Default to 20°C if no data
|
|
219
|
+
let temperature = response.data[this.PARAM_IDS.CURRENT_TEMP] / 10 || 20; // Default to 20°C if no data
|
|
208
220
|
|
|
209
|
-
// Ensure temperature is within HomeKit range (
|
|
210
|
-
temperature = Math.max(
|
|
221
|
+
// Ensure temperature is within HomeKit range (10 to 38°C)
|
|
222
|
+
temperature = Math.max(10, Math.min(38, temperature));
|
|
211
223
|
|
|
212
224
|
this.log(
|
|
213
225
|
`getCurrentTemperature: Current temperature is ${temperature}°C`
|
|
@@ -224,7 +236,7 @@ class SystemairVentilator {
|
|
|
224
236
|
this.log(`getTargetTemperature: Fetching from ${url}`);
|
|
225
237
|
try {
|
|
226
238
|
const response = await this.retryRequest(url);
|
|
227
|
-
let temperature = response.data[this.PARAM_IDS.TARGET_TEMP] || 20; // Default to 20°C if no data
|
|
239
|
+
let temperature = response.data[this.PARAM_IDS.TARGET_TEMP] / 10 || 20; // Default to 20°C if no data
|
|
228
240
|
|
|
229
241
|
// Ensure temperature is within HomeKit target range (10-38°C)
|
|
230
242
|
temperature = Math.max(10, Math.min(38, temperature));
|
|
@@ -241,7 +253,9 @@ class SystemairVentilator {
|
|
|
241
253
|
// Ensure the value is within valid range
|
|
242
254
|
value = Math.max(10, Math.min(38, value));
|
|
243
255
|
|
|
244
|
-
const url = `http://${this.config.ip}/mwrite?{"${
|
|
256
|
+
const url = `http://${this.config.ip}/mwrite?{"${
|
|
257
|
+
this.PARAM_IDS.TARGET_TEMP
|
|
258
|
+
}":${value * 10}}`;
|
|
245
259
|
this.log(`setTargetTemperature: Setting target temperature to ${value}°C`);
|
|
246
260
|
try {
|
|
247
261
|
await this.retryRequest(url);
|
|
@@ -251,6 +265,25 @@ class SystemairVentilator {
|
|
|
251
265
|
}
|
|
252
266
|
}
|
|
253
267
|
|
|
268
|
+
async getCurrentHeatingCoolingState() {
|
|
269
|
+
// Always return Auto
|
|
270
|
+
return 3;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
async getTargetHeatingCoolingState() {
|
|
274
|
+
// Always return Auto
|
|
275
|
+
return 3;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async setTargetHeatingCoolingState(value) {
|
|
279
|
+
// Always set to Auto
|
|
280
|
+
if (value === 0) {
|
|
281
|
+
await this.setActive(0); // Turn off the fan
|
|
282
|
+
} else {
|
|
283
|
+
await this.setActive(1); // Turn on the fan
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
254
287
|
// Humidity sensor method
|
|
255
288
|
async getCurrentRelativeHumidity() {
|
|
256
289
|
const url = `http://${this.config.ip}/mread?{"${this.PARAM_IDS.HUMIDITY}":1}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lv426/homebridge-systemair-enhanced",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "An enhanced Homebridge plugin for controlling SystemAir Ventilators, which includes Temperature controls and Humidity readings",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|