Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yamaha WX-010 Klingelton #18

Closed
sigi2345 opened this issue Dec 23, 2018 · 3 comments
Closed

Yamaha WX-010 Klingelton #18

sigi2345 opened this issue Dec 23, 2018 · 3 comments
Labels

Comments

@sigi2345
Copy link

sigi2345 commented Dec 23, 2018

Hallo,
Habe 2 Yamaha WX-010 und würde diese gerne für meine Haustürklingel benutzen. Es soll also beim Betätigen der Klingel ein Klingelton auf den Boxen abgespielt werden. Geht das?

@foxthefox
Copy link
Owner

Leider hat die Yamaha API kein Interface ähnlich text2speech wie es bei Sonos geht. Ideen hatte ich da schon, aber es braucht umfangreiches (reverse)-engineering.

@foxthefox
Copy link
Owner

Es geht evtl. doch wenn es einen DLNA Server im Netzwerk gibt. Dann kann man sich durch die Verzeichnisse hangeln und dann eine Datei abspielen. Sehr umständlich, aber geht.
Arbeite gerade an einer simplen Implementierung.

Mir schwebt eher ein Befehl playFile=datei.mp3 vor, aber da sind wir weit entfernt.

@foxthefox
Copy link
Owner

foxthefox commented Jan 30, 2019

Also es geht mit etwas scripting und nodejs8.

Zuvor ist über Browser zu ermitteln welchen Index man jeweils zum erreichen des mp3 benötigt.

Dazu die folgenden Befehle benutzen:

am Anfang dies nur 1x

http://IP/YamahaExtendedControl/v1/main/setInput?input=server&mode=autoplay_disabled

zum Anfang mit index 0 und später mit anderem index, zur Auswahl der nächsten Stufe

http://IP/YamahaExtendedControl/v1/netusb/setListControl?list_id=main&type=select&index=0

zur Anzeige des Verzeichnisses mit dem index, den man gerade gewählt hat

http://IP/YamahaExtendedControl/v1/netusb/getListInfo?input=server&index=0&size=8&lang=de

zum Abspielen des Songs mit dem entsprechenden Index

http://IP/YamahaExtendedControl/v1/netusb/setListControl?list_id=main&type=play&index=0

In meinem Fall ist es 5mal der select Aufruf und dann der Song ->0,0,0,0,0,0

var YamahaYXC = require('yamaha-yxc-nodejs');
yamaha = new YamahaYXC('IP'); //deine IP

var cmd = [0,0,0,0,0,0]; // hier die Abfolge aus dem vorherigen Test eintragen
var file = cmd.pop();

function setDisable() {
return new Promise(resolve => {
yamaha.setInput('server','main','autoplay_disabled').then(function (result) {
if (JSON.parse(result).response_code === 0) {
console.log('disable success ' + result);
resolve();
}
else { console.log('set disable bad '+result); }
resolve();
});
});
}

function listDir(index) {
return new Promise(resolve => {
yamaha.getListInfo('server', index, '8', 'en').then(function (result) {
if (JSON.parse(result).response_code === 0) {
console.log('list dir success '+index + result);
}
else { console.log('listDir bad ' + result); }
resolve();
});
});
}

function changeDir(index){
return new Promise(resolve => {
yamaha.setListControl('main','select',index).then(function(result) {
if (JSON.parse(result).response_code === 0 ){
console.log('dir change success ' +index+ result);
}
else {console.log('dir change bad '+ result);}
resolve();
});
})
}

function playFile(song){
return new Promise(resolve => {
yamaha.setListControl('main','play',song).then(function(result) {
if (JSON.parse(result).response_code === 0 ){
console.log('play file success' + song + result);
resolve();
}
else {console.log('playFile bad' + result);}
resolve();
});
});
}

function backToStart(cmd){
return new Promise(resolve => {
yamaha.setListControl('main','return').then(function(result) {
if (JSON.parse(result).response_code === 0 ){
console.log('rezurn success' + result);
}
else {console.log('return gone bad' + result);}
resolve();
});
});
}

async function playSong() {
await setDisable();
for(item in cmd){
if(item === 0){await listDir(0)}
else{await listDir(cmd[item-1]);}
await changeDir(cmd[item]);
if(item === cmd.length){}
else{await listDir(cmd[item]);}
}
await playFile(file);
}

playSong();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants