@homebridge-plugins/homebridge-tado 8.0.2 → 8.1.0-beta.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 +4 -0
- package/config.schema.json +10 -0
- package/homebridge-ui/public/js/schema.js +10 -0
- package/package.json +10 -10
- package/src/platform.js +4 -4
- package/src/tado/tado-api.js +7 -5
- package/src/tado/tado-config.js +12 -12
package/CHANGELOG.md
CHANGED
package/config.schema.json
CHANGED
|
@@ -553,6 +553,16 @@
|
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
+
},
|
|
557
|
+
"tadoApiUrl": {
|
|
558
|
+
"title": "Tado API URL",
|
|
559
|
+
"type": "string",
|
|
560
|
+
"description": "Optional: Use a custom tado api url."
|
|
561
|
+
},
|
|
562
|
+
"skipAuth": {
|
|
563
|
+
"title": "Skip Authentication",
|
|
564
|
+
"type": "boolean",
|
|
565
|
+
"description": "Optional: Skip authentication for tado api."
|
|
556
566
|
}
|
|
557
567
|
}
|
|
558
568
|
},
|
|
@@ -545,6 +545,16 @@ const schema = {
|
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
+
},
|
|
549
|
+
'tadoApiUrl': {
|
|
550
|
+
'title': 'Tado API URL',
|
|
551
|
+
'type': 'string',
|
|
552
|
+
'description': 'Optional: Use a custom tado api url.'
|
|
553
|
+
},
|
|
554
|
+
'skipAuth': {
|
|
555
|
+
'title': 'Skip Authentication',
|
|
556
|
+
'type': 'boolean',
|
|
557
|
+
'description': 'Optional: Skip authentication for tado api.'
|
|
548
558
|
}
|
|
549
559
|
},
|
|
550
560
|
'layout': [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homebridge-plugins/homebridge-tado",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.1.0-beta.0",
|
|
4
4
|
"description": "Homebridge plugin for controlling tado° devices.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
"@homebridge/plugin-ui-utils": "^2.1.0",
|
|
36
36
|
"fakegato-history": "^0.6.7",
|
|
37
37
|
"form-data": "^4.0.4",
|
|
38
|
-
"fs-extra": "^11.3.
|
|
39
|
-
"got": "^14.
|
|
38
|
+
"fs-extra": "^11.3.2",
|
|
39
|
+
"got": "^14.6.0",
|
|
40
40
|
"moment": "^2.30.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@babel/core": "7.28.
|
|
44
|
-
"@babel/eslint-parser": "7.28.
|
|
43
|
+
"@babel/core": "7.28.4",
|
|
44
|
+
"@babel/eslint-parser": "7.28.4",
|
|
45
45
|
"@babel/eslint-plugin": "7.27.1",
|
|
46
|
-
"@eslint/js": "^9.
|
|
47
|
-
"eslint": "^9.
|
|
46
|
+
"@eslint/js": "^9.38.0",
|
|
47
|
+
"eslint": "^9.38.0",
|
|
48
48
|
"eslint-config-prettier": "^10.1.8",
|
|
49
49
|
"eslint-plugin-import": "^2.32.0",
|
|
50
|
-
"eslint-plugin-prettier": "^5.5.
|
|
51
|
-
"globals": "^16.
|
|
50
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
51
|
+
"globals": "^16.4.0",
|
|
52
52
|
"prettier": "^3.6.2"
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|
package/src/platform.js
CHANGED
|
@@ -89,15 +89,15 @@ class TadoPlatform {
|
|
|
89
89
|
Logger.info('Refreshing home...', foundHome[0].name);
|
|
90
90
|
this.config = await TadoConfig.refresh(foundHome[0].name, this.config, {
|
|
91
91
|
username: foundHome[0].username
|
|
92
|
-
}, storagePath);
|
|
92
|
+
}, storagePath, this.config.tadoApiUrl, this.config.skipAuth);
|
|
93
93
|
}
|
|
94
94
|
} else {
|
|
95
95
|
Logger.info('Generating new home...', user.username);
|
|
96
|
-
this.config = await TadoConfig.add(this.config, [user], storagePath);
|
|
96
|
+
this.config = await TadoConfig.add(this.config, [user], storagePath, this.config.tadoApiUrl, this.config.skipAuth);
|
|
97
97
|
}
|
|
98
98
|
} else {
|
|
99
99
|
Logger.info('Generating new home...', user.username);
|
|
100
|
-
this.config = await TadoConfig.add(this.config, [user], storagePath);
|
|
100
|
+
this.config = await TadoConfig.add(this.config, [user], storagePath, this.config.tadoApiUrl, this.config.skipAuth);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -114,7 +114,7 @@ class TadoPlatform {
|
|
|
114
114
|
})
|
|
115
115
|
.filter((user) => user);
|
|
116
116
|
|
|
117
|
-
await TadoConfig.store(this.config, storagePath);
|
|
117
|
+
await TadoConfig.store(this.config, storagePath, this.config.tadoApiUrl, this.config.skipAuth);
|
|
118
118
|
|
|
119
119
|
Logger.info('Done!');
|
|
120
120
|
|
package/src/tado/tado-api.js
CHANGED
|
@@ -8,7 +8,9 @@ const tado_auth_url = "https://login.tado.com/oauth2";
|
|
|
8
8
|
const tado_client_id = "1bb50063-6b0c-4d11-bd99-387f4a91cc46";
|
|
9
9
|
|
|
10
10
|
export default class Tado {
|
|
11
|
-
constructor(name, config, storagePath) {
|
|
11
|
+
constructor(name, config, storagePath, tadoApiUrl, skipAuth) {
|
|
12
|
+
this.tadoApiUrl = tadoApiUrl || tado_url;
|
|
13
|
+
this.skipAuth = skipAuth?.toString() === "true";
|
|
12
14
|
this.name = name;
|
|
13
15
|
const usesExternalTokenFile = config.username?.toLowerCase().endsWith(".json");
|
|
14
16
|
this._tadoExternalTokenFilePath = usesExternalTokenFile ? config.username : undefined;
|
|
@@ -167,9 +169,9 @@ export default class Tado {
|
|
|
167
169
|
|
|
168
170
|
async apiCall(path, method = 'GET', data = {}, params = {}, tado_url_dif) {
|
|
169
171
|
Logger.debug('Get access token...', this.name);
|
|
170
|
-
const access_token = await this.getToken();
|
|
172
|
+
const access_token = this.skipAuth ? undefined : await this.getToken();
|
|
171
173
|
|
|
172
|
-
let tadoLink = tado_url_dif ||
|
|
174
|
+
let tadoLink = tado_url_dif || this.tadoApiUrl;
|
|
173
175
|
|
|
174
176
|
Logger.debug('Using ' + tadoLink, this.name);
|
|
175
177
|
|
|
@@ -186,9 +188,9 @@ export default class Tado {
|
|
|
186
188
|
let config = {
|
|
187
189
|
method: method,
|
|
188
190
|
responseType: 'json',
|
|
189
|
-
headers: {
|
|
191
|
+
headers: access_token ? {
|
|
190
192
|
Authorization: 'Bearer ' + access_token,
|
|
191
|
-
},
|
|
193
|
+
} : undefined,
|
|
192
194
|
timeout: {
|
|
193
195
|
request: 30000
|
|
194
196
|
},
|
package/src/tado/tado-config.js
CHANGED
|
@@ -18,7 +18,7 @@ const deviceHandler = new Map();
|
|
|
18
18
|
let telegram;
|
|
19
19
|
|
|
20
20
|
export default {
|
|
21
|
-
add: async function (config, credentials, storagePath) {
|
|
21
|
+
add: async function (config, credentials, storagePath, tadoApiUrl, skipAuth) {
|
|
22
22
|
config.homes = config.homes || [];
|
|
23
23
|
|
|
24
24
|
for (const user of credentials) {
|
|
@@ -26,7 +26,7 @@ export default {
|
|
|
26
26
|
|
|
27
27
|
const tado = new TadoApi('Configuration', {
|
|
28
28
|
username: username,
|
|
29
|
-
}, storagePath);
|
|
29
|
+
}, storagePath, tadoApiUrl, skipAuth);
|
|
30
30
|
|
|
31
31
|
const me = await tado.getMe();
|
|
32
32
|
|
|
@@ -152,14 +152,14 @@ export default {
|
|
|
152
152
|
return config;
|
|
153
153
|
},
|
|
154
154
|
|
|
155
|
-
resync: async function (config, credentials, storagePath) {
|
|
155
|
+
resync: async function (config, credentials, storagePath, tadoApiUrl, skipAuth) {
|
|
156
156
|
const availableHomesInApis = [];
|
|
157
157
|
|
|
158
158
|
for (const user of credentials) {
|
|
159
159
|
//Init API with credentials
|
|
160
160
|
const tado = new TadoApi('Configuration', {
|
|
161
161
|
username: user.username
|
|
162
|
-
}, storagePath);
|
|
162
|
+
}, storagePath, tadoApiUrl, skipAuth);
|
|
163
163
|
|
|
164
164
|
const me = await tado.getMe();
|
|
165
165
|
|
|
@@ -192,21 +192,21 @@ export default {
|
|
|
192
192
|
if (home.name && home.username) {
|
|
193
193
|
config = await this.refresh(home.name, config, {
|
|
194
194
|
username: home.username
|
|
195
|
-
}, storagePath);
|
|
195
|
+
}, storagePath, tadoApiUrl, skipAuth);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
config = await this.add(config, availableHomesInApis, storagePath);
|
|
199
|
+
config = await this.add(config, availableHomesInApis, storagePath, tadoApiUrl, skipAuth);
|
|
200
200
|
|
|
201
201
|
return config;
|
|
202
202
|
},
|
|
203
203
|
|
|
204
|
-
refresh: async function (currentHome, config, credentials, storagePath) {
|
|
204
|
+
refresh: async function (currentHome, config, credentials, storagePath, tadoApiUrl, skipAuth) {
|
|
205
205
|
let username = credentials.username;
|
|
206
206
|
|
|
207
207
|
const tado = new TadoApi('Configuration', {
|
|
208
208
|
username: username
|
|
209
|
-
}, storagePath);
|
|
209
|
+
}, storagePath, tadoApiUrl, skipAuth);
|
|
210
210
|
|
|
211
211
|
//Home Informations
|
|
212
212
|
let home = config.homes.find((home) => home && home.name === currentHome);
|
|
@@ -499,7 +499,7 @@ export default {
|
|
|
499
499
|
//Base Config
|
|
500
500
|
const tado = new TadoApi(home.name, {
|
|
501
501
|
username: home.username
|
|
502
|
-
}, storagePath);
|
|
502
|
+
}, storagePath, config.tadoApiUrl, config.skipAuth);
|
|
503
503
|
|
|
504
504
|
const accessoryConfig = {
|
|
505
505
|
homeId: home.id,
|
|
@@ -566,9 +566,9 @@ export default {
|
|
|
566
566
|
: 'zone-thermostat'
|
|
567
567
|
: zone.type === 'AIR_CONDITIONING'
|
|
568
568
|
? 'zone-heatercooler-ac'
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
569
|
+
: valid_boilerTypes.includes(zone.accTypeBoiler) && zone.accTypeBoiler === 'FAUCET'
|
|
570
|
+
? 'zone-faucet'
|
|
571
|
+
: 'zone-switch';
|
|
572
572
|
|
|
573
573
|
config.subtype = zone.boilerTempSupport ? 'zone-heatercooler-boiler' : config.subtype;
|
|
574
574
|
|