iobroker.yamaha 0.5.1 → 0.5.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/README.md +3 -0
- package/io-package.json +13 -13
- package/main.js +26 -17
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -43,6 +43,9 @@ You have to enable "network standby" function in the configuration of your recei
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
## Changelog
|
|
46
|
+
### 0.5.2 (2022-04-23)
|
|
47
|
+
* (Apollon77) Fix crash cases reported by Sentry
|
|
48
|
+
|
|
46
49
|
### 0.5.1 (2022-03-29)
|
|
47
50
|
* (Apollon77) Fix crash cases reported by Sentry
|
|
48
51
|
* (Sneak-L8) fix type of pureDirect
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "yamaha",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.5.2": {
|
|
7
|
+
"en": "Fix crash cases reported by Sentry",
|
|
8
|
+
"de": "Von Sentry gemeldete Absturzfälle beheben",
|
|
9
|
+
"ru": "Исправить случаи сбоев, о которых сообщил Sentry",
|
|
10
|
+
"pt": "Corrigir casos de travamento relatados pelo Sentinela",
|
|
11
|
+
"nl": "Herstel crashgevallen gemeld door Sentry",
|
|
12
|
+
"fr": "Correction des cas de plantage signalés par Sentry",
|
|
13
|
+
"it": "Risolvi i casi di crash segnalati da Sentry",
|
|
14
|
+
"es": "Solucionar casos de fallas informados por Sentry",
|
|
15
|
+
"pl": "Napraw przypadki awarii zgłoszone przez Sentry",
|
|
16
|
+
"zh-cn": "修复 Sentry 报告的崩溃案例"
|
|
17
|
+
},
|
|
6
18
|
"0.5.1": {
|
|
7
19
|
"en": "Fix crash cases reported by Sentry\nfix type of pureDirect",
|
|
8
20
|
"de": "Von Sentry gemeldete Absturzfälle beheben\nfixer Typ von pureDirect",
|
|
@@ -74,18 +86,6 @@
|
|
|
74
86
|
"es": "Registro de cambios agregado a Léame",
|
|
75
87
|
"pl": "Dziennik zmian dodany do readme",
|
|
76
88
|
"zh-cn": "更改日志添加到自述文件"
|
|
77
|
-
},
|
|
78
|
-
"0.3.18": {
|
|
79
|
-
"en": "Update utils.js and usage, CI Testing and deps (Apollon77)",
|
|
80
|
-
"de": "utils.js und Benutzung erneuert, CI Testing (Apollon77)",
|
|
81
|
-
"ru": "Обновите utils.js и использование, тестирование CI и deps (Apollon77)",
|
|
82
|
-
"pt": "Atualize utils.js e uso, teste de CI e deps (Apollon77)",
|
|
83
|
-
"nl": "Update utils.js en gebruik, CI-testen en deps (Apollon77)",
|
|
84
|
-
"fr": "Mise à jour utils.js et utilisation, CI Testing et deps (Apollon77)",
|
|
85
|
-
"it": "Aggiorna utils.js e utilizzo, test CI e deps (Apollon77)",
|
|
86
|
-
"es": "Actualice utils.js y uso, pruebas de CI y dependencias (Apollon77)",
|
|
87
|
-
"pl": "Zaktualizuj utils.js i wykorzystanie, CI Testing i deps (Apollon77)",
|
|
88
|
-
"zh-cn": "更新 utils.js 和用法、CI 测试和 deps (Apollon77)"
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"title": "Yamaha",
|
package/main.js
CHANGED
|
@@ -79,7 +79,7 @@ if (!YAMAHA.prototype.sendCommand) {
|
|
|
79
79
|
|
|
80
80
|
YAMAHA.prototype.sendCommand = function (command, zone) {
|
|
81
81
|
zone = getZone(zone);
|
|
82
|
-
var command =
|
|
82
|
+
var command = `<YAMAHA_AV cmd="PUT"><${zone}>${command}</${zone}></YAMAHA_AV>`;
|
|
83
83
|
return this.SendXMLToReceiver(command);
|
|
84
84
|
};
|
|
85
85
|
|
|
@@ -97,7 +97,7 @@ if (!YAMAHA.prototype.sendCommand) {
|
|
|
97
97
|
//var command = '<YAMAHA_AV cmd="PUT"><System><Misc><Remote_Signal><Receive><Code>' + code + '</Code></Receive></Remote_Signal></Misc></System></YAMAHA_AV>';
|
|
98
98
|
//var command = '<YAMAHA_AV cmd="PUT"><System><Remote_Signal><Receive><Code>' + code + '</Code></Receive></Remote_Signal></System></YAMAHA_AV>';
|
|
99
99
|
|
|
100
|
-
var command =
|
|
100
|
+
var command = `<YAMAHA_AV cmd="PUT"><System><Remote_Control><RC_Code>${code}</RC_Code></Remote_Control></System></YAMAHA_AV>`;
|
|
101
101
|
return this.SendXMLToReceiver(command);
|
|
102
102
|
};
|
|
103
103
|
|
|
@@ -105,11 +105,11 @@ if (!YAMAHA.prototype.sendCommand) {
|
|
|
105
105
|
return this.sendCommand('<Sound_Video><Pure_Direct><Mode>' + (bo ? 'On' : 'Off') + '</Mode></Pure_Direct></Sound_Video>');
|
|
106
106
|
};
|
|
107
107
|
YAMAHA.prototype.setHDMIOutput = function (no, bo) {
|
|
108
|
-
return this.sendCommand(
|
|
108
|
+
return this.sendCommand(`<Sound_Video><HDMI><Output><OUT_${no}>${bo ? 'On' : 'Off'}</OUT_${no}></Output></HDMI></Sound_Video>`, 'System');
|
|
109
109
|
};
|
|
110
110
|
YAMAHA.prototype.scene = function (no) {
|
|
111
111
|
adapter.setState('scene', '', true);
|
|
112
|
-
return this.sendCommand(
|
|
112
|
+
return this.sendCommand(`<Scene><Scene_Load>Scene ${no}</Scene_Load></Scene>`);
|
|
113
113
|
};
|
|
114
114
|
YAMAHA.prototype.power = function (bo, zone) {
|
|
115
115
|
return this.sendCommand('<Power_Control><Power>' + (bo ? 'On' : 'Standby') + '</Power></Power_Control>', zone);
|
|
@@ -124,7 +124,7 @@ if (!YAMAHA.prototype.sendCommand) {
|
|
|
124
124
|
else if (val < 90) val = '60 min';
|
|
125
125
|
else if (val < 120) val = '90 min';
|
|
126
126
|
else val = '120 min';
|
|
127
|
-
return this.sendCommand(
|
|
127
|
+
return this.sendCommand(`<Power_Control><Sleep>${val}</Sleep></Power_Control>`, zone);
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
}
|
|
@@ -132,7 +132,7 @@ if (!YAMAHA.prototype.sendCommand) {
|
|
|
132
132
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
133
133
|
|
|
134
134
|
YAMAHA.prototype.setSurround = function (val) {
|
|
135
|
-
return this.sendCommand(
|
|
135
|
+
return this.sendCommand(`<Surround><Program_Sel><Current><Sound_Program>${val}</Sound_Program></Current></Program_Sel></Surround>`, zone);
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
YAMAHA.prototype.YPAOVolume = function(bo){
|
|
@@ -162,7 +162,7 @@ YAMAHA.prototype.toggleMute = function () {
|
|
|
162
162
|
if (obj && typeof obj.val == 'boolean') {
|
|
163
163
|
this.setMute(! obj.val);
|
|
164
164
|
} else {
|
|
165
|
-
adapter.log.warn(
|
|
165
|
+
adapter.log.warn(`unknown mute value: ${obj.val}`);
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
|
|
@@ -288,7 +288,7 @@ YAMAHA.prototype.execCommand = function (id, val) {
|
|
|
288
288
|
var p = defaultParams;
|
|
289
289
|
p.val = val;
|
|
290
290
|
|
|
291
|
-
adapter.log.debug(
|
|
291
|
+
adapter.log.debug(`execCommand: id=${id} val=${val}`);
|
|
292
292
|
var commandName = ar[2];
|
|
293
293
|
|
|
294
294
|
switch(commandName) {
|
|
@@ -311,7 +311,7 @@ YAMAHA.prototype.execCommand = function (id, val) {
|
|
|
311
311
|
case 'raw': cmd = p.szVal; break;
|
|
312
312
|
default:
|
|
313
313
|
var szVal = p.szVal;
|
|
314
|
-
if (ar[4] === 'VOL' && szVal !== '?' && szVal.indexOf('.') < 0 && szVal.length < 4) szVal = szVal
|
|
314
|
+
if (ar[4] === 'VOL' && szVal !== '?' && szVal.indexOf('.') < 0 && szVal.length < 4) szVal = `${szVal}.0`;
|
|
315
315
|
cmd = soef.sprintf('@%s:%s=%s', ar[3], ar[4], szVal);
|
|
316
316
|
break;
|
|
317
317
|
}
|
|
@@ -331,12 +331,20 @@ YAMAHA.prototype.execCommand = function (id, val) {
|
|
|
331
331
|
if (p.bo) refreshStates();
|
|
332
332
|
break;
|
|
333
333
|
case "command":
|
|
334
|
+
if (typeof val !== 'string') {
|
|
335
|
+
adapter.log.warn(`command: val ${val}is not a string`);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
334
338
|
var a = p.val.split(' ');
|
|
335
|
-
this.execCommand(adapter.namespace
|
|
339
|
+
this.execCommand(`${adapter.namespace}.commands.${a[0]}`, a.length > 1 ? a[1] : false);
|
|
336
340
|
break;
|
|
337
341
|
case "xmlCommand":
|
|
342
|
+
if (typeof val !== 'string') {
|
|
343
|
+
adapter.log.warn(`xmlCommand: val ${val}is not a string`);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
338
346
|
val = val.replace(/\[/g, "<").replace(/]/g, ">");
|
|
339
|
-
var command =
|
|
347
|
+
var command = `<YAMAHA_AV cmd="PUT">${val}</YAMAHA_AV>`;
|
|
340
348
|
return this.SendXMLToReceiver(command);
|
|
341
349
|
case "zone":
|
|
342
350
|
zone = val;
|
|
@@ -353,7 +361,7 @@ YAMAHA.prototype.execCommand = function (id, val) {
|
|
|
353
361
|
return;
|
|
354
362
|
if (cmd.length > 0) {
|
|
355
363
|
if (! (typeof this[cmd[0]] === "function")) {
|
|
356
|
-
adapter.log.info(
|
|
364
|
+
adapter.log.info(`Command ${cmd[0]} not available at the moment: ${typeof this[cmd[0]]}`);
|
|
357
365
|
return;
|
|
358
366
|
}
|
|
359
367
|
}
|
|
@@ -411,7 +419,7 @@ function callWithCatch(origPromise, onSucess, onError){
|
|
|
411
419
|
onConnectionTimeout();
|
|
412
420
|
}
|
|
413
421
|
if (errorCount++ === 0) {
|
|
414
|
-
adapter.log.error(
|
|
422
|
+
adapter.log.error(`Can not connect to yamaha receiver at ${adapter.config.ip} ${error.message}`);
|
|
415
423
|
}
|
|
416
424
|
safeCallback(onError);
|
|
417
425
|
});
|
|
@@ -613,11 +621,11 @@ function runRealtimeFunction() {
|
|
|
613
621
|
y5.onData = function(data) {
|
|
614
622
|
setOnline(true);
|
|
615
623
|
data = data.toString().replace(/^@|\r|\n/g, '');
|
|
616
|
-
adapter.log.debug(
|
|
624
|
+
adapter.log.debug(`Rawdata: ${data}`);
|
|
617
625
|
var ar = data.split('@');
|
|
618
626
|
ar.forEach(function (v) {
|
|
619
627
|
dev.setChannel();
|
|
620
|
-
dev.set('raw',
|
|
628
|
+
dev.set('raw', `@${v}`);
|
|
621
629
|
handleRealtimeEvent(v);
|
|
622
630
|
//var a = /^@(.*):(.*)=(.*)/.exec(v);
|
|
623
631
|
var a = /(.*):(.*)=(.*)/.exec(v);
|
|
@@ -663,10 +671,11 @@ function normalizeConfig() {
|
|
|
663
671
|
|
|
664
672
|
|
|
665
673
|
function setPossibleStates(id, objarr, options, cb) {
|
|
666
|
-
if (options === undefined) options = {};
|
|
667
674
|
if (typeof options === 'function') {
|
|
668
675
|
cb = options;
|
|
669
676
|
options = {};
|
|
677
|
+
} else if (options === undefined) {
|
|
678
|
+
options = {};
|
|
670
679
|
}
|
|
671
680
|
adapter.getObject(id, function(err, obj) {
|
|
672
681
|
if (err || !obj) return;
|
|
@@ -692,7 +701,7 @@ function setPossibleStates(id, objarr, options, cb) {
|
|
|
692
701
|
}
|
|
693
702
|
|
|
694
703
|
function loadDesc() {
|
|
695
|
-
var url =
|
|
704
|
+
var url = `http://${adapter.config.ip}/YamahaRemoteControl/desc.xml`;
|
|
696
705
|
soef.getHttpData(url, {xml2json2: true }, function(err, data) {
|
|
697
706
|
if (err || !data) return;
|
|
698
707
|
var soundPrograms = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.yamaha",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "ioBroker Yamaha Adapter",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "soef",
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@alcalzone/release-script": "^3.5.6",
|
|
43
|
-
"@alcalzone/release-script-plugin-iobroker": "^3.5.
|
|
43
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.5.7",
|
|
44
44
|
"@alcalzone/release-script-plugin-license": "^3.5.3",
|
|
45
45
|
"@iobroker/testing": "^2.5.6",
|
|
46
46
|
"@types/chai": "^4.3.0",
|
|
47
47
|
"@types/chai-as-promised": "^7.1.5",
|
|
48
48
|
"@types/gulp": "^4.0.9",
|
|
49
49
|
"@types/mocha": "^9.1.0",
|
|
50
|
-
"@types/node": "^17.0.
|
|
50
|
+
"@types/node": "^17.0.23",
|
|
51
51
|
"@types/proxyquire": "^1.3.28",
|
|
52
52
|
"@types/sinon": "^10.0.11",
|
|
53
53
|
"@types/sinon-chai": "^3.2.8",
|
|
54
|
-
"axios": "^0.26.
|
|
54
|
+
"axios": "^0.26.1",
|
|
55
55
|
"chai": "^4.3.6",
|
|
56
56
|
"chai-as-promised": "^7.1.1",
|
|
57
|
-
"eslint": "^8.
|
|
57
|
+
"eslint": "^8.12.0",
|
|
58
58
|
"gulp": "^4.0.2",
|
|
59
|
-
"mocha": "^9.2.
|
|
59
|
+
"mocha": "^9.2.2",
|
|
60
60
|
"proxyquire": "^2.1.3",
|
|
61
61
|
"sinon-chai": "^3.7.0",
|
|
62
62
|
"sinon": "^13.0.1"
|