@homebridge-plugins/homebridge-tado 8.0.0 → 8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## v8.0.1 - 2025-06-12
4
+ - Tado-API: Verify that refresh token is not empty before saving to file
5
+
3
6
  ## v8.0.0 - 2025-06-09
4
7
  - Add support for tado AC devices
5
8
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@homebridge-plugins/homebridge-tado",
3
- "version": "8.0.0",
3
+ "version": "8.0.2",
4
4
  "description": "Homebridge plugin for controlling tado° devices.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "lint": "eslint --fix ."
7
+ "eslint": "eslint --fix ."
8
8
  },
9
9
  "type": "module",
10
10
  "repository": {
@@ -34,21 +34,21 @@
34
34
  "dependencies": {
35
35
  "@homebridge/plugin-ui-utils": "^2.1.0",
36
36
  "fakegato-history": "^0.6.7",
37
- "form-data": "^4.0.3",
37
+ "form-data": "^4.0.4",
38
38
  "fs-extra": "^11.3.0",
39
39
  "got": "^14.4.7",
40
40
  "moment": "^2.30.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@babel/core": "7.27.4",
44
- "@babel/eslint-parser": "7.27.5",
43
+ "@babel/core": "7.28.0",
44
+ "@babel/eslint-parser": "7.28.0",
45
45
  "@babel/eslint-plugin": "7.27.1",
46
- "@eslint/js": "^9.28.0",
47
- "eslint": "^9.28.0",
48
- "eslint-config-prettier": "^10.1.5",
49
- "eslint-plugin-import": "^2.31.0",
50
- "eslint-plugin-prettier": "^5.4.1",
51
- "globals": "^16.2.0",
52
- "prettier": "^3.5.3"
46
+ "@eslint/js": "^9.31.0",
47
+ "eslint": "^9.31.0",
48
+ "eslint-config-prettier": "^10.1.8",
49
+ "eslint-plugin-import": "^2.32.0",
50
+ "eslint-plugin-prettier": "^5.5.3",
51
+ "globals": "^16.3.0",
52
+ "prettier": "^3.6.2"
53
53
  }
54
54
  }
@@ -93,7 +93,7 @@ export default class Tado {
93
93
  responseType: "json"
94
94
  });
95
95
  const { access_token, refresh_token } = response.body;
96
- if (!access_token) throw new Error("Empty access token.");
96
+ if (!access_token || !refresh_token) throw new Error("Empty access/refresh token.");
97
97
  await fs.writeFile(this._tadoInternalTokenFilePath, JSON.stringify({ access_token, refresh_token }));
98
98
  this._tadoBearerToken = { access_token, refresh_token, timestamp: Date.now() };
99
99
  } catch (error) {
@@ -133,7 +133,7 @@ export default class Tado {
133
133
  }
134
134
  if (tokenResponse?.body) {
135
135
  const { access_token, refresh_token } = tokenResponse.body;
136
- if (access_token) {
136
+ if (access_token && refresh_token) {
137
137
  await fs.writeFile(this._tadoInternalTokenFilePath, JSON.stringify({ access_token, refresh_token }));
138
138
  this._tadoBearerToken = { access_token, refresh_token, timestamp: Date.now() };
139
139
  Logger.info("Authentication successful!");
@@ -165,7 +165,7 @@ export default class Tado {
165
165
  throw new Error(`Failed to load from external file after ${maxRetries} attempts.`);
166
166
  }
167
167
 
168
- async apiCall(path, method = 'GET', data = {}, params = {}, tado_url_dif, blockLog) {
168
+ async apiCall(path, method = 'GET', data = {}, params = {}, tado_url_dif) {
169
169
  Logger.debug('Get access token...', this.name);
170
170
  const access_token = await this.getToken();
171
171
 
@@ -380,7 +380,7 @@ export default class Tado {
380
380
 
381
381
  async setACZoneOverlay(home_id, zone_id, power, mode, temperature, fanSpeed, swing, termination, tempUnit) {
382
382
  // Note: fanSpeed parameter is kept for compatibility but ignored for AIR_CONDITIONING units
383
-
383
+
384
384
  // Get current zone state to understand the structure
385
385
  let zone_state;
386
386
  try {
@@ -388,7 +388,7 @@ export default class Tado {
388
388
  } catch (error) {
389
389
  Logger.warn(`Could not get zone state: ${error.message}`, this.name);
390
390
  }
391
-
391
+
392
392
  // Preserve existing termination settings if present
393
393
  const config = {
394
394
  setting: zone_state && zone_state.setting ? { ...zone_state.setting } : {},
@@ -404,8 +404,8 @@ export default class Tado {
404
404
  if (tempUnit && tempUnit.toLowerCase() === 'fahrenheit') {
405
405
  temperature = ((temperature - 32) * 5) / 9;
406
406
  }
407
-
408
- config.setting.temperature = {
407
+
408
+ config.setting.temperature = {
409
409
  celsius: temperature,
410
410
  fahrenheit: Math.round((temperature * 1.8) + 32)
411
411
  };
@@ -433,7 +433,7 @@ export default class Tado {
433
433
  } else {
434
434
  config.termination.type = 'MANUAL';
435
435
  }
436
-
436
+
437
437
  // Validate that config is not empty before making API call
438
438
  if (!config.setting || Object.keys(config.setting).length === 0) {
439
439
  Logger.error(`Config setting is empty! Power: ${power}, Mode: ${mode}, Temp: ${temperature}`, this.name);
@@ -461,7 +461,7 @@ export default class Tado {
461
461
  ...(config.termination.typeSkillBasedApp ? { typeSkillBasedApp: config.termination.typeSkillBasedApp } : {}),
462
462
  },
463
463
  };
464
-
464
+
465
465
  return this.apiCall(`/api/v2/homes/${home_id}/zones/${zone_id}/overlay`, 'PUT', payload);
466
466
  }
467
467