@lv426/homebridge-systemair-enhanced 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/index.js +13 -36
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -22,7 +22,6 @@ class SystemairVentilator {
22
22
  // These may need adjustment based on your specific device model
23
23
  this.PARAM_IDS = {
24
24
  FAN_SPEED: '1130', // Fan speed control (0=off, 2=low, 3=medium, 4=high)
25
- TIMER: '1110', // Timer remaining time
26
25
  CURRENT_TEMP: '12543', // Current temperature sensor reading
27
26
  TARGET_TEMP: '2000', // Target temperature setting
28
27
  HUMIDITY: '12135', // Current humidity sensor reading
@@ -38,9 +37,6 @@ class SystemairVentilator {
38
37
  // Refresh service
39
38
  this.refreshService = new Service.Switch(this.config.name + ' Refresh');
40
39
 
41
- // Timer service (using BatteryService instead of LightSensor)
42
- this.timerService = new Service.BatteryService(this.config.name + ' Timer');
43
-
44
40
  // Thermostat service
45
41
  this.thermostatService = new Service.Thermostat(
46
42
  this.config.name + ' Thermostat'
@@ -71,11 +67,6 @@ class SystemairVentilator {
71
67
  .getCharacteristic(Characteristic.On)
72
68
  .onSet(this.setRefresh.bind(this));
73
69
 
74
- // Timer characteristic (using Battery Level to store remaining time)
75
- this.timerService
76
- .getCharacteristic(Characteristic.BatteryLevel)
77
- .onGet(this.getTimer.bind(this));
78
-
79
70
  // Thermostat characteristics
80
71
  this.thermostatService
81
72
  .getCharacteristic(Characteristic.CurrentTemperature)
@@ -188,28 +179,6 @@ class SystemairVentilator {
188
179
  }
189
180
  }
190
181
 
191
- async getTimer() {
192
- const url = `http://${this.config.ip}/mread?{"${this.PARAM_IDS.TIMER}":2}`;
193
- this.log(`Timer: Fetching timer value from ${url}`);
194
- try {
195
- const response = await this.retryRequest(url);
196
- let timerValue = response.data[this.PARAM_IDS.TIMER]; // Extract timer value
197
-
198
- // Ensure timer value is valid for HomeKit (0 - 100% battery level range)
199
- if (timerValue < 0) {
200
- timerValue = 0;
201
- } else if (timerValue > 100) {
202
- timerValue = 100; // Max HomeKit battery level
203
- }
204
-
205
- this.log(`Timer: Current remaining time is ${timerValue} minutes.`);
206
- return timerValue; // Return valid percentage
207
- } catch (error) {
208
- this.log(`Timer: Error - ${error.message}`);
209
- return 0; // Default to 0% if an error occurs
210
- }
211
- }
212
-
213
182
  // Thermostat methods
214
183
  async getCurrentTemperature() {
215
184
  const url = `http://${this.config.ip}/mread?{"${this.PARAM_IDS.CURRENT_TEMP}":1}`;
@@ -267,16 +236,25 @@ class SystemairVentilator {
267
236
 
268
237
  async getCurrentHeatingCoolingState() {
269
238
  // Always return Auto
270
- return 3;
239
+ const targetTemperature = await this.getTargetTemperature();
240
+ const currentTemperature = await this.getCurrentTemperature();
241
+
242
+ if (!targetTemperature) {
243
+ return 0; // Off
244
+ }
245
+
246
+ if (currentTemperature < targetTemperature) {
247
+ return 1; // Heating
248
+ } else {
249
+ return 2; // Cooling
250
+ }
271
251
  }
272
252
 
273
253
  async getTargetHeatingCoolingState() {
274
- // Always return Auto
275
- return 3;
254
+ return this.getCurrentHeatingCoolingState();
276
255
  }
277
256
 
278
257
  async setTargetHeatingCoolingState(value) {
279
- // Always set to Auto
280
258
  if (value === 0) {
281
259
  await this.setActive(0); // Turn off the fan
282
260
  } else {
@@ -307,7 +285,6 @@ class SystemairVentilator {
307
285
  return [
308
286
  this.fanService,
309
287
  this.refreshService,
310
- this.timerService,
311
288
  this.thermostatService,
312
289
  this.humiditySensorService,
313
290
  ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lv426/homebridge-systemair-enhanced",
3
- "version": "1.0.1",
4
- "description": "An enhanced Homebridge plugin for controlling SystemAir Ventilators, which includes Temperature controls and Humidity readings",
3
+ "version": "1.0.2",
4
+ "description": "An enhanced Homebridge plugin for controlling Systemair Ventilators.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"