homebridge-polestar-c3 0.2.1 → 0.2.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 +5 -0
- package/lib/platform.js +29 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2 — 17 November 2026
|
|
4
|
+
- Fix: about once an hour a refresh failed with "Refresh failed: no status could be read". The Polestar backend closes the connection roughly every hour (HTTP/2 GOAWAY) and requests in flight were cancelled without a retry. Each status read now retries once on a fresh connection.
|
|
5
|
+
- "Refresh failed" now includes the underlying reason.
|
|
6
|
+
- Fix: a refresh error was not reported when one of the services is unsupported by the vehicle.
|
|
7
|
+
|
|
3
8
|
## 0.2.1 — 16 November 2026
|
|
4
9
|
- Everything in English: log messages, accessory names, settings screen and documentation.
|
|
5
10
|
- Existing accessories keep the names they already have in the Home app; only newly added accessories get English names.
|
package/lib/platform.js
CHANGED
|
@@ -452,19 +452,36 @@ class PolestarPlatform {
|
|
|
452
452
|
// Polling
|
|
453
453
|
// ---------------------------------------------------------------
|
|
454
454
|
|
|
455
|
+
/**
|
|
456
|
+
* Read one status service. Returns the response, null when the vehicle does
|
|
457
|
+
* not support it, or undefined on error.
|
|
458
|
+
*
|
|
459
|
+
* The backend closes the HTTP/2 connection roughly every hour (GOAWAY). The
|
|
460
|
+
* bundled client then destroys the session, which cancels requests that are
|
|
461
|
+
* in flight with an error it does not treat as transient. One retry on a
|
|
462
|
+
* fresh connection covers that.
|
|
463
|
+
*/
|
|
455
464
|
async readSafe(key, fn) {
|
|
456
465
|
if (this.unsupported.has(key)) return null;
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
466
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
467
|
+
try {
|
|
468
|
+
return await fn();
|
|
469
|
+
} catch (err) {
|
|
470
|
+
if (isUnimplemented(err)) {
|
|
471
|
+
this.unsupported.add(key);
|
|
472
|
+
this.log.info(`Reading '${key}' is not supported by this vehicle; skipping.`);
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
this.lastReadError = friendlyError(err);
|
|
476
|
+
if (attempt === 0) {
|
|
477
|
+
this.log.debug(`Reading '${key}' failed (${this.lastReadError}); retrying.`);
|
|
478
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
479
|
+
} else {
|
|
480
|
+
this.log.debug(`Reading '${key}' failed again: ${this.lastReadError}`);
|
|
481
|
+
}
|
|
464
482
|
}
|
|
465
|
-
this.log.debug(`Reading '${key}' failed: ${friendlyError(err)}`);
|
|
466
|
-
return undefined; // error, not "unsupported"
|
|
467
483
|
}
|
|
484
|
+
return undefined; // error, not "unsupported"
|
|
468
485
|
}
|
|
469
486
|
|
|
470
487
|
async refresh() {
|
|
@@ -511,8 +528,9 @@ class PolestarPlatform {
|
|
|
511
528
|
}
|
|
512
529
|
|
|
513
530
|
const anyOk = [battery, exterior, climate].some((r) => r && typeof r === 'object');
|
|
514
|
-
|
|
515
|
-
|
|
531
|
+
// null = not supported (ignored), undefined = read error
|
|
532
|
+
if (!anyOk && [battery, exterior, climate].some((r) => r === undefined)) {
|
|
533
|
+
throw new Error(`no status could be read (${this.lastReadError || 'unknown error'})`);
|
|
516
534
|
}
|
|
517
535
|
if (anyOk) s.lastOk = Date.now();
|
|
518
536
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-polestar-c3",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Unofficial Homebridge plugin for Polestar 2/3/4 via the C3 cloud backend: lock, climate, charging, battery and doors in HomeKit.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "index.js",
|