@lv426/homebridge-systemair-enhanced 1.0.4 → 1.0.5

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 +35 -15
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -33,24 +33,44 @@ class SystemairVentilator {
33
33
  timeout: 20000, // 20 seconds timeout
34
34
  });
35
35
 
36
- // Fan service
37
- this.fanService = new Service.Fanv2(this.config.name + ' Fan');
38
-
39
- // Refresh service
40
- this.refreshService = new Service.Switch(this.config.name + ' Refresh');
36
+ // FAN
37
+ this.fanService =
38
+ this.accessory.getService(Service.Fanv2) ??
39
+ this.accessory.addService(Service.Fanv2, `${this.config.name} Fan`);
40
+
41
+ // REFRESH (Switch #1) — add subtype "refresh"
42
+ this.refreshService =
43
+ this.accessory.getServiceById(Service.Switch, 'refresh') ??
44
+ this.accessory.addService(
45
+ Service.Switch,
46
+ `${this.config.name} Refresh`,
47
+ 'refresh'
48
+ );
41
49
 
42
- // Refresh service
43
- this.ecoModeService = new Service.Switch(this.config.name + ' Eco Mode');
50
+ // ECO MODE (Switch #2) — add subtype "eco"
51
+ this.ecoModeService =
52
+ this.accessory.getServiceById(Service.Switch, 'eco') ??
53
+ this.accessory.addService(
54
+ Service.Switch,
55
+ `${this.config.name} Eco Mode`,
56
+ 'eco'
57
+ );
44
58
 
45
- // Thermostat service
46
- this.thermostatService = new Service.Thermostat(
47
- this.config.name + ' Thermostat'
48
- );
59
+ // THERMOSTAT
60
+ this.thermostatService =
61
+ this.accessory.getService(Service.Thermostat) ??
62
+ this.accessory.addService(
63
+ Service.Thermostat,
64
+ `${this.config.name} Thermostat`
65
+ );
49
66
 
50
- // Humidity sensor service
51
- this.humiditySensorService = new Service.HumiditySensor(
52
- this.config.name + ' Humidity'
53
- );
67
+ // HUMIDITY SENSOR
68
+ this.humiditySensorService =
69
+ this.accessory.getService(Service.HumiditySensor) ??
70
+ this.accessory.addService(
71
+ Service.HumiditySensor,
72
+ `${this.config.name} Humidity`
73
+ );
54
74
 
55
75
  this.setupCharacteristics();
56
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lv426/homebridge-systemair-enhanced",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "An enhanced Homebridge plugin for controlling Systemair Ventilators.",
5
5
  "main": "index.js",
6
6
  "scripts": {