homebridge-ac-freedom 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.
- package/package.json +1 -1
- package/src/ac-accessory.js +22 -6
package/package.json
CHANGED
package/src/ac-accessory.js
CHANGED
|
@@ -66,6 +66,7 @@ class AcFreedomAccessory {
|
|
|
66
66
|
|
|
67
67
|
this.setupAccessoryInfo();
|
|
68
68
|
this.setupHeaterCooler();
|
|
69
|
+
this.reorderLinkedServices();
|
|
69
70
|
this.setupFanService();
|
|
70
71
|
this.setupPresetSwitches();
|
|
71
72
|
this.setupDisplaySwitch();
|
|
@@ -178,12 +179,29 @@ class AcFreedomAccessory {
|
|
|
178
179
|
});
|
|
179
180
|
}
|
|
180
181
|
|
|
182
|
+
// ── Reorder linked services ───────────────────────────────────
|
|
183
|
+
// Remove cached linked services from the accessory so they are
|
|
184
|
+
// re-added in the correct display order: Fan → Presets → Display.
|
|
185
|
+
reorderLinkedServices() {
|
|
186
|
+
const ids = [
|
|
187
|
+
{ type: this.Service.Fanv2, subtype: 'fan' },
|
|
188
|
+
{ type: this.Service.Switch, subtype: 'sleep' },
|
|
189
|
+
{ type: this.Service.Switch, subtype: 'health' },
|
|
190
|
+
{ type: this.Service.Switch, subtype: 'eco' },
|
|
191
|
+
{ type: this.Service.Switch, subtype: 'clean' },
|
|
192
|
+
{ type: this.Service.Switch, subtype: 'display' },
|
|
193
|
+
];
|
|
194
|
+
for (const { type, subtype } of ids) {
|
|
195
|
+
const svc = this.accessory.getServiceById(type, subtype);
|
|
196
|
+
if (svc) this.accessory.removeService(svc);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
181
200
|
// ── Fan Service (linked to HeaterCooler) ────────────────────────
|
|
182
201
|
setupFanService() {
|
|
183
202
|
const C = this.Characteristic;
|
|
184
203
|
|
|
185
|
-
this.fanService = this.accessory.
|
|
186
|
-
|| this.accessory.addService(this.Service.Fanv2, 'Fan', 'fan');
|
|
204
|
+
this.fanService = this.accessory.addService(this.Service.Fanv2, 'Fan', 'fan');
|
|
187
205
|
|
|
188
206
|
// Fan Active follows AC power
|
|
189
207
|
this.fanService.getCharacteristic(C.Active)
|
|
@@ -220,8 +238,7 @@ class AcFreedomAccessory {
|
|
|
220
238
|
continue;
|
|
221
239
|
}
|
|
222
240
|
|
|
223
|
-
const switchService = this.accessory.
|
|
224
|
-
|| this.accessory.addService(this.Service.Switch, cfg.label, key);
|
|
241
|
+
const switchService = this.accessory.addService(this.Service.Switch, cfg.label, key);
|
|
225
242
|
|
|
226
243
|
switchService.setCharacteristic(this.Characteristic.Name, cfg.label);
|
|
227
244
|
|
|
@@ -262,8 +279,7 @@ class AcFreedomAccessory {
|
|
|
262
279
|
return;
|
|
263
280
|
}
|
|
264
281
|
|
|
265
|
-
this.displaySwitch = this.accessory.
|
|
266
|
-
|| this.accessory.addService(this.Service.Switch, 'Display', 'display');
|
|
282
|
+
this.displaySwitch = this.accessory.addService(this.Service.Switch, 'Display', 'display');
|
|
267
283
|
|
|
268
284
|
this.displaySwitch.setCharacteristic(this.Characteristic.Name, 'Display');
|
|
269
285
|
|