iobroker.denon 1.15.2 → 1.15.4

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
@@ -908,6 +908,12 @@ The adapter is tested with an DENON AVR-X1200W and a Marantz SR5009.
908
908
  Placeholder for the next version (at the beginning of the line):
909
909
  ### __WORK IN PROGRESS__
910
910
  -->
911
+ ### 1.15.4 (2023-08-19)
912
+ * (foxriver76) fixed detection of display content if content does not contain `NULL` (closes #323)
913
+
914
+ ### 1.15.3 (2023-07-13)
915
+ * (foxriver76) fixed log entry when setting channel volume states (closes #321)
916
+
911
917
  ### 1.15.2 (2023-06-12)
912
918
  * (foxriver76) fixed crash case with controller v5
913
919
 
package/build/main.js CHANGED
@@ -309,10 +309,9 @@ class Denon extends utils.Adapter {
309
309
  });
310
310
  this.client.on('data', data => {
311
311
  // split data by <cr>
312
- const dataArr = data.toString().split(/[\r\n]+/); // Split by Carriage Return
312
+ const dataArr = data.toString().split(/[\r\n]+/);
313
313
  for (const data of dataArr) {
314
314
  if (data) {
315
- // data not empty
316
315
  this.log.debug(`[DATA] <== Incoming data: ${data}`);
317
316
  this.handleResponse(data);
318
317
  }
@@ -412,6 +411,7 @@ class Denon extends utils.Adapter {
412
411
  const channel = id.substring(channelVolStartsWith.length);
413
412
  const command = this.CHANNEL_VOLUME_MAPPINGS[channel];
414
413
  await this.sendRequest(`CV${command} ${helper.dbToVol(stateVal)}`);
414
+ return;
415
415
  }
416
416
  switch (id) {
417
417
  case 'zoneMain.powerZone':
@@ -1399,7 +1399,7 @@ class Denon extends utils.Adapter {
1399
1399
  /**
1400
1400
  * Handle single response from AVR
1401
1401
  *
1402
- * @param data
1402
+ * @param data single data line
1403
1403
  */
1404
1404
  async handleResponse(data) {
1405
1405
  if (!this.pollTimer) {
@@ -1417,33 +1417,10 @@ class Denon extends utils.Adapter {
1417
1417
  }
1418
1418
  // Detect receiver type --> first poll is SV? and SV00?
1419
1419
  if (!this.receiverType) {
1420
- if (data.startsWith('SV') || /^MV\d+/g.test(data)) {
1421
- if (/^SV[\d]+/g.test(data)) {
1422
- this.receiverType = 'US';
1423
- await this.createStandardStates('US');
1424
- this.log.debug('[UPDATE] Updating states');
1425
- return void this.updateStates(); // Update states when connected
1426
- }
1427
- else {
1428
- this.receiverType = 'DE';
1429
- await this.createStandardStates('DE');
1430
- this.log.debug('[UPDATE] Updating states');
1431
- return void this.updateStates();
1432
- }
1433
- }
1434
- else if (data.startsWith('BDSTATUS')) {
1435
- // DENON Ceol Piccolo protocol detected , but we handle it as DE
1436
- this.receiverType = 'DE';
1437
- await this.createStandardStates('DE');
1438
- this.log.debug('[UPDATE] Updating states');
1439
- return void this.updateStates();
1440
- }
1441
- else {
1442
- return;
1443
- } // return if remote command received before response to SV (receiverCheck)
1420
+ return this.determineReceiverType(data);
1444
1421
  }
1445
1422
  else if (this.receiverType === 'US') {
1446
- return void this.handleUsResponse(data);
1423
+ return this.handleUsResponse(data);
1447
1424
  }
1448
1425
  // get command out of String
1449
1426
  let command;
@@ -1510,7 +1487,7 @@ class Denon extends utils.Adapter {
1510
1487
  }
1511
1488
  return;
1512
1489
  }
1513
- else if (command.startsWith('SI')) {
1490
+ if (command.startsWith('SI')) {
1514
1491
  // Handle select input
1515
1492
  let siCommand = data.substring(2); // Get only source name
1516
1493
  siCommand = siCommand.replace(' ', ''); // Remove blanks
@@ -1518,13 +1495,13 @@ class Denon extends utils.Adapter {
1518
1495
  this.setState('zoneMain.selectInput', siCommand, true);
1519
1496
  return;
1520
1497
  }
1521
- else if (command.startsWith('MS') && command !== 'MSQUICK' && command !== 'MSSMART') {
1498
+ if (command.startsWith('MS') && command !== 'MSQUICK' && command !== 'MSSMART') {
1522
1499
  // Handle Surround mode
1523
1500
  const msCommand = data.substring(2); // use data because ms can have digits and spaces
1524
1501
  this.setState('settings.surroundMode', msCommand, true);
1525
1502
  return;
1526
1503
  }
1527
- else if (command === 'MSQUICK' || command === 'MSSMART') {
1504
+ if (command === 'MSQUICK' || command === 'MSSMART') {
1528
1505
  const quickNr = parseInt(data.slice(-1));
1529
1506
  const state = await this.getStateAsync('zoneMain.quickSelect');
1530
1507
  if ((state === null || state === void 0 ? void 0 : state.val) === quickNr && (state === null || state === void 0 ? void 0 : state.ack)) {
@@ -1533,13 +1510,14 @@ class Denon extends utils.Adapter {
1533
1510
  this.setState('zoneMain.quickSelect', quickNr, true);
1534
1511
  return;
1535
1512
  }
1536
- else if (command.startsWith('NSE') && !command.startsWith('NSET')) {
1513
+ if (command.startsWith('NSE') && !command.startsWith('NSET')) {
1537
1514
  // Handle display content
1538
1515
  if (command === 'NSE') {
1539
1516
  // on older models it sometimes sends just NSE for unknown reasons - ignore it
1540
1517
  return;
1541
1518
  }
1542
- const displayCont = data.substring(4, data.indexOf('\0')).replace(/[\1\2]/g, ''); // Remove all STX, SOH, NULL
1519
+ // Remove all STX, SOH, NULL
1520
+ const displayCont = (data.includes('\0') ? data.substring(4, data.indexOf('\0')) : data.substring(4)).replace(/[\1\2]/g, '');
1543
1521
  const dispContNr = data.slice(3, 4);
1544
1522
  if (!this.capabilities.display) {
1545
1523
  await this.createDisplayAndHttp();
@@ -1547,30 +1525,30 @@ class Denon extends utils.Adapter {
1547
1525
  this.setState(`display.displayContent${dispContNr}`, displayCont, true);
1548
1526
  return;
1549
1527
  }
1550
- else if (command.startsWith('NSET')) {
1528
+ if (command.startsWith('NSET')) {
1551
1529
  // Network settings info
1552
1530
  return;
1553
1531
  }
1554
- else if (command.startsWith('SV')) {
1532
+ if (command.startsWith('SV')) {
1555
1533
  // Select Video
1556
1534
  return;
1557
1535
  }
1558
- else if (command.startsWith('NSFRN')) {
1536
+ if (command.startsWith('NSFRN')) {
1559
1537
  // Handle friendly name
1560
1538
  this.setState('info.friendlyName', data.substring(6), true);
1561
1539
  return;
1562
1540
  }
1563
- else if (command.startsWith('PSMULTEQ')) {
1541
+ if (command.startsWith('PSMULTEQ')) {
1564
1542
  const state = data.split(':')[1];
1565
1543
  this.setState('settings.multEq', state, true);
1566
1544
  return;
1567
1545
  }
1568
- else if (command.startsWith('PSDYNVOL')) {
1546
+ if (command.startsWith('PSDYNVOL')) {
1569
1547
  const state = data.split(' ')[1];
1570
1548
  this.setState('settings.dynamicVolume', state, true);
1571
1549
  return;
1572
1550
  }
1573
- else if (command.startsWith('VSMONI')) {
1551
+ if (command.startsWith('VSMONI')) {
1574
1552
  const state = data.substring(6);
1575
1553
  if (!this.capabilities.multiMonitor) {
1576
1554
  // make sure that state exists
@@ -1584,7 +1562,7 @@ class Denon extends utils.Adapter {
1584
1562
  }
1585
1563
  return;
1586
1564
  }
1587
- else if (command.startsWith('VSVPM')) {
1565
+ if (command.startsWith('VSVPM')) {
1588
1566
  const processingMode = data.substring(4);
1589
1567
  if (!this.capabilities.multiMonitor) {
1590
1568
  // make sure that state exists
@@ -1593,7 +1571,7 @@ class Denon extends utils.Adapter {
1593
1571
  this.setState('settings.videoProcessingMode', processingMode, true);
1594
1572
  return;
1595
1573
  }
1596
- else if (command.startsWith('PV') && command.length > 2) {
1574
+ if (command.startsWith('PV') && command.length > 2) {
1597
1575
  const pictureMode = data.substring(1);
1598
1576
  if (!this.capabilities.pictureMode) {
1599
1577
  await this.createPictureMode();
@@ -1607,7 +1585,7 @@ class Denon extends utils.Adapter {
1607
1585
  }
1608
1586
  return;
1609
1587
  }
1610
- else if (command.startsWith('NSH')) {
1588
+ if (command.startsWith('NSH')) {
1611
1589
  const presetNumber = parseInt(data.slice(3, 5));
1612
1590
  const state = await this.getStateAsync('info.onlinePresets');
1613
1591
  let knownPresets;
@@ -1629,19 +1607,19 @@ class Denon extends utils.Adapter {
1629
1607
  this.setState('info.onlinePresets', JSON.stringify(sortedPresets), true);
1630
1608
  return;
1631
1609
  }
1632
- else if (command.startsWith('TFANNAME')) {
1610
+ if (command.startsWith('TFANNAME')) {
1633
1611
  // get name only
1634
1612
  const stationName = data.substring(8);
1635
1613
  this.setState('tuner.stationName', stationName, true);
1636
1614
  return;
1637
1615
  }
1638
- else if (command === 'TFAN') {
1616
+ if (command === 'TFAN') {
1639
1617
  // example TFAN010690 -> 106.9 always 6 digits with 2 decimals
1640
1618
  const freq = parseFloat(`${data.substring(4, 8)}.${data.substring(8)}`);
1641
1619
  this.setState('tuner.frequency', freq, true);
1642
1620
  return;
1643
1621
  }
1644
- else if (command.startsWith('CV')) {
1622
+ if (command.startsWith('CV')) {
1645
1623
  const cvCmd = command.split(' ')[0].substring(2);
1646
1624
  const channel = this.CHANNEL_VOLUME_REMAPPING[cvCmd];
1647
1625
  if (!channel) {
@@ -1650,6 +1628,7 @@ class Denon extends utils.Adapter {
1650
1628
  }
1651
1629
  const channelVolume = data.split(' ')[1];
1652
1630
  this.setState(`zoneMain.channelVolume${channel}`, helper.volToDb(channelVolume), true);
1631
+ return;
1653
1632
  }
1654
1633
  let zoneNumber = '';
1655
1634
  if (/Z\d.+/g.test(command)) {
@@ -1858,6 +1837,38 @@ class Denon extends utils.Adapter {
1858
1837
  this.log.debug(`[INFO] <== Unhandled command ${command}`);
1859
1838
  }
1860
1839
  }
1840
+ /**
1841
+ * Handle single response from AVR
1842
+ *
1843
+ * @param data single data line
1844
+ */
1845
+ async determineReceiverType(data) {
1846
+ if (data.startsWith('SV') || /^MV\d+/g.test(data)) {
1847
+ if (/^SV[\d]+/g.test(data)) {
1848
+ this.receiverType = 'US';
1849
+ await this.createStandardStates('US');
1850
+ this.log.debug('[UPDATE] Updating states');
1851
+ return void this.updateStates(); // Update states when connected
1852
+ }
1853
+ else {
1854
+ this.receiverType = 'DE';
1855
+ await this.createStandardStates('DE');
1856
+ this.log.debug('[UPDATE] Updating states');
1857
+ return void this.updateStates();
1858
+ }
1859
+ }
1860
+ else if (data.startsWith('BDSTATUS')) {
1861
+ // DENON Ceol Piccolo protocol detected , but we handle it as DE
1862
+ this.receiverType = 'DE';
1863
+ await this.createStandardStates('DE');
1864
+ this.log.debug('[UPDATE] Updating states');
1865
+ return void this.updateStates();
1866
+ }
1867
+ else {
1868
+ // return if remote command received before response to SV (receiverCheck)
1869
+ return;
1870
+ }
1871
+ }
1861
1872
  /**
1862
1873
  * Create all zone specific objects for given zone
1863
1874
  *
package/io-package.json CHANGED
@@ -1,8 +1,34 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "denon",
4
- "version": "1.15.2",
4
+ "version": "1.15.4",
5
5
  "news": {
6
+ "1.15.4": {
7
+ "en": "fixed detection of display content if content does not contain `NULL` (closes #323)",
8
+ "de": "feste Erkennung von Anzeigeinhalten, wenn Inhalt NULL nicht enthält (schließt #323)",
9
+ "ru": "фиксированное обнаружение содержимого дисплея, если содержимое не содержит NULL (заметки #323)",
10
+ "pt": "detecção fixa de conteúdo de exibição se o conteúdo não contém NULL (fecha #323)",
11
+ "nl": "vertaling:",
12
+ "fr": "détection fixe de contenu d'affichage si le contenu ne contient pas de NULL (ferme #323)",
13
+ "it": "rilevamento fisso del contenuto di visualizzazione se il contenuto non contiene NULL (chiude #323)",
14
+ "es": "detección fija de contenido de pantalla si el contenido no contiene NULL (cerca #323)",
15
+ "pl": "ostateczne wykrywanie treści nie zawiera NULL (oznaczenie #323)",
16
+ "uk": "фіксоване виявлення вмісту дисплея, якщо вміст не містить NULL (закриває #323)",
17
+ "zh-cn": "如果内容不包含NULL(编号:第323号)的固定识别显示内容"
18
+ },
19
+ "1.15.3": {
20
+ "en": "fixed log entry when setting channel volume states (closes #321)",
21
+ "de": "fester log-eintrag beim einstellen von kanalvolumenzuständen (schließt #321)",
22
+ "ru": "фиксированный вход в систему при настройке состояния громкости канала (closes #321)",
23
+ "pt": "entrada de log fixo ao definir estados de volume de canal (fecha #321)",
24
+ "nl": "vertaling:",
25
+ "fr": "entrée en journal fixe lorsque le volume de canal indique (fermetures #321)",
26
+ "it": "voce di registro fissa quando si imposta il volume del canale stati (chiude #321)",
27
+ "es": "entrada de registro fijo cuando se establece el volumen del canal (cerca #321)",
28
+ "pl": "stworzona wersja logna, w której ustawione są stany kanałowe (zamknia #321)",
29
+ "uk": "фіксований запис журналу при встановленні об'ємних станів каналу (закривається #321)",
30
+ "zh-cn": "配量国时的固定标志(第321号)"
31
+ },
6
32
  "1.15.2": {
7
33
  "en": "fixed crash case with controller v5",
8
34
  "de": "fester crashfall mit controller v5",
@@ -66,30 +92,6 @@
66
92
  "es": "ahora respetamos `requestInterval` al determinar el modelo AVR también",
67
93
  "pl": "teraz szanujemy również „requestInterval” przy określaniu modelu AVR",
68
94
  "zh-cn": "我们现在在确定 AVR 模型时也尊重`requestInterval`"
69
- },
70
- "1.13.3": {
71
- "en": "fixed timeout beeing only applied on first reconnect (fixes #232)",
72
- "de": "Behobenes Timeout, das nur beim ersten Reconnect angewendet wird (Fixes Nr. 232)",
73
- "ru": "фиксированный тайм-аут применяется только при первом повторном подключении (исправления № 232)",
74
- "pt": "tempo limite fixo sendo aplicado apenas na primeira reconexão (correções #232)",
75
- "nl": "vaste time-out wordt alleen toegepast bij de eerste keer opnieuw verbinden (fixt #232)",
76
- "fr": "le délai d'attente fixe n'est appliqué qu'à la première reconnexion (corrections #232)",
77
- "it": "timeout fisso applicato solo alla prima riconnessione (correzioni n. 232)",
78
- "es": "el tiempo de espera fijo solo se aplica en la primera reconexión (correcciones # 232)",
79
- "pl": "naprawiony limit czasu stosowany tylko przy pierwszym ponownym połączeniu (poprawki #232)",
80
- "zh-cn": "固定超时蜂鸣仅适用于第一次重新连接(修复#232)"
81
- },
82
- "1.13.2": {
83
- "en": "fixed requesting interval",
84
- "de": "festes Abfrageintervall",
85
- "ru": "фиксированный интервал запроса",
86
- "pt": "intervalo de solicitação fixo",
87
- "nl": "vast verzoekinterval",
88
- "fr": "intervalle de demande fixe",
89
- "it": "intervallo di richiesta fisso",
90
- "es": "intervalo de solicitud fijo",
91
- "pl": "naprawiono interwał żądań",
92
- "zh-cn": "固定请求间隔"
93
95
  }
94
96
  },
95
97
  "title": "DENON AVR",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.denon",
3
- "version": "1.15.2",
3
+ "version": "1.15.4",
4
4
  "engines": {
5
5
  "node": ">=14.0.0"
6
6
  },
@@ -41,12 +41,12 @@
41
41
  "@typescript-eslint/parser": "^5.48.0",
42
42
  "axios": "^0.26.1",
43
43
  "chai": "^4.3.6",
44
- "eslint": "^8.13.0",
45
- "eslint-config-prettier": "^8.5.0",
46
- "eslint-plugin-prettier": "^4.0.0",
44
+ "eslint": "^8.47.0",
45
+ "eslint-config-prettier": "^9.0.0",
46
+ "eslint-plugin-prettier": "^5.0.0",
47
47
  "gulp": "^4.0.2",
48
48
  "mocha": "^9.2.2",
49
- "prettier": "^2.6.2",
49
+ "prettier": "^3.0.2",
50
50
  "ts-node": "^10.9.1",
51
51
  "typescript": "^4.9.4"
52
52
  },