iobroker.volvo 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -87,6 +87,11 @@ Use the buttons under `volvo.0.<VIN>.remote` to control your vehicle:
87
87
 
88
88
  ## Changelog
89
89
 
90
+ ### 1.0.3
91
+ - Fix: adapter no longer terminates on first start without stored token
92
+ - Fix: removed manual password decrypt (now handled by `encryptedNative`)
93
+ - Fix: full try-catch in `onReady()` prevents crashes on startup errors
94
+
90
95
  ### 1.0.2
91
96
  - Fix: adapter stays alive waiting for OTP login when no token stored
92
97
  - Fix: better startup log messages explaining next steps
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "volvo",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "news": {
6
+ "1.0.3": {
7
+ "en": "Fix: adapter no longer terminates on first start without stored token; removed double password decrypt",
8
+ "de": "Fix: Adapter beendet sich nicht mehr beim ersten Start ohne gespeichertes Token; doppelte Passwort-Entschlüsselung entfernt",
9
+ "ru": "Исправление: адаптер больше не завершается при первом запуске без сохранённого токена",
10
+ "pt": "Fix: adaptador não se encerra mais no primeiro início sem token armazenado",
11
+ "nl": "Fix: adapter stopt niet meer bij eerste start zonder opgeslagen token",
12
+ "fr": "Fix: l'adaptateur ne se ferme plus au premier démarrage sans jeton stocké",
13
+ "it": "Fix: l'adattatore non si chiude più al primo avvio senza token memorizzato",
14
+ "es": "Fix: el adaptador ya no se cierra en el primer inicio sin token almacenado",
15
+ "pl": "Fix: adapter nie kończy się już przy pierwszym uruchomieniu bez zapisanego tokena",
16
+ "uk": "Виправлення: адаптер більше не завершується при першому запуску без збереженого токена",
17
+ "zh-cn": "修复:适配器在没有存储令牌的首次启动时不再终止"
18
+ },
6
19
  "1.0.2": {
7
20
  "en": "Fix: adapter stays alive waiting for OTP login when no token stored; better startup logging; CI deploy on Node 24",
8
21
  "de": "Fix: Adapter bleibt aktiv und wartet auf OTP-Login wenn kein Token gespeichert; bessere Startmeldungen; CI Deploy auf Node 24",
@@ -16,19 +29,6 @@
16
29
  "uk": "Виправлення: адаптер залишається активним в очікуванні OTP-входу; покращене журналювання запуску; CI на Node 24",
17
30
  "zh-cn": "修复:适配器保持运行等待 OTP 登录;改善启动日志;CI 部署到 Node 24"
18
31
  },
19
- "1.0.1": {
20
- "en": "Fix: multi-language support, jsonConfig layout, admin checker warnings, CI improvements",
21
- "de": "Fix: Mehrsprachigkeit, jsonConfig-Layout, Admin-Checker-Warnungen, CI-Verbesserungen",
22
- "ru": "Исправления: многоязычность, макет jsonConfig, предупреждения Admin-Checker, улучшения CI",
23
- "pt": "Correção: suporte multilíngue, layout jsonConfig, avisos do verificador de admin, melhorias de CI",
24
- "nl": "Fix: meertalige ondersteuning, jsonConfig-indeling, admin checker-waarschuwingen, CI-verbeteringen",
25
- "fr": "Correction : support multilingue, mise en page jsonConfig, avertissements du vérificateur admin, améliorations CI",
26
- "it": "Correzione: supporto multilingue, layout jsonConfig, avvisi del verificatore admin, miglioramenti CI",
27
- "es": "Corrección: soporte multilingüe, diseño jsonConfig, advertencias del verificador de admin, mejoras de CI",
28
- "pl": "Poprawki: obsługa wielojęzyczna, układ jsonConfig, ostrzeżenia sprawdzania administratora, ulepszenia CI",
29
- "uk": "Виправлення: багатомовна підтримка, макет jsonConfig, попередження перевірки адміністратора, покращення CI",
30
- "zh-cn": "修复:多语言支持、jsonConfig 布局、管理员检查器警告、CI 改进"
31
- },
32
32
  "1.0.0": {
33
33
  "en": "First stable release! Vehicle details, retry logic, command status tracking, auto-refresh, jsonConfig Admin5 UI, connection test, vehicle info display",
34
34
  "de": "Erstes stabiles Release! Fahrzeugdetails, Retry-Logik, Befehlsstatus-Tracking, Auto-Refresh, jsonConfig Admin5-UI, Verbindungstest, Fahrzeug-Info-Anzeige",
package/main.js CHANGED
@@ -72,35 +72,42 @@ class Volvo extends utils.Adapter {
72
72
  * Is called when databases are connected and adapter received configuration.
73
73
  */
74
74
  async onReady() {
75
- const obj = await this.getForeignObjectAsync('system.config');
76
- if (obj && obj.native && obj.native.secret) {
77
- this.config.password = this.decrypt(obj.native.secret, this.config.password);
78
- } else {
79
- this.config.password = this.decrypt('Zgfr56gFe87jJOM', this.config.password);
80
- }
81
- this.setState('info.connection', false, true);
82
- this.subscribeStates('*');
83
-
84
- // Always use new Connected Vehicle API (old VOC API is dead)
85
- await this.newLogin();
86
- if (this.session.access_token) {
87
- await this.getDeviceList();
88
- await this.updateDevice();
89
- this.updateInterval = setInterval(async () => {
75
+ try {
76
+ // Note: password is automatically decrypted by adapter-core (encryptedNative in io-package.json)
77
+ // No manual decrypt needed.
78
+ this.log.debug('Adapter starting up...');
79
+ this.setState('info.connection', false, true);
80
+ this.subscribeStates('*');
81
+
82
+ // Always use new Connected Vehicle API (old VOC API is dead)
83
+ await this.newLogin();
84
+ if (this.session.access_token) {
85
+ await this.getDeviceList();
90
86
  await this.updateDevice();
91
- }, this.config.interval * 60 * 1000);
92
- // Refresh token before it expires (5 min before expiry, min 60s)
93
- const refreshMs = Math.max(60, (this.session.expires_in || 1799) - 300) * 1000;
94
- this.log.info('Token refresh scheduled every ' + Math.round(refreshMs / 1000) + 's');
95
- this.refreshTokenInterval = setInterval(() => {
96
- this.refreshToken();
97
- }, refreshMs);
98
- } else {
99
- // No valid session yet — stay alive and wait for OTP login via admin UI
100
- this.log.info('No active session. Adapter is running and waiting for login via admin UI (Settings → Start Login → Submit OTP).');
101
- // Keep-alive interval so ioBroker doesn't terminate idle daemon
87
+ this.updateInterval = setInterval(async () => {
88
+ await this.updateDevice();
89
+ }, this.config.interval * 60 * 1000);
90
+ // Refresh token before it expires (5 min before expiry, min 60s)
91
+ const refreshMs = Math.max(60, (this.session.expires_in || 1799) - 300) * 1000;
92
+ this.log.info(`Token refresh scheduled every ${Math.round(refreshMs / 1000)}s`);
93
+ this.refreshTokenInterval = setInterval(() => {
94
+ this.refreshToken();
95
+ }, refreshMs);
96
+ } else {
97
+ // No valid session yet — stay alive and wait for OTP login via admin UI
98
+ this.log.info('No active session. Adapter is running and waiting for login via admin UI (Settings → Start Login → Submit OTP).');
99
+ // Keep-alive interval so ioBroker doesn't terminate idle daemon
100
+ this.keepAliveInterval = setInterval(() => {
101
+ this.log.debug('Waiting for login...');
102
+ }, 60000);
103
+ }
104
+ } catch (error) {
105
+ this.log.error(`Startup error: ${error.message}`);
106
+ this.log.error(error.stack);
107
+ // Stay alive even after errors — user can fix config and re-login via admin
108
+ this.log.info('Adapter staying alive despite startup error. Please check adapter settings.');
102
109
  this.keepAliveInterval = setInterval(() => {
103
- this.log.debug('Waiting for login...');
110
+ this.log.debug('Waiting for login after error...');
104
111
  }, 60000);
105
112
  }
106
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.volvo",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Volvo Cars Adapter",
5
5
  "author": {
6
6
  "name": "TA2k",