@homebridge-plugins/homebridge-tado 8.5.0 → 8.5.1-beta.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/CHANGELOG.md +3 -0
- package/package.json +2 -2
- package/src/helper/handler.js +27 -33
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homebridge-plugins/homebridge-tado",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.1-beta.1",
|
|
4
4
|
"description": "Homebridge plugin for controlling tado° devices.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -51,4 +51,4 @@
|
|
|
51
51
|
"globals": "^16.4.0",
|
|
52
52
|
"prettier": "^3.6.2"
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|
package/src/helper/handler.js
CHANGED
|
@@ -27,7 +27,6 @@ export default (api, accessories, config, tado, telegram) => {
|
|
|
27
27
|
|
|
28
28
|
async function setStates(accessory, accs, target, value) {
|
|
29
29
|
let zoneUpdated = false;
|
|
30
|
-
let allZonesUpdated = false;
|
|
31
30
|
|
|
32
31
|
accessories = accs.filter((acc) => acc && acc.context.config.homeName === config.homeName);
|
|
33
32
|
|
|
@@ -376,7 +375,6 @@ export default (api, accessories, config, tado, telegram) => {
|
|
|
376
375
|
}
|
|
377
376
|
}
|
|
378
377
|
|
|
379
|
-
allZonesUpdated = true;
|
|
380
378
|
await tado.setPresenceLock(config.homeId, targetState);
|
|
381
379
|
|
|
382
380
|
break;
|
|
@@ -428,7 +426,6 @@ export default (api, accessories, config, tado, telegram) => {
|
|
|
428
426
|
})
|
|
429
427
|
.filter((id) => id);
|
|
430
428
|
|
|
431
|
-
allZonesUpdated = true;
|
|
432
429
|
await tado.resumeShedule(config.homeId, roomIds);
|
|
433
430
|
|
|
434
431
|
//Turn all back to AUTO/ON
|
|
@@ -553,7 +550,6 @@ export default (api, accessories, config, tado, telegram) => {
|
|
|
553
550
|
.updateValue(false);
|
|
554
551
|
}
|
|
555
552
|
|
|
556
|
-
allZonesUpdated = true;
|
|
557
553
|
await tado.switchAll(config.homeId, rooms);
|
|
558
554
|
|
|
559
555
|
break;
|
|
@@ -570,7 +566,7 @@ export default (api, accessories, config, tado, telegram) => {
|
|
|
570
566
|
errorHandler(err);
|
|
571
567
|
} finally {
|
|
572
568
|
//always update zone to set correct state in Apple Home
|
|
573
|
-
if (zoneUpdated
|
|
569
|
+
if (zoneUpdated) await updateZones(accessory.context.config.zoneId);
|
|
574
570
|
settingState = false;
|
|
575
571
|
}
|
|
576
572
|
}
|
|
@@ -875,36 +871,34 @@ export default (api, accessories, config, tado, telegram) => {
|
|
|
875
871
|
}
|
|
876
872
|
}
|
|
877
873
|
|
|
878
|
-
|
|
879
|
-
const allZones = (await tado.getZones(config.homeId)) || [];
|
|
874
|
+
const allZones = (await tado.getZones(config.homeId)) || [];
|
|
880
875
|
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
876
|
+
for (const [index, zone] of config.zones.entries()) {
|
|
877
|
+
allZones.forEach((zoneWithID) => {
|
|
878
|
+
if (zoneWithID.name === zone.name) {
|
|
879
|
+
const heatAccessory = accessories.filter(
|
|
880
|
+
(acc) => acc && acc.displayName === config.homeName + ' ' + zone.name + ' Heater'
|
|
881
|
+
);
|
|
887
882
|
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
}
|
|
883
|
+
if (heatAccessory.length) heatAccessory[0].context.config.zoneId = zoneWithID.id;
|
|
884
|
+
|
|
885
|
+
config.zones[index].id = zoneWithID.id;
|
|
886
|
+
config.zones[index].battery = !config.zones[index].noBattery
|
|
887
|
+
? zoneWithID.devices.filter(
|
|
888
|
+
(device) =>
|
|
889
|
+
device &&
|
|
890
|
+
(zone.type === 'HEATING' || zone.type === 'AIR_CONDITIONING') &&
|
|
891
|
+
typeof device.batteryState === 'string' &&
|
|
892
|
+
!device.batteryState.includes('NORMAL')
|
|
893
|
+
).length
|
|
894
|
+
? zoneWithID.devices.filter((device) => device && !device.batteryState.includes('NORMAL'))[0]
|
|
895
|
+
.batteryState
|
|
896
|
+
: zoneWithID.devices.filter((device) => device && device.duties.includes('ZONE_LEADER'))[0].batteryState
|
|
897
|
+
: false;
|
|
898
|
+
config.zones[index].openWindowEnabled =
|
|
899
|
+
zoneWithID.openWindowDetection && zoneWithID.openWindowDetection.enabled ? true : false;
|
|
900
|
+
}
|
|
901
|
+
});
|
|
908
902
|
}
|
|
909
903
|
|
|
910
904
|
let zonesToUpdate = [];
|