@homebridge-plugins/homebridge-tado 8.1.2 → 8.2.0

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v8.2.0 - 2025-10-23
4
+ - Query all zone states in a single API request to significantly reduce the number of API calls to tado during polling
5
+ - Update zone state after clearing a zone overlay
6
+ - Skip getRunningTime call when a custom URL is used and remove obsolete getWeatherAirComfort (#176)
7
+ - Add example for tadoApiUrl in config (#176)
8
+
3
9
  ## v8.1.2 - 2025-10-20
4
10
  - Fix: Skip auth also for config endpoints if enabled (#176)
5
11
 
@@ -557,7 +557,7 @@
557
557
  "tadoApiUrl": {
558
558
  "title": "Tado API URL",
559
559
  "type": "string",
560
- "description": "Optional: Use a custom tado api url."
560
+ "description": "Optional: Use a custom tado api url (e.g. http://localhost:8080)."
561
561
  },
562
562
  "skipAuth": {
563
563
  "title": "Skip Authentication",
@@ -549,7 +549,7 @@ const schema = {
549
549
  'tadoApiUrl': {
550
550
  'title': 'Tado API URL',
551
551
  'type': 'string',
552
- 'description': 'Optional: Use a custom tado api url.'
552
+ 'description': 'Optional: Use a custom tado api url (e.g. http://localhost:8080).'
553
553
  },
554
554
  'skipAuth': {
555
555
  'title': 'Skip Authentication',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebridge-plugins/homebridge-tado",
3
- "version": "8.1.2",
3
+ "version": "8.2.0",
4
4
  "description": "Homebridge plugin for controlling tado° devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -40,8 +40,8 @@
40
40
  "moment": "^2.30.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@babel/core": "7.28.4",
44
- "@babel/eslint-parser": "7.28.4",
43
+ "@babel/core": "7.28.5",
44
+ "@babel/eslint-parser": "7.28.5",
45
45
  "@babel/eslint-plugin": "7.27.1",
46
46
  "@eslint/js": "^9.38.0",
47
47
  "eslint": "^9.38.0",
@@ -110,6 +110,7 @@ export default (api, accessories, config, tado, telegram) => {
110
110
  accessory.context.config.subtype.includes('heatercooler'))
111
111
  ) {
112
112
  await tado.clearZoneOverlay(config.homeId, accessory.context.config.zoneId);
113
+ await updateZones(accessory.context.config.zoneId);
113
114
  return;
114
115
  }
115
116
 
@@ -170,6 +171,7 @@ export default (api, accessories, config, tado, telegram) => {
170
171
  accessory.context.config.subtype.includes('heatercooler'))
171
172
  ) {
172
173
  await tado.clearZoneOverlay(config.homeId, accessory.context.config.zoneId);
174
+ await updateZones(accessory.context.config.zoneId);
173
175
  return;
174
176
  }
175
177
 
@@ -770,8 +772,8 @@ export default (api, accessories, config, tado, telegram) => {
770
772
  return;
771
773
  }
772
774
 
773
- async function updateZones() {
774
- if (!settingState) {
775
+ async function updateZones(idToUpdate) {
776
+ if (!settingState || idToUpdate !== undefined) {
775
777
  Logger.debug('Polling Zones...', config.homeName);
776
778
 
777
779
  //CentralSwitch
@@ -821,8 +823,18 @@ export default (api, accessories, config, tado, telegram) => {
821
823
  });
822
824
  }
823
825
 
824
- for (const zone of config.zones) {
825
- const zoneState = await tado.getZoneState(config.homeId, zone.id);
826
+ let zoneStates = {};
827
+ let zonesToUpdate = [];
828
+ if (idToUpdate !== undefined) {
829
+ zoneStates[idToUpdate] = await tado.getZoneState(config.homeId, idToUpdate);
830
+ zonesToUpdate = config.zones.filter(zone => zone.id === idToUpdate);
831
+ } else {
832
+ zoneStates = (await tado.getZoneStates(config.homeId))["zoneStates"];
833
+ zonesToUpdate = config.zones;
834
+ }
835
+
836
+ for (const zone of zonesToUpdate) {
837
+ const zoneState = zoneStates[zone.id];
826
838
 
827
839
  let currentState, targetState, currentTemp, targetTemp, humidity, active, battery, tempEqual;
828
840
 
@@ -10,6 +10,7 @@ const tado_client_id = "1bb50063-6b0c-4d11-bd99-387f4a91cc46";
10
10
  export default class Tado {
11
11
  constructor(name, config, storagePath, tadoApiUrl, skipAuth) {
12
12
  this.tadoApiUrl = tadoApiUrl || tado_url;
13
+ this.customTadoApiUrlActive = !!tadoApiUrl;
13
14
  this.skipAuth = skipAuth?.toString() === "true";
14
15
  this.name = name;
15
16
  const usesExternalTokenFile = config.username?.toLowerCase().endsWith(".json");
@@ -308,6 +309,10 @@ export default class Tado {
308
309
  return this.apiCall(`/api/v2/homes/${home_id}/zones/${zone_id}/state`);
309
310
  }
310
311
 
312
+ async getZoneStates(home_id) {
313
+ return this.apiCall(`/api/v2/homes/${home_id}/zoneStates`);
314
+ }
315
+
311
316
  async getZoneCapabilities(home_id, zone_id) {
312
317
  return this.apiCall(`/api/v2/homes/${home_id}/zones/${zone_id}/capabilities`);
313
318
  }
@@ -543,20 +548,6 @@ export default class Tado {
543
548
  return this.apiCall(`/api/v2/homes/${home_id}/airComfort`);
544
549
  }
545
550
 
546
- async getWeatherAirComfort(home_id, longitude, latitude) {
547
- let geoLocation = {
548
- longitude: longitude,
549
- latitude: latitude,
550
- };
551
-
552
- if (!geoLocation.longitude || !geoLocation.latitude) {
553
- const data = await this.getHome(home_id);
554
- geoLocation = data.geolocation;
555
- }
556
-
557
- return this.apiCall(`/v1/homes/${home_id}/airComfort`, 'GET', {}, geoLocation, 'https://acme.tado.com');
558
- }
559
-
560
551
  async setChildLock(serialNumber, state) {
561
552
  if (!serialNumber) {
562
553
  throw new Error('Cannot change child lock state. No serialNumber is given.');
@@ -614,6 +605,8 @@ export default class Tado {
614
605
  }
615
606
 
616
607
  async getRunningTime(home_id, time, from, to) {
608
+ if (this.customTadoApiUrlActive) return;
609
+
617
610
  const period = {
618
611
  aggregate: time || 'day',
619
612
  summary_only: true,
@@ -623,6 +616,6 @@ export default class Tado {
623
616
 
624
617
  if (to) period.to = to;
625
618
 
626
- return this.apiCall(`/v1/homes/${home_id}/runningTimes`, 'GET', {}, period, 'https://minder.tado.com', false);
619
+ return this.apiCall(`/v1/homes/${home_id}/runningTimes`, 'GET', {}, period, 'https://minder.tado.com');
627
620
  }
628
621
  }