@homebridge-plugins/homebridge-tado 8.7.0 → 8.7.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 +3 -3
- package/src/tado/tado-api.js +31 -24
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homebridge-plugins/homebridge-tado",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.1",
|
|
4
4
|
"description": "Homebridge plugin for controlling tado° devices.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@babel/core": "7.28.5",
|
|
44
44
|
"@babel/eslint-parser": "7.28.5",
|
|
45
45
|
"@babel/eslint-plugin": "7.27.1",
|
|
46
|
-
"@eslint/js": "^9.39.
|
|
47
|
-
"eslint": "^9.39.
|
|
46
|
+
"@eslint/js": "^9.39.1",
|
|
47
|
+
"eslint": "^9.39.1",
|
|
48
48
|
"eslint-config-prettier": "^10.1.8",
|
|
49
49
|
"eslint-plugin-import": "^2.32.0",
|
|
50
50
|
"eslint-plugin-prettier": "^5.5.4",
|
package/src/tado/tado-api.js
CHANGED
|
@@ -256,30 +256,15 @@ export default class Tado {
|
|
|
256
256
|
|
|
257
257
|
async apiCall(path, method = 'GET', data = {}, params = {}, tado_url_dif) {
|
|
258
258
|
const access_token = this.skipAuth ? undefined : await this.getToken();
|
|
259
|
+
const url = `${tado_url_dif || this.tadoApiUrl}${path}`;
|
|
259
260
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
Logger.debug('Using ' + tadoLink, this.name);
|
|
263
|
-
|
|
264
|
-
Logger.debug(
|
|
265
|
-
'API request ' +
|
|
266
|
-
method +
|
|
267
|
-
' ' +
|
|
268
|
-
path +
|
|
269
|
-
' ' +
|
|
270
|
-
(data && Object.keys(data).length ? JSON.stringify(data) + ' <pending>' : '<pending>'),
|
|
271
|
-
this.name
|
|
272
|
-
);
|
|
273
|
-
|
|
274
|
-
let config = {
|
|
275
|
-
method: method,
|
|
261
|
+
const config = {
|
|
262
|
+
method,
|
|
276
263
|
responseType: 'json',
|
|
277
|
-
headers: access_token ?
|
|
278
|
-
Authorization:
|
|
279
|
-
|
|
280
|
-
timeout: {
|
|
281
|
-
request: 30000
|
|
282
|
-
},
|
|
264
|
+
headers: access_token ?
|
|
265
|
+
{ Authorization: `Bearer ${access_token}` } :
|
|
266
|
+
undefined,
|
|
267
|
+
timeout: { request: 30000 },
|
|
283
268
|
retry: {
|
|
284
269
|
limit: 2,
|
|
285
270
|
statusCodes: [408, 429, 503, 504],
|
|
@@ -294,12 +279,34 @@ export default class Tado {
|
|
|
294
279
|
|
|
295
280
|
if (Object.keys(params).length) config.searchParams = params;
|
|
296
281
|
|
|
282
|
+
Logger.debug('API request start', {
|
|
283
|
+
name: this.name,
|
|
284
|
+
method,
|
|
285
|
+
url,
|
|
286
|
+
params: Object.keys(params).length ? params : undefined,
|
|
287
|
+
data: Object.keys(data).length ? data : undefined,
|
|
288
|
+
});
|
|
289
|
+
|
|
297
290
|
try {
|
|
298
|
-
const response = await got(
|
|
291
|
+
const response = await got(url, config);
|
|
299
292
|
await this._increaseCounter();
|
|
293
|
+
Logger.debug('API request success', {
|
|
294
|
+
name: this.name,
|
|
295
|
+
method,
|
|
296
|
+
url,
|
|
297
|
+
statusCode: response.statusCode,
|
|
298
|
+
body: response.body ?? 'empty response',
|
|
299
|
+
});
|
|
300
300
|
return response.body;
|
|
301
301
|
} catch (error) {
|
|
302
|
-
Logger.error(
|
|
302
|
+
Logger.error('API request failed', {
|
|
303
|
+
name: this.name,
|
|
304
|
+
method,
|
|
305
|
+
url,
|
|
306
|
+
message: error.message,
|
|
307
|
+
statusCode: error.response?.statusCode,
|
|
308
|
+
body: error.response?.body,
|
|
309
|
+
});
|
|
303
310
|
throw error;
|
|
304
311
|
}
|
|
305
312
|
}
|