iobroker.frontier_silicon 0.2.0 → 0.3.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/README.md CHANGED
@@ -19,23 +19,25 @@ Provides support for media players, internet radios and SmartRadios equipped wit
19
19
 
20
20
  NOTE: This adapter has been transferred to iobroker-community-adapters for maintenance. Thus planned features (see below) will not be implemented. Only important bug fixes and dependency updates will be released in the future. However PRs with bug fixes or feature enhancements are always welcome.
21
21
 
22
- RELEASE NOTES: Version 0.1.x includes some Breaking Changes:
23
-
24
- - node>=14, js-contoller>=4 and admin>=5 required
22
+ RELEASE NOTES: Version 0.3.x includes some Breaking Changes:
25
23
 
24
+ - node>=18, js-contoller>=5 and admin>=6 required
26
25
  Upgrade your ioBroker to at least this software level, if you want to use this adapter
27
26
 
28
- - PIN encryption and validity check of all parameters in config UI
27
+ - PIN encryption and validity check of all parameters in config UI
29
28
  If you update this adapter from a previous version instead of a new installation, the adapter will not start, even if your PIN in your config is correct and has not been changed. To fix this, simply enter the same previous PIN once more in the config UI and store and close the config UI to restart the adapter. This of course is only neccessary once after the first start after the update.
30
29
 
31
- - The type of "frontier_silicon.X.modes.selectPreset" changed from "string" to "number"
30
+ - The type of "frontier_silicon.X.modes.selectPreset" changed from "string" to "number"
32
31
  If you update this adapter from a previous version instead of a new installation, you may possibly find warnings in the ioBroker log like:
33
32
  `State value to set for "frontier_silicon.0.modes.selectPreset" has to be type "string" but received type "number"`
34
33
  To prevent this from happening, the most simple solution is to stop the adapter in the instances tab of ioBroker, completely delete the object tree in the objects tab and then restart the adapter. This of course is only neccessary once after the update and is not required if you do a clean new installation.
35
34
 
36
- - Synchronization of power, volume and mute states with the UNDOK App
35
+ - Synchronization of power, volume and mute states with the UNDOK App
37
36
  Synchronization with the UNDOK App here means that power, volume and mute settings changed by the UNDOK App will now also be updated in the states of this adapter. Due to the limitations of the FSAPI protocol the state synchronization of the UNDOK App with the adapter still is unreliable and will not be instantaneous but only happen when e.g. a preset or a mode is changed using the UNDOK App.
38
37
 
38
+ - Cyclic connection retry instead of disabling the adapter
39
+ Previously the adapter was terminated after 10 session connection attempts when the device was unreachable due to long-lasting network problems like router restarts, LAN or WiFi outage. Now the adapter will retry after every session refresh interval until the device is reachable again. If you want to avoid log entries regarding these retries you have to stop the adapter manually. If your network problem is fixed while the retry period is still ongoing, simply restart the adapter.
40
+
39
41
  ## Features
40
42
 
41
43
  ### Implemented features
@@ -207,6 +209,14 @@ Please be aware that you can sometimes choose between "pushing a button" or "set
207
209
  Placeholder for the next version (at the beginning of the line):
208
210
  ### **WORK IN PROGRESS**
209
211
  -->
212
+ ### 0.3.0 (2024-08-27) - 2024H2 maintenance release
213
+
214
+ - (pdbjjens) Change: node>=18, js-contoller>=5 and admin>=6 required
215
+ - (pdbjjens) Change: Removed .npmignore
216
+ - (pdbjjens) Change: Cyclic connection retry instead of disabling the adapter (#191)
217
+ - (pdbjjens) New: Updated dependencies
218
+ - (pdbjjens) Fix: Replace deprecated method "deleteChannel" by "delObject" (#224)
219
+
210
220
  ### 0.2.0 (2024-01-28)
211
221
 
212
222
  - (pdbjjens) Change: Increase minor version number
@@ -234,13 +244,6 @@ Please be aware that you can sometimes choose between "pushing a button" or "set
234
244
  - (pdbjjens) New: Remove obsolete unit testing
235
245
  - (pdbjjens) Fix: Prevent crashes if radio device is not reachable
236
246
 
237
- ### 0.0.11 (2023-03-30) 2023 maintenance release
238
-
239
- - (pdbjjens) New: Transfer of adapter to community
240
- - (pdbjjens) New: Updated dependencies
241
- - (pdbjjens) New: Use adapter-dev instead of gulp translate
242
- - (pdbjjens) Fix: Prevent js-controller >=3.2.x warnings regarding non-existent objects and typeErrors
243
-
244
247
  ## Legal Notices
245
248
 
246
249
  Frontier, Frontier Silicon, SmartRadio, UNDOK and associated logos are trademarks or registered trademarks of Frontier Smart Technologies Limited [https://www.frontiersmart.com](https://www.frontiersmart.com)
@@ -37,7 +37,7 @@
37
37
  "RecreateSessionInterval": {
38
38
  "newLine": true,
39
39
  "type": "number",
40
- "min": 60,
40
+ "min": 10,
41
41
  "max": 3600,
42
42
  "sm": 12,
43
43
  "md": 6,
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "frontier_silicon",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "news": {
6
+ "0.3.0": {
7
+ "en": "Change: node>=18, js-contoller>=5 and admin>=6 required\nChange: Removed .npmignore\nChange: Cyclic connection retry instead of disabling the adapter (#191)\nNew: Updated dependencies\nFix: Replace deprecated method \"deleteChannel\" by \"delObject\" (#224)",
8
+ "de": "Änderung: node>=18, js-contoller>=5 und admin>=6 erforderlich\nÄnderung: .npmignore entfernt\nÄnderung: Zyklische Verbindungswiederholung statt Deaktivierung des Adapters (#191)\nNeu: Aktualisierte Abhängigkeiten\nFix: Ersetzen der deprecated Methode \"deleteChannel\" durch \"delObject\" (#224)",
9
+ "ru": "Изменение: node>=18, js-contoller>=5 и admin>=6 требуется\nИзменение: Удалено .npmignore\nИзменение: циклический ответ на подключение вместо отключения адаптера (#191)\nНовые: Обновленные зависимости\nИсправление: Заменить устаревший метод \"deleteChannel\" на \"delObject\" (#224)",
10
+ "pt": "Alteração: node>=18, js-contoller>=5 e admin>=6 requerido\nMudança: Removido .npmignore\nAlteração: Retira de conexão cíclica em vez de desativar o adaptador (#191)\nNovo: Dependências atualizadas\nFix: Substituir o método desprecated \"deleteChannel\" por \"delObject\" (#224)",
11
+ "nl": "Verandering: node>=18, js-contoller>=5 en admin>=6 vereist\nWijzigen: verwijderd .npmignore\nVerandering: Cyclische verbinding opnieuw proberen in plaats van uitschakelen van de adapter (#191)\nNieuw: Bijgewerkte afhankelijkheden\nFix: Vervang verouderde methode \"deleteChannel\" door \"delObject\" (#224)",
12
+ "fr": "Changement: noeud>=18, js-contoller>=5 et admin>=6 requis\nChangement : supprimé .npmignore\nChangement: Réessayer la connexion cyclique au lieu de désactiver l'adaptateur (#191)\nNouveau: Dépendances actualisées\nCorrection: Remplacer la méthode obsolète \"deleteChannel\" par \"delObject\" (#224)",
13
+ "it": "Modifica: nodo>=18, js-contoller>=5 e admin>=6 richiesto\nModifica: Removed .npmignore\nCambiamento: Rettifica di connessione ciclica invece di disabilitare l'adattatore (#191)\nNuovo: dipendenze aggiornate\nFisso: Sostituisci il metodo deprecato \"deleteChannel\" da \"delObject\" (#224)",
14
+ "es": "Cambio: node confianza=18, js-contoller=5 y administración=6 requerido\nCambio: Quitado .npmignore\nCambio: Retira la conexión cíclica en lugar de desactivar el adaptador (#191)\nNuevas: dependencias actualizadas\nFijación: Reemplazar el método deprecado \"deleteChannel\" por \"delObject\" (#224)",
15
+ "pl": "Zmiana: węzeł > = 18, js- contoller > = 5 i admin > = 6 wymagane\nZmiana: Usunięto .npmignore\nZmiana: powtórne połączenie cykliczne zamiast wyłączania adaptera (# 191)\nNowy: Aktualizacja zależności\nFix: Zastąpić metodę \"deleteChannel\" przez \"delObject\" (# 224)",
16
+ "uk": "Зміна: вершина>=18, js-contoller>=5 і admin>=6\nЗміна: Видалити .npmignore\nЗміна: Ретриця циклічного з'єднання замість відключення адаптера (#191)\nНовий: Оновлені залежності\nВиправлення: Заміна депресованого методу \"deleteChannel\" від \"delObject\" (#224)",
17
+ "zh-cn": "更改:节点18、js-contoller%5和管理员6\n更改: 删除 .npmignore\n更改: Cyclic 连接重试而不是取消适配器(# 191)\n新建:更新的依赖关系\n修补:将已折旧的方法“删除频道”改为“del Object”(# 224)"
18
+ },
6
19
  "0.2.0": {
7
20
  "en": "Change: Increase minor version number",
8
21
  "de": "Änderung: Nebenversionsnummer erhöhen",
@@ -80,19 +93,6 @@
80
93
  "pl": "Przekład",
81
94
  "uk": "Переклади",
82
95
  "zh-cn": "笔译"
83
- },
84
- "0.0.9": {
85
- "en": "Nicer readme and (hopefully) more robust session handling",
86
- "de": "Schöneres readme und (hoffentlich) robusteres Session Handling",
87
- "ru": "Nicer readme и (надежно) более прочная обработка сеансов",
88
- "pt": "Limão mais agradável e (hopely) manipulação de sessão mais robusta",
89
- "nl": "Mooier voorgelezen en meer robuuste sessie",
90
- "fr": "Nicer readme et (hopefully) la manipulation de session plus robuste",
91
- "it": "Più bello lettura e (sperato) più robusta manipolazione della sessione",
92
- "es": "Lindo readme y (esperadamente) más robusto manejo de sesión",
93
- "pl": "Nicer przeczytał i (pomyślnie) bardziej solidny sesyjny charakter",
94
- "uk": "Хороший читме і (повно) більш надійний процес сеансу",
95
- "zh-cn": "尼亚区读者和(希望)更强的会议"
96
96
  }
97
97
  },
98
98
  "titleLang": {
@@ -133,9 +133,11 @@
133
133
  "radio",
134
134
  "music player"
135
135
  ],
136
- "license": "MIT",
136
+ "licenseInformation": {
137
+ "license": "MIT",
138
+ "type": "free"
139
+ },
137
140
  "platform": "Javascript/Node.js",
138
- "main": "main.js",
139
141
  "icon": "radio.png",
140
142
  "enabled": true,
141
143
  "extIcon": "https://raw.githubusercontent.com/iobroker-community-adapters/ioBroker.frontier_silicon/master/admin/radio.png",
@@ -146,18 +148,18 @@
146
148
  "compact": true,
147
149
  "connectionType": "local",
148
150
  "dataSource": "poll",
149
- "materialize": true,
151
+ "tier": 2,
150
152
  "adminUI": {
151
153
  "config": "json"
152
154
  },
153
155
  "dependencies": [
154
156
  {
155
- "js-controller": ">=4.0.15"
157
+ "js-controller": ">=5.0.19"
156
158
  }
157
159
  ],
158
160
  "globalDependencies": [
159
161
  {
160
- "admin": ">=5.2.28"
162
+ "admin": ">=6.13.16"
161
163
  }
162
164
  ]
163
165
  },
package/main.js CHANGED
@@ -6,14 +6,14 @@
6
6
 
7
7
  // The adapter-core module gives you access to the core ioBroker functions
8
8
  // you need to create an adapter
9
- const utils = require("@iobroker/adapter-core");
10
- const axios = require("axios").default;
9
+ const utils = require('@iobroker/adapter-core');
10
+ const axios = require('axios').default;
11
11
  // @ts-ignore
12
- const xml2js = require("xml2js");
12
+ const xml2js = require('xml2js');
13
13
 
14
14
  // Load your modules here, e.g.:
15
15
  // const fs = require("fs");
16
- const SESSION_RETRYS = 9; // Total number of session re-establish attempts before adapter is terminated = SESSION_RETRYS + 1
16
+ const SESSION_RETRYS = 3; // Total number of session re-establish attempts before adapter is sent to sleep = SESSION_RETRYS + 1
17
17
  const IP_FORMAT = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
18
18
  const PIN_FORMAT = /^(\d{4})$/;
19
19
  const sleeps = new Map();
@@ -50,7 +50,7 @@ class FrontierSilicon extends utils.Adapter {
50
50
  // Initialize your adapter here
51
51
 
52
52
  // Reset the connection indicator during startup
53
- await this.setStateAsync("info.connection", false, true);
53
+ await this.setState("info.connection", false, true);
54
54
 
55
55
  if (!this.config.IP) {
56
56
  this.log.error(`Device IP is empty - please check instance configuration of ${this.namespace}`);
@@ -133,7 +133,7 @@ class FrontierSilicon extends utils.Adapter {
133
133
  // Here you must clear all timeouts or intervals that may still be active
134
134
  polling = true; // disable onFSAPI processing
135
135
  this.cleanUp(); //stop all timeouts
136
- this.setStateAsync("info.connection", false, true)
136
+ this.setState("info.connection", false, true)
137
137
 
138
138
  // this.deleteSession()
139
139
  .then(() => {
@@ -186,7 +186,7 @@ class FrontierSilicon extends utils.Adapter {
186
186
  if (!id || !state || state.ack) return;
187
187
  // The state was changed
188
188
  this.log.debug(`state ${id} changed: ${state.val} (ack = ${state.ack})`);
189
- //const setState = this.setStateAsync;
189
+ //const setState = this.setState;
190
190
  const zustand = id.split(".");
191
191
  const adapter = this;
192
192
 
@@ -202,7 +202,7 @@ class FrontierSilicon extends utils.Adapter {
202
202
  await adapter.callAPI("netRemote.sys.power", state.val ? "1" : "0")
203
203
  .then(async function (result) {
204
204
  if(result.success) {
205
- await adapter.setStateAsync("device.power", {val:state.val, ack: true});
205
+ await adapter.setState("device.power", {val:state.val, ack: true});
206
206
  }
207
207
  });
208
208
 
@@ -220,7 +220,7 @@ class FrontierSilicon extends utils.Adapter {
220
220
  await adapter.callAPI("netRemote.sys.info.friendlyName", name)
221
221
  .then(async (result) => {
222
222
  if(result.success) {
223
- await adapter.setStateAsync("device.friendlyName", {val:name.toString(), ack: true});
223
+ await adapter.setState("device.friendlyName", {val:name.toString(), ack: true});
224
224
  }
225
225
  });
226
226
  }
@@ -238,15 +238,15 @@ class FrontierSilicon extends utils.Adapter {
238
238
  await adapter.callAPI("netRemote.sys.mode", zustand[3])
239
239
  .then(async function (result) {
240
240
  if(result.success) {
241
- await adapter.setStateAsync("modes.selected", {val:Number(zustand[3]), ack: true});
241
+ await adapter.setState("modes.selected", {val:Number(zustand[3]), ack: true});
242
242
  await adapter.getStateAsync(`modes.${zustand[3]}.label`)
243
243
  .then(async function (lab) {
244
244
  if(lab !== null && lab !== undefined && lab.val !== null)
245
245
  {
246
- await adapter.setStateAsync("modes.selectedLabel", {val:lab.val, ack: true});
246
+ await adapter.setState("modes.selectedLabel", {val:lab.val, ack: true});
247
247
  }
248
248
  });
249
- //adapter.setStateAsync("modes.selectPreset", {val:null, ack: true});
249
+ //adapter.setState("modes.selectPreset", {val:null, ack: true});
250
250
  }
251
251
  });
252
252
  }
@@ -257,7 +257,7 @@ class FrontierSilicon extends utils.Adapter {
257
257
  await adapter.callAPI("netRemote.nav.action.selectPreset", zustand[5])
258
258
  .then(async function (result) {
259
259
  if(result.success) {
260
- await adapter.setStateAsync("modes.selectPreset", {val:Number(zustand[5]), ack: true});
260
+ await adapter.setState("modes.selectPreset", {val:Number(zustand[5]), ack: true});
261
261
  }
262
262
  });
263
263
  //adapter.getSelectedPreset();
@@ -269,19 +269,19 @@ class FrontierSilicon extends utils.Adapter {
269
269
  await adapter.callAPI("netRemote.sys.mode", state.val.toString())
270
270
  .then(async function (result) {
271
271
  if(result.success) {
272
- await adapter.setStateAsync("modes.selected", {val:Number(state.val), ack: true});
272
+ await adapter.setState("modes.selected", {val:Number(state.val), ack: true});
273
273
  await adapter.getStateAsync(`modes.${state.val}.label`)
274
274
  .then(async function (lab) {
275
275
  if(lab !== null && lab !== undefined && lab.val !== null)
276
276
  {
277
- await adapter.setStateAsync("modes.selectedLabel", {val:lab.val, ack: true});
277
+ await adapter.setState("modes.selectedLabel", {val:lab.val, ack: true});
278
278
  }
279
279
  });
280
280
  await adapter.callAPI("netRemote.play.info.graphicUri")
281
281
  .then(async function (result) {
282
- await adapter.setStateAsync("media.graphic", { val: result.result.value[0].c8_array[0].trim(), ack: true });
282
+ await adapter.setState("media.graphic", { val: result.result.value[0].c8_array[0].trim(), ack: true });
283
283
  });
284
- //adapter.setStateAsync("modes.selectPreset", {val:null, ack: true});
284
+ //adapter.setState("modes.selectPreset", {val:null, ack: true});
285
285
  }
286
286
  });
287
287
  }
@@ -292,10 +292,10 @@ class FrontierSilicon extends utils.Adapter {
292
292
  await adapter.callAPI("netRemote.nav.action.selectPreset", state.val.toString())
293
293
  .then(async function (result) {
294
294
  if(result.success) {
295
- await adapter.setStateAsync("modes.selectPreset", {val:state.val, ack: true});
295
+ await adapter.setState("modes.selectPreset", {val:state.val, ack: true});
296
296
  await adapter.callAPI("netRemote.play.info.graphicUri")
297
297
  .then(async function (result) {
298
- await adapter.setStateAsync("media.graphic", { val: result.result.value[0].c8_array[0].trim(), ack: true });
298
+ await adapter.setState("media.graphic", { val: result.result.value[0].c8_array[0].trim(), ack: true });
299
299
  });
300
300
  }
301
301
  });
@@ -315,7 +315,7 @@ class FrontierSilicon extends utils.Adapter {
315
315
  await adapter.callAPI("netRemote.sys.audio.volume", state.val.toString())
316
316
  .then(async function (result) {
317
317
  if(result.success) {
318
- await adapter.setStateAsync("audio.volume", {val:Number(state.val), ack: true});
318
+ await adapter.setState("audio.volume", {val:Number(state.val), ack: true});
319
319
  }
320
320
  });
321
321
  }
@@ -326,7 +326,7 @@ class FrontierSilicon extends utils.Adapter {
326
326
  await adapter.callAPI("netRemote.sys.audio.mute", state.val ? "1" : "0")
327
327
  .then(async function (result) {
328
328
  if(result.success) {
329
- await adapter.setStateAsync("audio.mute", {val:state.val, ack: true});
329
+ await adapter.setState("audio.mute", {val:state.val, ack: true});
330
330
  }
331
331
  });
332
332
  }
@@ -347,7 +347,7 @@ class FrontierSilicon extends utils.Adapter {
347
347
  await adapter.callAPI("netRemote.sys.audio.volume", vol.toString())
348
348
  .then(async function (result) {
349
349
  if(result.success) {
350
- await adapter.setStateAsync("audio.volume", {val:Number(vol), ack: true});
350
+ await adapter.setState("audio.volume", {val:Number(vol), ack: true});
351
351
  }
352
352
  });
353
353
  }
@@ -366,7 +366,7 @@ class FrontierSilicon extends utils.Adapter {
366
366
  await adapter.callAPI("netRemote.sys.audio.volume", vol.toString())
367
367
  .then(async function (result) {
368
368
  if(result.success) {
369
- await adapter.setStateAsync("audio.volume", {val:Number(vol), ack: true});
369
+ await adapter.setState("audio.volume", {val:Number(vol), ack: true});
370
370
  }
371
371
  });
372
372
  }
@@ -397,7 +397,7 @@ class FrontierSilicon extends utils.Adapter {
397
397
  await this.callAPI("netRemote.play.control", z.toString())
398
398
  .then(async function (result) {
399
399
  if(result.success) {
400
- await adapter.setStateAsync("media.state", {val:state.val, ack: true});
400
+ await adapter.setState("media.state", {val:state.val, ack: true});
401
401
  }
402
402
  });
403
403
  }
@@ -407,7 +407,7 @@ class FrontierSilicon extends utils.Adapter {
407
407
  await this.callAPI("netRemote.play.control", "1")
408
408
  .then(async function (result) {
409
409
  if(result.success) {
410
- await adapter.setStateAsync("media.state", {val:1, ack: true});
410
+ await adapter.setState("media.state", {val:1, ack: true});
411
411
  }
412
412
  });
413
413
  }
@@ -417,7 +417,7 @@ class FrontierSilicon extends utils.Adapter {
417
417
  await this.callAPI("netRemote.play.control", "2")
418
418
  .then(async function (result) {
419
419
  if(result.success) {
420
- await adapter.setStateAsync("media.state", {val:0, ack: true});
420
+ await adapter.setState("media.state", {val:0, ack: true});
421
421
  }
422
422
  });
423
423
  }
@@ -496,7 +496,7 @@ class FrontierSilicon extends utils.Adapter {
496
496
  let result = await this.callAPI("netRemote.sys.info.radioId");
497
497
  if(result.success)
498
498
  {
499
- await this.setStateAsync("device.radioId", {val: result.result.value[0].c8_array[0], ack: true});
499
+ await this.setState("device.radioId", {val: result.result.value[0].c8_array[0], ack: true});
500
500
  }
501
501
 
502
502
  //netRemote.sys.caps.volumeSteps
@@ -514,7 +514,7 @@ class FrontierSilicon extends utils.Adapter {
514
514
  result = await this.callAPI("netRemote.sys.caps.volumeSteps");
515
515
  if(result.success)
516
516
  {
517
- await this.setStateAsync("audio.maxVolume", {val: result.result.value[0].u8[0]-1, ack: true});
517
+ await this.setState("audio.maxVolume", {val: result.result.value[0].u8[0]-1, ack: true});
518
518
  this.config.VolumeMax = result.result.value[0].u8[0] - 1;
519
519
  }
520
520
 
@@ -706,18 +706,18 @@ class FrontierSilicon extends utils.Adapter {
706
706
  let prom;
707
707
  if(id === "MP" && this.config.SangeanNoSound)
708
708
  {
709
- prom = this.setStateAsync("modes.mediaplayer", { val: key, ack: true });
709
+ prom = this.setState("modes.mediaplayer", { val: key, ack: true });
710
710
  proms.push(prom);
711
711
  }
712
- prom = this.setStateAsync(`modes.${key}.key`, { val: Number(key), ack: true });
712
+ prom = this.setState(`modes.${key}.key`, { val: Number(key), ack: true });
713
713
  proms.push(prom);
714
- prom = this.setStateAsync(`modes.${key}.id`, { val: id, ack: true });
714
+ prom = this.setState(`modes.${key}.id`, { val: id, ack: true });
715
715
  proms.push(prom);
716
- prom = this.setStateAsync(`modes.${key}.label`, { val: label, ack: true });
716
+ prom = this.setState(`modes.${key}.label`, { val: label, ack: true });
717
717
  proms.push(prom);
718
- prom = this.setStateAsync(`modes.${key}.streamable`, { val: streamable, ack: true });
718
+ prom = this.setState(`modes.${key}.streamable`, { val: streamable, ack: true });
719
719
  proms.push(prom);
720
- prom = this.setStateAsync(`modes.${key}.selectable`, { val: selectable, ack: true });
720
+ prom = this.setState(`modes.${key}.selectable`, { val: selectable, ack: true });
721
721
  proms.push(prom);
722
722
  });
723
723
  await Promise.all(proms);
@@ -795,7 +795,7 @@ class FrontierSilicon extends utils.Adapter {
795
795
  },
796
796
  native: {},
797
797
  });
798
- await this.setStateAsync(`modes.${mode}.presets.available`, { val: result.success, ack: true });
798
+ await this.setState(`modes.${mode}.presets.available`, { val: result.success, ack: true });
799
799
  //this.log.debug(result.success.toString() + " - " + result.result.status[0].toString());
800
800
  if(!result.success) return;
801
801
 
@@ -806,7 +806,7 @@ class FrontierSilicon extends utils.Adapter {
806
806
  const proms = [];
807
807
  const promo = [];
808
808
  result.result.item.forEach(item => {
809
- //this.setStateAsync(`modes.${mode}.presets.available`, { val: true, ack: true });
809
+ //this.setState(`modes.${mode}.presets.available`, { val: true, ack: true });
810
810
  key = item.$.key;
811
811
  let pro = this.setObjectNotExistsAsync(`modes.${mode}.presets.${key}`, {
812
812
  type: "channel",
@@ -859,7 +859,7 @@ class FrontierSilicon extends utils.Adapter {
859
859
  // Wait for all object creation processes
860
860
  await Promise.all(promo);
861
861
  result.result.item.forEach(item => {
862
- //this.setStateAsync(`modes.${mode}.presets.available`, { val: true, ack: true });
862
+ //this.setState(`modes.${mode}.presets.available`, { val: true, ack: true });
863
863
  key = item.$.key;
864
864
  item.field.forEach(f => {
865
865
  //this.log.debug("Preset key: " + key.toString() + " Item: " + JSON.stringify(item) + " f: " + JSON.stringify(f));
@@ -873,9 +873,9 @@ class FrontierSilicon extends utils.Adapter {
873
873
  });
874
874
  this.log.debug(`Preset of Mode: ${mode} with key: ${key} set to ${name.toString().trim()}`);
875
875
 
876
- let prom = this.setStateAsync(`modes.${mode}.presets.${key}.name`, { val: name.toString().trim(), ack: true });
876
+ let prom = this.setState(`modes.${mode}.presets.${key}.name`, { val: name.toString().trim(), ack: true });
877
877
  proms.push(prom);
878
- prom = this.setStateAsync(`modes.${mode}.presets.${key}.key`, { val: Number(key), ack: true });
878
+ prom = this.setState(`modes.${mode}.presets.${key}.key`, { val: Number(key), ack: true });
879
879
  proms.push(prom);
880
880
  });
881
881
  await Promise.all(proms);
@@ -905,7 +905,7 @@ class FrontierSilicon extends utils.Adapter {
905
905
  if(power.success)
906
906
  {
907
907
  this.log.debug(`Power: ${power.result.value[0].u8[0] == 1}`);
908
- await this.setStateAsync("device.power", { val: power.result.value[0].u8[0] == 1, ack: true });
908
+ await this.setState("device.power", { val: power.result.value[0].u8[0] == 1, ack: true });
909
909
  }
910
910
 
911
911
  await this.setObjectNotExistsAsync("modes.selected", {
@@ -925,7 +925,7 @@ class FrontierSilicon extends utils.Adapter {
925
925
  {
926
926
  modeSelected = power.result.value[0].u32[0];
927
927
  this.log.debug(`Mode1: ${modeSelected}`);
928
- await this.setStateAsync("modes.selected", { val: Number(modeSelected), ack: true });
928
+ await this.setState("modes.selected", { val: Number(modeSelected), ack: true });
929
929
  }
930
930
 
931
931
  await this.setObjectNotExistsAsync("modes.selectedLabel", {
@@ -946,7 +946,7 @@ class FrontierSilicon extends utils.Adapter {
946
946
  // @ts-ignore
947
947
  this.log.debug(`ModeLabel: ${modeLabel.val}`);
948
948
  // @ts-ignore
949
- await this.setStateAsync("modes.selectedLabel", { val: modeLabel.val, ack: true });
949
+ await this.setState("modes.selectedLabel", { val: modeLabel.val, ack: true });
950
950
  }
951
951
  await this.setObjectNotExistsAsync("modes.selectPreset", {
952
952
  type: "state",
@@ -975,7 +975,7 @@ class FrontierSilicon extends utils.Adapter {
975
975
  power = await this.callAPI("netRemote.play.info.name");
976
976
  if(power.success)
977
977
  {
978
- this.setStateAsync("media.name", { val: power.result.value[0].c8_array[0].trim(), ack: true });
978
+ this.setState("media.name", { val: power.result.value[0].c8_array[0].trim(), ack: true });
979
979
  await this.UpdatePreset(power.result.value[0].c8_array[0].trim());
980
980
  }
981
981
 
@@ -993,7 +993,7 @@ class FrontierSilicon extends utils.Adapter {
993
993
  power = await this.callAPI("netRemote.play.info.album");
994
994
  if(power.success)
995
995
  {
996
- await this.setStateAsync("media.album", { val: power.result.value[0].c8_array[0].trim(), ack: true });
996
+ await this.setState("media.album", { val: power.result.value[0].c8_array[0].trim(), ack: true });
997
997
  }
998
998
 
999
999
  await this.setObjectNotExistsAsync("media.title", {
@@ -1010,7 +1010,7 @@ class FrontierSilicon extends utils.Adapter {
1010
1010
  power = await this.callAPI("netRemote.play.info.title");
1011
1011
  if(power.success)
1012
1012
  {
1013
- await this.setStateAsync("media.title", { val: power.result.value[0].c8_array[0].trim(), ack: true });
1013
+ await this.setState("media.title", { val: power.result.value[0].c8_array[0].trim(), ack: true });
1014
1014
  }
1015
1015
 
1016
1016
  await this.setObjectNotExistsAsync("media.artist", {
@@ -1027,7 +1027,7 @@ class FrontierSilicon extends utils.Adapter {
1027
1027
  power = await this.callAPI("netRemote.play.info.artist");
1028
1028
  if(power.success)
1029
1029
  {
1030
- await this.setStateAsync("media.artist", { val: power.result.value[0].c8_array[0].trim(), ack: true });
1030
+ await this.setState("media.artist", { val: power.result.value[0].c8_array[0].trim(), ack: true });
1031
1031
  }
1032
1032
 
1033
1033
  await this.setObjectNotExistsAsync("media.text", {
@@ -1044,7 +1044,7 @@ class FrontierSilicon extends utils.Adapter {
1044
1044
  power = await this.callAPI("netRemote.play.info.text");
1045
1045
  if(power.success)
1046
1046
  {
1047
- await this.setStateAsync("media.text", { val: power.result.value[0].c8_array[0].trim(), ack: true });
1047
+ await this.setState("media.text", { val: power.result.value[0].c8_array[0].trim(), ack: true });
1048
1048
  }
1049
1049
 
1050
1050
  await this.setObjectNotExistsAsync("media.graphic", {
@@ -1061,7 +1061,7 @@ class FrontierSilicon extends utils.Adapter {
1061
1061
  power = await this.callAPI("netRemote.play.info.graphicUri");
1062
1062
  if(power.success)
1063
1063
  {
1064
- await this.setStateAsync("media.graphic", { val: power.result.value[0].c8_array[0].trim(), ack: true });
1064
+ await this.setState("media.graphic", { val: power.result.value[0].c8_array[0].trim(), ack: true });
1065
1065
  }
1066
1066
 
1067
1067
  //netRemote.sys.audio.volume
@@ -1079,7 +1079,7 @@ class FrontierSilicon extends utils.Adapter {
1079
1079
  });
1080
1080
  if(power.success && power.value !== null)
1081
1081
  {
1082
- await this.setStateAsync("audio.volume", { val: Number(power.result.value[0].u8[0]), ack: true });
1082
+ await this.setState("audio.volume", { val: Number(power.result.value[0].u8[0]), ack: true });
1083
1083
  }
1084
1084
 
1085
1085
  //netRemote.sys.audio.mute
@@ -1097,7 +1097,7 @@ class FrontierSilicon extends utils.Adapter {
1097
1097
  });
1098
1098
  if(power.success && power.value !== null)
1099
1099
  {
1100
- await this.setStateAsync("audio.mute", { val: power.result.value[0].u8[0] == 1, ack: true });
1100
+ await this.setState("audio.mute", { val: power.result.value[0].u8[0] == 1, ack: true });
1101
1101
  }
1102
1102
 
1103
1103
  await this.setObjectNotExistsAsync("audio.control", {
@@ -1205,11 +1205,11 @@ class FrontierSilicon extends utils.Adapter {
1205
1205
  {
1206
1206
  // Play
1207
1207
  case "1":
1208
- await this.setStateAsync("media.state", { val: 1, ack: true });
1208
+ await this.setState("media.state", { val: 1, ack: true });
1209
1209
  break;
1210
1210
  // Pause
1211
1211
  case "2":
1212
- await this.setStateAsync("media.state", { val: 0, ack: true });
1212
+ await this.setState("media.state", { val: 0, ack: true });
1213
1213
  break;
1214
1214
  default:
1215
1215
  break;
@@ -1286,15 +1286,15 @@ class FrontierSilicon extends utils.Adapter {
1286
1286
 
1287
1287
  if(dev.friendlyName !== null || dev.friendlyName !== undefined)
1288
1288
  {
1289
- await this.setStateAsync("device.friendlyName", { val: dev.friendlyName.toString(), ack: true });
1289
+ await this.setState("device.friendlyName", { val: dev.friendlyName.toString(), ack: true });
1290
1290
  }
1291
1291
  if(dev.version !== null || dev.version !== undefined)
1292
1292
  {
1293
- await this.setStateAsync("device.version", { val: dev.version.toString(), ack: true });
1293
+ await this.setState("device.version", { val: dev.version.toString(), ack: true });
1294
1294
  }
1295
1295
  if(dev.webfsapi !== null || dev.webfsapi !== undefined)
1296
1296
  {
1297
- await this.setStateAsync("device.webfsapi", { val: dev.webfsapi.toString(), ack: true });
1297
+ await this.setState("device.webfsapi", { val: dev.webfsapi.toString(), ack: true });
1298
1298
  this.config.fsAPIURL = dev.webfsapi.toString();
1299
1299
  }
1300
1300
  }
@@ -1308,7 +1308,6 @@ class FrontierSilicon extends utils.Adapter {
1308
1308
  if (sessionRetryCnt > 0) {
1309
1309
  this.log.info(`Device unreachable, retry ${sessionRetryCnt} more times`);
1310
1310
  --sessionRetryCnt;
1311
- //await this.sleep(500);
1312
1311
  await this.getDeviceInfo();
1313
1312
  } else { //terminate adapter after unsuccessful retries
1314
1313
  sessionRetryCnt = SESSION_RETRYS;
@@ -1404,7 +1403,7 @@ class FrontierSilicon extends utils.Adapter {
1404
1403
  } catch (err) {
1405
1404
  this.log.info("Session error, trying to reestablish session...");
1406
1405
  // @ts-ignore
1407
- await this.setStateAsync("info.connection", false, true);
1406
+ await this.setState("info.connection", false, true);
1408
1407
  try {
1409
1408
  await this.createSession();
1410
1409
  } catch (error) {
@@ -1453,7 +1452,7 @@ class FrontierSilicon extends utils.Adapter {
1453
1452
  });
1454
1453
  this.config.SessionID = Number(dev.Session);
1455
1454
  //this.config.SessionTS = Date.now();
1456
- await this.setStateAsync("info.connection", connected, true);
1455
+ await this.setState("info.connection", connected, true);
1457
1456
  if(this.log.level=="debug" || this.log.level=="silly")
1458
1457
  {
1459
1458
  await this.setObjectNotExistsAsync("debug", {
@@ -1519,20 +1518,20 @@ class FrontierSilicon extends utils.Adapter {
1519
1518
  native: {},
1520
1519
  });
1521
1520
 
1522
- await this.setStateAsync("debug.session", {val: Number(dev.Session), ack: true});
1523
- await this.setStateAsync("debug.sessionCreationTime", { val: sessionTimestamp, ack: true});
1521
+ await this.setState("debug.session", {val: Number(dev.Session), ack: true});
1522
+ await this.setState("debug.sessionCreationTime", { val: sessionTimestamp, ack: true});
1524
1523
 
1525
1524
  }
1526
1525
  else
1527
1526
  {
1528
- await this.deleteChannelAsync("debug");
1527
+ await this.delObjectAsync("debug",{ recursive: true });
1529
1528
  }
1530
1529
 
1531
1530
  await this.sleep(200);
1532
1531
  }
1533
1532
  catch (err) {
1534
1533
  // create session failed
1535
- await this.setStateAsync("info.connection", connected, true);
1534
+ await this.setState("info.connection", connected, true);
1536
1535
  // @ts-ignore
1537
1536
  if (err.response) { // catch wrong PIN
1538
1537
  // @ts-ignore
@@ -1550,18 +1549,34 @@ class FrontierSilicon extends utils.Adapter {
1550
1549
  } else if (err.request) { // catch device not reachable
1551
1550
  // @ts-ignore
1552
1551
  if (err.code === "ETIMEDOUT" || err.code === "ECONNRESET" || err.code === "EHOSTUNREACH") {
1552
+ // @ts-ignore
1553
+ this.log.debug(err);
1553
1554
  if (sessionRetryCnt > 0) {
1554
1555
  // @ts-ignore
1555
- this.log.error(err);
1556
- this.log.info(`Device unreachable, retry ${sessionRetryCnt} more times`);
1556
+ this.log.warn (`Device ${devName.val} @ ${devIp} unreachable, retrying ${sessionRetryCnt} more times ...`);
1557
1557
  --sessionRetryCnt;
1558
- await this.sleep(500);
1559
- await this.createSession();
1560
- } else { //terminate adapter after unsuccessful session retries
1558
+ try {
1559
+ await this.createSession();
1560
+ } catch (err) {
1561
+ // @ts-ignore
1562
+ this.log.error(err);
1563
+ }
1564
+ } else { // send adapter to sleep after unsuccessful session retries
1561
1565
  sessionRetryCnt = SESSION_RETRYS;
1562
- //adapter.terminate does not clear up timers or intervals
1563
- this.cleanUp();
1564
- this.terminate(`Device unreachable - Adapter terminated after ${++sessionRetryCnt} create Session attempts`, 11);
1566
+ this.log.error (`Device ${devName.val} @ ${devIp} unreachable, retrying after session refresh interval ...`);
1567
+ // clean up timers or intervals
1568
+ polling = true; // disable onFSAPI processing
1569
+ this.cleanUp(); // stop all sleeps
1570
+ clearTimeout(timeOutMessage); // stop polling
1571
+ await this.sleep(this.config.RecreateSessionInterval * 60 * 1000);
1572
+ try {
1573
+ await this.createSession();
1574
+ timeOutMessage = setTimeout(() => this.onFSAPIMessage(), this.config.PollIntervall * 1000);
1575
+ polling = false;
1576
+ } catch (err) {
1577
+ // @ts-ignore
1578
+ this.log.error(err);
1579
+ }
1565
1580
  }
1566
1581
  } else {
1567
1582
  // @ts-ignore
@@ -1582,7 +1597,7 @@ class FrontierSilicon extends utils.Adapter {
1582
1597
  //const connected = false;
1583
1598
  const currentSession = this.config.SessionID;
1584
1599
  if (this.config.fsAPIURL !== null) {
1585
- //await this.setStateAsync("info.connection", connected, true);
1600
+ //await this.setState("info.connection", connected, true);
1586
1601
  log.debug(`Deleting Session ${currentSession}`);
1587
1602
  try {
1588
1603
  url = `${this.config.fsAPIURL}/DELETE_SESSION?pin=${this.config.PIN}&sid=${currentSession.toString()}`;
@@ -1607,10 +1622,10 @@ class FrontierSilicon extends utils.Adapter {
1607
1622
  });
1608
1623
  //this.config.SessionID = 0;
1609
1624
  //connected = false;
1610
- // await this.setStateAsync("info.connection", connected, true);
1625
+ // await this.setState("info.connection", connected, true);
1611
1626
  //if(this.log.level=="debug" || this.log.level=="silly")
1612
1627
  //{
1613
- // await this.deleteChannelAsync("debug");
1628
+ // await this.delObjectAsync("debug",{ recursive: true });
1614
1629
  //}
1615
1630
  //await this.sleep(200);
1616
1631
  }
@@ -1686,7 +1701,7 @@ class FrontierSilicon extends utils.Adapter {
1686
1701
  notifyTimestamp = Date.now();
1687
1702
  if(this.log.level=="debug" || this.log.level=="silly")
1688
1703
  {
1689
- this.setStateAsync("debug.lastNotifyCall", { val: notifyTimestamp, ack: true });
1704
+ this.setState("debug.lastNotifyCall", { val: notifyTimestamp, ack: true });
1690
1705
  }
1691
1706
  const result = await this.callAPI("", "", 0, 0, true);
1692
1707
 
@@ -1703,20 +1718,20 @@ class FrontierSilicon extends utils.Adapter {
1703
1718
  .then(function (result) {
1704
1719
  if(result !== null && result !== undefined && result.val !== null )
1705
1720
  {
1706
- adapter.setStateAsync("device.power", { val: result.result.value[0].u8[0] == 1, ack: true });
1721
+ adapter.setState("device.power", { val: result.result.value[0].u8[0] == 1, ack: true });
1707
1722
  }
1708
1723
  });
1709
1724
  break;
1710
1725
  case "netremote.sys.mode":
1711
- await this.setStateAsync("modes.selected", { val: Number(item.value[0].u32[0]), ack: true });
1726
+ await this.setState("modes.selected", { val: Number(item.value[0].u32[0]), ack: true });
1712
1727
  await this.getStateAsync(`modes.${item.value[0].u32[0]}.label`)
1713
1728
  .then(function (result) {
1714
1729
  if(result !== null && result !== undefined && result.val !== null )
1715
1730
  {
1716
- adapter.setStateAsync("modes.selectedLabel", { val: result.val, ack: true });
1731
+ adapter.setState("modes.selectedLabel", { val: result.val, ack: true });
1717
1732
  }
1718
1733
  });
1719
- //adapter.setStateAsync("modes.selectPreset", {val:null, ack: true});
1734
+ //adapter.setState("modes.selectPreset", {val:null, ack: true});
1720
1735
  //removed the following two lines to fix readPresets. Side effects tbs.
1721
1736
  //await this.getModePresets(item.value[0].u32[0], false);
1722
1737
  //await this.UpdatePreset();
@@ -1724,67 +1739,67 @@ class FrontierSilicon extends utils.Adapter {
1724
1739
  case "netremote.play.serviceids.ecc":
1725
1740
  break;
1726
1741
  case "netremote.play.info.text":
1727
- await this.setStateAsync("media.text", { val: item.value[0].c8_array[0].trim(), ack: true });
1742
+ await this.setState("media.text", { val: item.value[0].c8_array[0].trim(), ack: true });
1728
1743
  await this.callAPI("netRemote.play.info.artist")
1729
1744
  .then(function (result) {
1730
1745
  if(result !== null && result !== undefined && result.val !== null )
1731
1746
  {
1732
- adapter.setStateAsync("media.artist", { val: result.result.value[0].c8_array[0], ack: true });
1747
+ adapter.setState("media.artist", { val: result.result.value[0].c8_array[0], ack: true });
1733
1748
  }
1734
1749
  });
1735
1750
  await this.callAPI("netremote.sys.mode")
1736
1751
  .then(function (result) {
1737
1752
  if(result !== null && result !== undefined && result.val !== null )
1738
1753
  {
1739
- adapter.setStateAsync("modes.selected", { val: Number(result.result.value[0].u32[0]), ack: true });
1754
+ adapter.setState("modes.selected", { val: Number(result.result.value[0].u32[0]), ack: true });
1740
1755
  adapter.getStateAsync(`modes.${result.result.value[0].u32[0]}.label`)
1741
1756
  .then(function (result) {
1742
1757
  if(result !== null && result !== undefined && result.val !== null )
1743
1758
  {
1744
- adapter.setStateAsync("modes.selectedLabel", { val: result.val, ack: true });
1759
+ adapter.setState("modes.selectedLabel", { val: result.val, ack: true });
1745
1760
  }
1746
1761
  });
1747
- //adapter.setStateAsync("modes.selectPreset", {val:null, ack: true});
1762
+ //adapter.setState("modes.selectPreset", {val:null, ack: true});
1748
1763
  }
1749
1764
  });
1750
1765
  break;
1751
1766
  case "netremote.play.info.artist":
1752
- await this.setStateAsync("media.artist", { val: item.value[0].c8_array[0].trim(), ack: true });
1767
+ await this.setState("media.artist", { val: item.value[0].c8_array[0].trim(), ack: true });
1753
1768
  break;
1754
1769
  case "netremote.play.info.album":
1755
- await this.setStateAsync("media.album", { val: item.value[0].c8_array[0].trim(), ack: true });
1770
+ await this.setState("media.album", { val: item.value[0].c8_array[0].trim(), ack: true });
1756
1771
  break;
1757
1772
  case "netremote.play.info.title":
1758
- await this.setStateAsync("media.title", { val: item.value[0].c8_array[0].trim(), ack: true });
1773
+ await this.setState("media.title", { val: item.value[0].c8_array[0].trim(), ack: true });
1759
1774
  break;
1760
1775
  case "netremote.play.info.name":
1761
- await this.setStateAsync("media.name", { val: item.value[0].c8_array[0].trim(), ack: true });
1776
+ await this.setState("media.name", { val: item.value[0].c8_array[0].trim(), ack: true });
1762
1777
  await this.callAPI("netRemote.play.info.artist")
1763
1778
  .then(function (result) {
1764
1779
  if(result !== null && result !== undefined && result.val !== null )
1765
1780
  {
1766
- adapter.setStateAsync("media.artist", { val: result.result.value[0].c8_array[0], ack: true });
1781
+ adapter.setState("media.artist", { val: result.result.value[0].c8_array[0], ack: true });
1767
1782
  }
1768
1783
  });
1769
1784
  await this.callAPI("netRemote.play.info.album")
1770
1785
  .then(function (result) {
1771
1786
  if(result !== null && result !== undefined && result.val !== null )
1772
1787
  {
1773
- adapter.setStateAsync("media.album", { val: result.result.value[0].c8_array[0], ack: true });
1788
+ adapter.setState("media.album", { val: result.result.value[0].c8_array[0], ack: true });
1774
1789
  }
1775
1790
  });
1776
1791
  await this.callAPI("netremote.sys.audio.volume")
1777
1792
  .then(function (result) {
1778
1793
  if(result !== null && result !== undefined && result.val !== null )
1779
1794
  {
1780
- adapter.setStateAsync("audio.volume", { val: Number(result.result.value[0].u8[0]), ack: true });
1795
+ adapter.setState("audio.volume", { val: Number(result.result.value[0].u8[0]), ack: true });
1781
1796
  }
1782
1797
  });
1783
1798
  await this.callAPI("netremote.sys.audio.mute")
1784
1799
  .then(function (result) {
1785
1800
  if(result !== null && result !== undefined && result.val !== null )
1786
1801
  {
1787
- adapter.setStateAsync("audio.mute", { val: result.result.value[0].u8[0] == 1, ack: true });
1802
+ adapter.setState("audio.mute", { val: result.result.value[0].u8[0] == 1, ack: true });
1788
1803
  }
1789
1804
  });
1790
1805
 
@@ -1792,45 +1807,45 @@ class FrontierSilicon extends utils.Adapter {
1792
1807
  .then(function (result) {
1793
1808
  if(result !== null && result !== undefined && result.val !== null )
1794
1809
  {
1795
- adapter.setStateAsync("modes.selected", { val: Number(result.result.value[0].u32[0]), ack: true });
1810
+ adapter.setState("modes.selected", { val: Number(result.result.value[0].u32[0]), ack: true });
1796
1811
  adapter.getStateAsync(`modes.${result.result.value[0].u32[0]}.label`)
1797
1812
  .then(function (result) {
1798
1813
  if(result !== null && result !== undefined && result.val !== null )
1799
1814
  {
1800
- adapter.setStateAsync("modes.selectedLabel", { val: result.val, ack: true });
1815
+ adapter.setState("modes.selectedLabel", { val: result.val, ack: true });
1801
1816
  }
1802
1817
  });
1803
- //adapter.setStateAsync("modes.selectPreset", {val:null, ack: true});
1818
+ //adapter.setState("modes.selectPreset", {val:null, ack: true});
1804
1819
  }
1805
1820
  });
1806
1821
  await this.UpdatePreset(item.value[0].c8_array[0].trim());
1807
1822
  break;
1808
1823
  case "netremote.sys.audio.volume":
1809
- await this.setStateAsync("audio.volume", { val: Number(item.value[0].u8[0]), ack: true });
1824
+ await this.setState("audio.volume", { val: Number(item.value[0].u8[0]), ack: true });
1810
1825
  break;
1811
1826
  case "netremote.sys.audio.mute":
1812
- await this.setStateAsync("audio.mute", { val: item.value[0].u8[0] == 1, ack: true });
1827
+ await this.setState("audio.mute", { val: item.value[0].u8[0] == 1, ack: true });
1813
1828
  break;
1814
1829
  case "netremote.play.status":
1815
1830
  switch (item.value[0].u8[0])
1816
1831
  {
1817
1832
  // Play
1818
1833
  case "2":
1819
- await this.setStateAsync("media.state", { val: 1, ack: true });
1834
+ await this.setState("media.state", { val: 1, ack: true });
1820
1835
  break;
1821
1836
  // Pause
1822
1837
  case "3":
1823
- await this.setStateAsync("media.state", { val: 0, ack: true });
1838
+ await this.setState("media.state", { val: 0, ack: true });
1824
1839
  break;
1825
1840
  default:
1826
1841
  break;
1827
1842
  }
1828
1843
  break;
1829
1844
  case "netremote.sys.power":
1830
- await this.setStateAsync("device.power", { val: item.value[0].u8[0] == 1, ack: true });
1845
+ await this.setState("device.power", { val: item.value[0].u8[0] == 1, ack: true });
1831
1846
  break;
1832
1847
  case "netremote.play.info.graphicuri":
1833
- await this.setStateAsync("media.graphic", { val: item.value[0].c8_array[0].trim(), ack: true });
1848
+ await this.setState("media.graphic", { val: item.value[0].c8_array[0].trim(), ack: true });
1834
1849
  break;
1835
1850
  default:
1836
1851
  break;
@@ -1838,7 +1853,7 @@ class FrontierSilicon extends utils.Adapter {
1838
1853
  });
1839
1854
  this.callAPI("netRemote.play.info.graphicUri")
1840
1855
  .then(async function (result) {
1841
- await adapter.setStateAsync("media.graphic", { val: result.result.value[0].c8_array[0].trim(), ack: true });
1856
+ await adapter.setState("media.graphic", { val: result.result.value[0].c8_array[0].trim(), ack: true });
1842
1857
  });
1843
1858
  }
1844
1859
  }
@@ -1848,7 +1863,7 @@ class FrontierSilicon extends utils.Adapter {
1848
1863
  adapter.log.error(e.message);
1849
1864
  if(this.log.level=="debug" || this.log.level=="silly")
1850
1865
  {
1851
- await adapter.setStateAsync("debug.lastNotifyError", { val: JSON.stringify(e), ack: true });
1866
+ await adapter.setState("debug.lastNotifyError", { val: JSON.stringify(e), ack: true });
1852
1867
  }
1853
1868
  }
1854
1869
  finally
@@ -1880,21 +1895,21 @@ class FrontierSilicon extends utils.Adapter {
1880
1895
  {
1881
1896
  if(name === preset.val)
1882
1897
  {
1883
- await this.setStateAsync("modes.selectPreset", { val: i, ack:true});
1898
+ await this.setState("modes.selectPreset", { val: i, ack:true});
1884
1899
  break;
1885
1900
  }
1886
1901
  ++i;
1887
1902
  }
1888
1903
  else
1889
1904
  {
1890
- await this.setStateAsync("modes.selectPreset", { val: null, ack:true});
1905
+ await this.setState("modes.selectPreset", { val: null, ack:true});
1891
1906
  break;
1892
1907
  }
1893
1908
  }
1894
1909
  }
1895
1910
  else
1896
1911
  {
1897
- await this.setStateAsync("modes.selectPreset", { val: null, ack:true});
1912
+ await this.setState("modes.selectPreset", { val: null, ack:true});
1898
1913
  }
1899
1914
  }
1900
1915
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.frontier_silicon",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Provides support for media players equipped with a Frontier Silicon chipset using FSAPI.",
5
5
  "author": {
6
6
  "name": "halloamt",
@@ -9,6 +9,7 @@
9
9
  "homepage": "https://github.com/iobroker-community-adapters/ioBroker.frontier_silicon",
10
10
  "license": "MIT",
11
11
  "keywords": [
12
+ "ioBroker",
12
13
  "frontier silicon",
13
14
  "media player",
14
15
  "fsapi",
@@ -22,37 +23,46 @@
22
23
  "url": "git+https://github.com/iobroker-community-adapters/ioBroker.frontier_silicon.git"
23
24
  },
24
25
  "engines": {
25
- "node": ">= 16.0.0"
26
+ "node": ">= 18"
26
27
  },
27
28
  "dependencies": {
28
- "@iobroker/adapter-core": "^3.0.4",
29
- "axios": "^1.6.5",
29
+ "@iobroker/adapter-core": "^3.1.6",
30
+ "axios": "^1.7.4",
30
31
  "xml2js": "^0.6.2"
31
32
  },
32
33
  "devDependencies": {
33
- "@alcalzone/release-script": "^3.7.0",
34
- "@alcalzone/release-script-plugin-iobroker": "^3.7.0",
34
+ "@alcalzone/release-script": "^3.8.0",
35
+ "@alcalzone/release-script-plugin-iobroker": "^3.7.2",
35
36
  "@alcalzone/release-script-plugin-license": "^3.7.0",
36
37
  "@alcalzone/release-script-plugin-manual-review": "^3.7.0",
37
- "@iobroker/adapter-dev": "^1.2.0",
38
- "@iobroker/testing": "^4.1.0",
38
+ "@iobroker/adapter-dev": "^1.3.0",
39
+ "@iobroker/testing": "^4.1.3",
39
40
  "@types/chai": "^4.3.11",
40
41
  "@types/chai-as-promised": "^7.1.8",
41
- "@types/mocha": "^10.0.6",
42
- "@types/node": "^20.11.5",
42
+ "@types/mocha": "^10.0.7",
43
+ "@types/node": "^22.2.0",
43
44
  "@types/proxyquire": "^1.3.31",
44
45
  "@types/sinon": "^17.0.3",
45
46
  "@types/sinon-chai": "^3.2.12",
46
- "chai": "^4.4.1",
47
- "chai-as-promised": "^7.1.1",
48
- "eslint": "^8.56.0",
49
- "mocha": "^10.2.0",
47
+ "chai": "^4.5.0",
48
+ "chai-as-promised": "^7.1.2",
49
+ "eslint": "^8.57.0",
50
+ "mocha": "^10.7.3",
50
51
  "proxyquire": "^2.1.3",
51
- "sinon": "^17.0.1",
52
+ "sinon": "^18.0.0",
52
53
  "sinon-chai": "^3.7.0",
53
- "typescript": "^5.3.3"
54
+ "typescript": "^5.5.4"
54
55
  },
55
56
  "main": "main.js",
57
+ "files": [
58
+ "admin{,/!(src)/**}/!(tsconfig|tsconfig.*|.eslintrc).json",
59
+ "admin{,/!(src)/**}/*.{html,css,png,svg,jpg,js}",
60
+ "lib/",
61
+ "www/",
62
+ "io-package.json",
63
+ "LICENSE",
64
+ "main.js"
65
+ ],
56
66
  "scripts": {
57
67
  "test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
58
68
  "test:package": "mocha test/package --exit",
package/CHANGELOG_OLD.md DELETED
@@ -1,45 +0,0 @@
1
- # Older changes
2
- ## 0.0.10 (2020-11-29)
3
-
4
- - Translations
5
-
6
- ## 0.0.9
7
-
8
- - (halloamt) Selected preset can be read now. The adapter guesses a little but this seems to work.
9
-
10
- - (halloamt) Nicer readme
11
- - (halloamt) (Hopefully) more robust session handling.
12
- - (halloamt) Long polling should work more reliably
13
- - (halloamt) Sleep timers are cleared on `onUnload`
14
-
15
- ## 0.0.7 und 0.0.8
16
-
17
- - (halloamt) Formal but neccessary stuff for ioBroker
18
-
19
- ## 0.0.6
20
-
21
- - (halloamt) Nothing really, small stuff for npm
22
-
23
- ## 0.0.5
24
-
25
- - (halloamt) Media state controls
26
-
27
- - (halloamt) Bugfixes
28
-
29
- ## 0.0.4
30
-
31
- - (halloamt) Media and volume control buttons
32
-
33
- - (halloamt) Bugfixes
34
-
35
- ## 0.0.3
36
-
37
- - (halloamt) Get notifications from the radio
38
-
39
- - (halloamt) Change volume / mute
40
-
41
- ## 0.0.1
42
-
43
- - (halloamt) initial release
44
- - (halloamt) Change mode
45
- - (halloamt) Select Preset
package/admin/admin.d.ts DELETED
@@ -1,93 +0,0 @@
1
- declare let systemDictionary: Record<string, Record<string, string>>;
2
-
3
- declare let load: (settings: Record<string, unknown>, onChange: (hasChanges: boolean) => void) => void;
4
- declare let save: (callback: (settings: Record<string, unknown>) => void) => void;
5
-
6
- // make load and save exist on the window object
7
- interface Window {
8
- load: typeof load;
9
- save: typeof save;
10
- }
11
-
12
- declare const instance: number;
13
- declare const adapter: string;
14
- /** Translates text */
15
- declare function _(text: string): string;
16
- declare const socket: ioBrokerSocket;
17
- declare function sendTo(
18
- instance: any | null,
19
- command: string,
20
- message: any,
21
- callback: (result: SendToResult) => void | Promise<void>,
22
- ): void;
23
-
24
- interface SendToResult {
25
- error?: string | Error;
26
- result?: any;
27
- }
28
-
29
- // tslint:disable-next-line:class-name
30
- interface ioBrokerSocket {
31
- emit(
32
- command: "subscribeObjects",
33
- pattern: string,
34
- callback?: (err?: string) => void | Promise<void>,
35
- ): void;
36
- emit(
37
- command: "subscribeStates",
38
- pattern: string,
39
- callback?: (err?: string) => void | Promise<void>,
40
- ): void;
41
- emit(
42
- command: "unsubscribeObjects",
43
- pattern: string,
44
- callback?: (err?: string) => void | Promise<void>,
45
- ): void;
46
- emit(
47
- command: "unsubscribeStates",
48
- pattern: string,
49
- callback?: (err?: string) => void | Promise<void>,
50
- ): void;
51
-
52
- emit(
53
- event: "getObjectView",
54
- view: "system",
55
- type: "device",
56
- options: ioBroker.GetObjectViewParams,
57
- callback: (
58
- err: string | undefined,
59
- result?: any,
60
- ) => void | Promise<void>,
61
- ): void;
62
- emit(
63
- event: "getStates",
64
- callback: (
65
- err: string | undefined,
66
- result?: Record<string, any>,
67
- ) => void,
68
- ): void;
69
- emit(
70
- event: "getState",
71
- id: string,
72
- callback: (err: string | undefined, result?: ioBroker.State) => void,
73
- ): void;
74
- emit(
75
- event: "setState",
76
- id: string,
77
- state: unknown,
78
- callback: (err: string | undefined, result?: any) => void,
79
- ): void;
80
-
81
- on(event: "objectChange", handler: ioBroker.ObjectChangeHandler): void;
82
- on(event: "stateChange", handler: ioBroker.StateChangeHandler): void;
83
- removeEventHandler(
84
- event: "objectChange",
85
- handler: ioBroker.ObjectChangeHandler,
86
- ): void;
87
- removeEventHandler(
88
- event: "stateChange",
89
- handler: ioBroker.StateChangeHandler,
90
- ): void;
91
-
92
- // TODO: other events
93
- }
package/api/api DELETED
@@ -1,25 +0,0 @@
1
- Favoriten auslesen
2
- http://192.168.178.26/fsapi/LIST_GET_NEXT/netRemote.nav.presets/-1?pin=7389&sid=883168529&maxItems=10
3
-
4
- Nav ein
5
- http://192.168.178.26/fsapi/SET/netRemote.nav.state?pin=7389&sid=883168529&value=1
6
-
7
- Quellen auslesen
8
- http://192.168.178.26/fsapi/LIST_GET_NEXT/netRemote.sys.caps.validModes/-1?pin=7389&sid=682647964&maxItems=100
9
-
10
- aktuelle Quelle
11
- http://192.168.178.26/fsapi/GET/netRemote.sys.mode?pin=7389&sid=682647964
12
-
13
- Updates suchen
14
- http://192.168.178.26/fsapi/SET/netRemote.sys.isu.control?pin=7389&value=2
15
-
16
- Ein/Aus?
17
- http://192.168.178.26/fsapi/GET/netRemote.sys.power?pin=7389&sid=682647964
18
-
19
- Einschalten
20
- http://192.168.178.26/fsapi/SET/netRemote.sys.power?pin=7389&sid=883168529&value=0
21
-
22
- Doku
23
- https://github.com/flammy/fsapi/blob/master/FSAPI.md
24
- https://www.niehoff.nl/producthandleiding/PMR4000RMKII-03.pdf
25
- https://github.com/z1c0/FsApi/blob/master/FsApi/Command.cs
package/main.test.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- /**
4
- * This is a dummy TypeScript test file using chai and mocha
5
- *
6
- * It's automatically excluded from npm and its build output is excluded from both git and npm.
7
- * It is advised to test all your modules with accompanying *.test.js-files
8
- */
9
-
10
- // tslint:disable:no-unused-expression
11
-
12
- const { expect } = require("chai");
13
- // import { functionToTest } from "./moduleToTest";
14
-
15
- describe("module to test => function to test", () => {
16
- // initializing logic
17
- const expected = 5;
18
-
19
- it(`should return ${expected}`, () => {
20
- const result = 5;
21
- // assign result a value from functionToTest
22
- expect(result).to.equal(expected);
23
- // or using the should() syntax
24
- result.should.equal(expected);
25
- });
26
- // ... more tests => it
27
-
28
- });
29
-
30
- // ... more test suites => describe