iobroker.denon 1.13.3 → 1.13.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 +3 -0
- package/io-package.json +13 -13
- package/lib/tools.js +8 -4
- package/lib/upnp.js +21 -23
- package/main.js +17 -15
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -908,6 +908,9 @@ 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.13.4 (2022-04-11)
|
|
912
|
+
* (foxriver76) we now respect `requestInterval` on determining the AVR model too
|
|
913
|
+
|
|
911
914
|
### 1.13.3 (2022-03-25)
|
|
912
915
|
* (foxriver76) fixed timeout beeing only applied on first reconnect (fixes #232)
|
|
913
916
|
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "denon",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.4",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.13.4": {
|
|
7
|
+
"en": "we now respect `requestInterval` on determining the AVR model too",
|
|
8
|
+
"de": "Wir berücksichtigen jetzt auch `requestInterval` bei der Bestimmung des AVR-Modells",
|
|
9
|
+
"ru": "теперь мы учитываем `requestInterval` и при определении модели AVR.",
|
|
10
|
+
"pt": "agora respeitamos `requestInterval` na determinação do modelo AVR também",
|
|
11
|
+
"nl": "we respecteren nu ook `requestInterval` bij het bepalen van het AVR-model",
|
|
12
|
+
"fr": "nous respectons maintenant `requestInterval` lors de la détermination du modèle AVR également",
|
|
13
|
+
"it": "ora rispettiamo anche `requestInterval` nel determinare il modello AVR",
|
|
14
|
+
"es": "ahora respetamos `requestInterval` al determinar el modelo AVR también",
|
|
15
|
+
"pl": "teraz szanujemy również „requestInterval” przy określaniu modelu AVR",
|
|
16
|
+
"zh-cn": "我们现在在确定 AVR 模型时也尊重`requestInterval`"
|
|
17
|
+
},
|
|
6
18
|
"1.13.3": {
|
|
7
19
|
"en": "fixed timeout beeing only applied on first reconnect (fixes #232)",
|
|
8
20
|
"de": "Behobenes Timeout, das nur beim ersten Reconnect angewendet wird (Fixes Nr. 232)",
|
|
@@ -74,18 +86,6 @@
|
|
|
74
86
|
"es": "introducimos estados de sintonizador\noptimizaciones de rendimiento",
|
|
75
87
|
"pl": "wprowadzamy stany tunera\noptymalizacje wydajności",
|
|
76
88
|
"zh-cn": "我们介绍调谐器状态\n性能优化"
|
|
77
|
-
},
|
|
78
|
-
"1.11.2": {
|
|
79
|
-
"en": "we fixed missing conversion to db on equalizer treble state for additional zones (fixes #162)",
|
|
80
|
-
"de": "wir haben die fehlende Konvertierung in db im Equalizer-Höhenzustand für zusätzliche Zonen behoben (Fixes Nr. 162)",
|
|
81
|
-
"ru": "мы исправили отсутствующее преобразование в db на высоких частотах эквалайзера для дополнительных зон (исправления # 162)",
|
|
82
|
-
"pt": "corrigimos a falta de conversão para db no estado de agudos do equalizador para zonas adicionais (correções # 162)",
|
|
83
|
-
"nl": "we hebben de ontbrekende conversie naar db opgelost in de treble-status van de equalizer voor extra zones (fixes #162)",
|
|
84
|
-
"fr": "nous avons corrigé la conversion manquante en db sur l'état des aigus de l'égaliseur pour les zones supplémentaires (corrections #162)",
|
|
85
|
-
"it": "abbiamo corretto la conversione mancante in db sullo stato degli alti dell'equalizzatore per zone aggiuntive (correzioni #162)",
|
|
86
|
-
"es": "arreglamos la conversión faltante a db en el estado de agudos del ecualizador para zonas adicionales (arreglos # 162)",
|
|
87
|
-
"pl": "naprawiliśmy brakującą konwersję do db na stanie sopranów korektora dla dodatkowych stref (poprawki #162)",
|
|
88
|
-
"zh-cn": "我们修复了额外区域的均衡器高音状态上缺少的 db 转换(修复 #162)"
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"title": "DENON AVR",
|
package/lib/tools.js
CHANGED
|
@@ -48,8 +48,10 @@ async function translateYandex(text, targetLang, yandex) {
|
|
|
48
48
|
targetLang = 'zh';
|
|
49
49
|
}
|
|
50
50
|
try {
|
|
51
|
-
const url = `https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandex}&text=${encodeURIComponent(
|
|
52
|
-
|
|
51
|
+
const url = `https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandex}&text=${encodeURIComponent(
|
|
52
|
+
text
|
|
53
|
+
)}&lang=en-${targetLang}`;
|
|
54
|
+
const response = await axios({ url, timeout: 15000 });
|
|
53
55
|
if (response.data && response.data['text']) {
|
|
54
56
|
return response.data['text'][0];
|
|
55
57
|
}
|
|
@@ -61,8 +63,10 @@ async function translateYandex(text, targetLang, yandex) {
|
|
|
61
63
|
|
|
62
64
|
async function translateGoogle(text, targetLang) {
|
|
63
65
|
try {
|
|
64
|
-
const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(
|
|
65
|
-
|
|
66
|
+
const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(
|
|
67
|
+
text
|
|
68
|
+
)}&ie=UTF-8&oe=UTF-8`;
|
|
69
|
+
const response = await axios({ url, timeout: 15000 });
|
|
66
70
|
if (isArray(response.data)) {
|
|
67
71
|
// we got a valid response
|
|
68
72
|
return response.data[0][0][0];
|
package/lib/upnp.js
CHANGED
|
@@ -17,21 +17,22 @@ function httpGet(link, timeout, callback) {
|
|
|
17
17
|
}
|
|
18
18
|
timeout = parseInt(timeout, 10) || 500;
|
|
19
19
|
|
|
20
|
-
const req = http
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const req = http
|
|
21
|
+
.get(link, res => {
|
|
22
|
+
const statusCode = res.statusCode;
|
|
23
|
+
|
|
24
|
+
if (statusCode !== 200) {
|
|
25
|
+
// consume response data to free up memory
|
|
26
|
+
res.resume();
|
|
27
|
+
callback(statusCode, null, link);
|
|
28
|
+
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
res.setEncoding('utf8');
|
|
31
|
+
let rawData = '';
|
|
32
|
+
res.on('data', chunk => (rawData += chunk));
|
|
33
|
+
res.on('end', () => callback && callback(null, rawData ? rawData.toString() : null));
|
|
34
|
+
})
|
|
35
|
+
.on('error', e => callback && callback(e.message, null));
|
|
35
36
|
|
|
36
37
|
req.setTimeout(timeout, () => {
|
|
37
38
|
this.abort();
|
|
@@ -102,8 +103,7 @@ function ssdpScan(text, readXml, timeout, callback) {
|
|
|
102
103
|
interfaces[iName].forEach(ipInfo => {
|
|
103
104
|
if (!ipInfo.internal && ipInfo.family === 'IPv4') {
|
|
104
105
|
(ip => {
|
|
105
|
-
|
|
106
|
-
const socket = dgram.createSocket({type: 'udp4', reuseAddr: true});
|
|
106
|
+
const socket = dgram.createSocket({ type: 'udp4', reuseAddr: true });
|
|
107
107
|
|
|
108
108
|
if (socket) {
|
|
109
109
|
socket.unref();
|
|
@@ -140,9 +140,8 @@ function ssdpScan(text, readXml, timeout, callback) {
|
|
|
140
140
|
msg = msg ? msg.toString() : '';
|
|
141
141
|
|
|
142
142
|
msg = msg.replace(/\r\n/g, '\n');
|
|
143
|
-
const device = {ip: rinfo.address};
|
|
143
|
+
const device = { ip: rinfo.address };
|
|
144
144
|
if (!result.find(dev => dev.ip === device.ip)) {
|
|
145
|
-
|
|
146
145
|
const lines = msg.split('\n');
|
|
147
146
|
const obj = {};
|
|
148
147
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -154,12 +153,12 @@ function ssdpScan(text, readXml, timeout, callback) {
|
|
|
154
153
|
}
|
|
155
154
|
}
|
|
156
155
|
device.data = obj;
|
|
157
|
-
console.log(
|
|
156
|
+
console.log(`Answer from ${device.ip}`);
|
|
158
157
|
result.push(device);
|
|
159
158
|
if (readXml && obj.LOCATION) {
|
|
160
159
|
httpGet(obj.LOCATION, timeout, (err, data) => {
|
|
161
160
|
if (err) {
|
|
162
|
-
console.error(
|
|
161
|
+
console.error(`No answer from ${device.ip}: ${JSON.stringify(err)}`);
|
|
163
162
|
} else if (data) {
|
|
164
163
|
device.xml = data.split('\n');
|
|
165
164
|
device.xml.forEach(line => {
|
|
@@ -173,7 +172,7 @@ function ssdpScan(text, readXml, timeout, callback) {
|
|
|
173
172
|
}
|
|
174
173
|
});
|
|
175
174
|
} else {
|
|
176
|
-
console.log(
|
|
175
|
+
console.log(`No answer from ${device.ip}`);
|
|
177
176
|
}
|
|
178
177
|
});
|
|
179
178
|
}
|
|
@@ -196,7 +195,6 @@ function ssdpScan(text, readXml, timeout, callback) {
|
|
|
196
195
|
socket.bind(19001, ip);
|
|
197
196
|
}
|
|
198
197
|
})(ipInfo.address);
|
|
199
|
-
|
|
200
198
|
}
|
|
201
199
|
});
|
|
202
200
|
});
|
|
@@ -216,4 +214,4 @@ function ssdpScan(text, readXml, timeout, callback) {
|
|
|
216
214
|
module.exports = {
|
|
217
215
|
ssdpScan,
|
|
218
216
|
httpGet
|
|
219
|
-
};
|
|
217
|
+
};
|
package/main.js
CHANGED
|
@@ -237,8 +237,7 @@ function startAdapter(options) {
|
|
|
237
237
|
break;
|
|
238
238
|
}
|
|
239
239
|
case 'zoneMain.quickSelect':
|
|
240
|
-
await
|
|
241
|
-
await sendRequest(`MSSMART${state}`);
|
|
240
|
+
await sendRequests([`MSQUICK${state}`, `MSSMART${state}`]);
|
|
242
241
|
break;
|
|
243
242
|
case 'zoneMain.equalizerBassUp':
|
|
244
243
|
await sendRequest('PSBAS UP');
|
|
@@ -584,8 +583,7 @@ function startAdapter(options) {
|
|
|
584
583
|
break;
|
|
585
584
|
}
|
|
586
585
|
case 'zone.quickSelect':
|
|
587
|
-
await
|
|
588
|
-
await sendRequest(`Z${zoneNumber}SMART${state}`);
|
|
586
|
+
await sendRequests([`Z${zoneNumber}QUICK${state}`, `Z${zoneNumber}SMART${state}`]);
|
|
589
587
|
break;
|
|
590
588
|
case 'zone.equalizerBassUp':
|
|
591
589
|
await sendRequest(`Z${zoneNumber}PSBAS UP`);
|
|
@@ -717,10 +715,7 @@ client.on('connect', async () => {
|
|
|
717
715
|
adapter.log.info(`[CONNECT] Adapter connected to DENON-AVR: ${host}:23`);
|
|
718
716
|
if (!receiverType) {
|
|
719
717
|
adapter.log.debug('[CONNECT] Connected --> Check receiver type');
|
|
720
|
-
await
|
|
721
|
-
await sendRequest('SV01?');
|
|
722
|
-
await sendRequest('BDSTATUS?');
|
|
723
|
-
await sendRequest('MV?');
|
|
718
|
+
await sendRequests(['SV?', 'SV01?', 'BDSTATUS?', 'MV?']);
|
|
724
719
|
} else {
|
|
725
720
|
adapter.log.debug('[CONNECT] Connected --> updating states on start');
|
|
726
721
|
updateStates(); // Update states when connected
|
|
@@ -899,10 +894,7 @@ const updateCommands = [
|
|
|
899
894
|
* Update all states by sending the defined updateCommands
|
|
900
895
|
*/
|
|
901
896
|
async function updateStates() {
|
|
902
|
-
|
|
903
|
-
await sendRequest(command);
|
|
904
|
-
await helper.wait(requestInterval);
|
|
905
|
-
}
|
|
897
|
+
await sendRequests(updateCommands);
|
|
906
898
|
} // endUpdateStates
|
|
907
899
|
|
|
908
900
|
const pollCommands = [
|
|
@@ -923,11 +915,21 @@ const pollCommands = [
|
|
|
923
915
|
async function pollStates() {
|
|
924
916
|
// Polls states
|
|
925
917
|
pollingVar = null;
|
|
926
|
-
|
|
927
|
-
|
|
918
|
+
await sendRequests(pollCommands);
|
|
919
|
+
} // endPollStates
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Send data array to socket respecting request interval
|
|
923
|
+
*
|
|
924
|
+
* @param {string[]} requests array of requests
|
|
925
|
+
* @return {Promise<void>}
|
|
926
|
+
*/
|
|
927
|
+
async function sendRequests(requests) {
|
|
928
|
+
for (const req of requests) {
|
|
929
|
+
await sendRequest(req);
|
|
928
930
|
await helper.wait(requestInterval);
|
|
929
931
|
}
|
|
930
|
-
}
|
|
932
|
+
}
|
|
931
933
|
|
|
932
934
|
/**
|
|
933
935
|
* Send data to socket
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.denon",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.4",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=10.0.0"
|
|
6
6
|
},
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"@iobroker/testing": "^2.5.6",
|
|
39
39
|
"axios": "^0.26.1",
|
|
40
40
|
"chai": "^4.3.6",
|
|
41
|
-
"eslint": "^8.
|
|
41
|
+
"eslint": "^8.13.0",
|
|
42
42
|
"eslint-config-prettier": "^8.5.0",
|
|
43
43
|
"eslint-plugin-prettier": "^4.0.0",
|
|
44
44
|
"gulp": "^4.0.2",
|
|
45
45
|
"mocha": "^9.2.2",
|
|
46
|
-
"prettier": "^2.6.
|
|
46
|
+
"prettier": "^2.6.2"
|
|
47
47
|
},
|
|
48
48
|
"main": "main.js",
|
|
49
49
|
"scripts": {
|