Hi,
habe mich nun doch mal daran gewagt...
Ein paar kleine Änderungen in der pioneer-avr.js Datei und das Script erweitert.
Hier die pioneer-avr.js ( IoBroker stoppen, diese mit der alten überschreiben, IB wieder starten )
pioneer-avr.js
Hier das Script :
/*
script needs stormboy/node-pioneer-avr package.
see https://github.com/stormboy/node-pioneer-avr
To install, excecute the following command in /opt/iobroker/node_modules:
npm install https://github.com/stormboy/node-pioneer-avr.git
*/
//path to node-pioneer-avr package
var avr = require("../../pioneer-avr");
//new iobroker states
createState('pioneer.volumeUp'); //set to true to increase Volume
createState('pioneer.volumeDown'); //set to true to decrease Volume
createState('pioneer.setVolume'); //set Volume as numeric value. [0 .. 185] 1 = -80dB , 161 = 0dB, 185 = +12dB
createState('pioneer.muteOn'); //set to true to Mute receiver
createState('pioneer.muteOff'); //set to true to unMute receiver
createState('pioneer.turnOn'); //set to true to turn receiver on
createState('pioneer.turnOff'); //set to true to turn receiver off
createState('pioneer.setInput'); //set new input as numeric value (see below)
createState('pioneer.onState'); //Status On/Off
createState('pioneer.inputState'); //Current Input State
createState('pioneer.buttonHMGEnter'); //Enter Button in HMG
createState('pioneer.buttonHMGReturn'); //Return Button in HMG
createState('pioneer.buttonHMGUp'); //Up Button in HMG
createState('pioneer.buttonHMGDown'); //Down Button in HMG
createState('pioneer.buttonHMGPlay'); //Play Button in HMG
createState('pioneer.buttonHMGStop'); //Stop Button in HMG
createState('pioneer.buttonHMG1'); //'1' Button in HMG
createState('pioneer.listeningStereo'); //Set Listening Stereo Mode
createState('pioneer.listeningNeo6m'); //Set Listening Neo 6 Music Mode
createState('pioneer.listeningDolbypm'); //Set Listening Prologic Movie Mode
createState('pioneer.buttonTuner1'); //Set Tuner Preset 1
createState('pioneer.buttonTuner2'); //Set Tuner Preset 2
createState('pioneer.buttonTuner3'); //Set Tuner Preset 3
createState('pioneer.buttonTuner4'); //Set Tuner Preset 4
createState('pioneer.buttonTuner5'); //Set Tuner Preset 5
createState('pioneer.buttonTuner6'); //Set Tuner Preset 6
createState('pioneer.buttonTuner7'); //Set Tuner Preset 7
createState('pioneer.buttonTuner8'); //Set Tuner Preset 8
createState('pioneer.buttonTuner9'); //Set Tuner Preset 9
createState('pioneer.buttonTuner0'); //Set Tuner Preset 0
//Options
var options = {
port: 8102,
host: "192.168.xxx.xxx",
log: true
};
var receiver = new avr.VSX(options);
//trigger on connection
receiver.on("connect", function() {
console.log("receiver connected");
});
//trigger on Input change
receiver.on("input", function(id, name) {
console.log("current input: " + id + " : " + name);
setState('javascript.0.pioneer.inputState', id + " : " + name);
});
//trigger on power change
receiver.on("power", function(pwrstate) {
console.log("Power: " + pwrstate);
setState('javascript.0.pioneer.onState', pwrstate);
});
//inc Vol
on({ id: 'javascript.0.pioneer.volumeUp', change: "any" }, function(obj) {
var value = obj.state.val;
console.log("VolUp: " + value);
for (var i = 0; i < value; i++) {
receiver.volumeUp();
}
});
//dec Vol
on({ id: 'javascript.0.pioneer.volumeDown', change: "any" }, function(obj) {
var value = obj.state.val;
console.log("VolDown: " + value);
for (var i = 0; i < value; i++) {
receiver.volumeDown();
}
});
//Set Volume
//[0 .. 185] 1 = -80dB , 161 = 0dB, 185 = +12dB
on({ id: 'javascript.0.pioneer.setVolume', change: "any" }, function(obj) {
var value = obj.state.val;
console.log("Volume: " + value);
receiver.volume(value);
});
//Turn On
on({ id: 'javascript.0.pioneer.turnOn', val: true }, function(obj) {
receiver.power(true);
});
//Turn Off
on({ id: 'javascript.0.pioneer.turnOff', val: true }, function(obj) {
receiver.power(false);
});
//Mute On
on({ id: 'javascript.0.pioneer.muteOn', val: true }, function(obj) {
receiver.mute(true);
});
//Mute Off
on({ id: 'javascript.0.pioneer.muteOff', val: true }, function(obj) {
receiver.mute(false);
});
/* Input Codes
phono: "00",
cd: "01",
tuner: "02",
cdr_tape: "03",
dvd: "04",
tv_sat: "05",
video_1: "10",
multi_ch: "12",
video_2: "14",
dvr_bdr: "15",
ipod_usb: "17",
hdmi_1: "19",
hdmi_2: "20",
hdmi_3: "21",
hdmi_4: "22",
hdmi_5: "23",
bd: "25",
hdmi_cyclic: "31",
adapter_port: "33",
internet: "38",
sirius: "40",
pandora: "41",
home_media: "44",
favorites: "45",
*/
//Set Input
on({ id: 'javascript.0.pioneer.setInput', change: "ne" }, function(obj) {
var value = obj.state.val;
console.log(value);
console.log(receiver.queryInputName());
receiver.selectInput(value);
});
//Press Button Enter HMG
on({ id: 'javascript.0.pioneer.buttonHMGEnter', val: true }, function(obj) {
console.log("Press Button HMG Enter");
receiver.buttonHMGEnter();
});
//Press Button Return HMG
on({ id: 'javascript.0.pioneer.buttonHMGReturn', val: true }, function(obj) {
console.log("Press Button HMG Return");
receiver.buttonHMGReturn();
});
//Press Button Play HMG
on({ id: 'javascript.0.pioneer.buttonHMGPlay', val: true }, function(obj) {
console.log("Press Button HMG Play");
receiver.buttonHMGPlay();
});
//Press Button Stop HMG
on({ id: 'javascript.0.pioneer.buttonHMGStop', val: true }, function(obj) {
console.log("Press Button HMG Stop");
receiver.buttonHMGStop();
});
//Press Button Up HMG
on({ id: 'javascript.0.pioneer.buttonHMGUp', val: true }, function(obj) {
console.log("Press Button HMG Up");
receiver.buttonHMGUp();
});
//Press Button Down HMG
on({ id: 'javascript.0.pioneer.buttonHMGDown', val: true }, function(obj) {
console.log("Press Button HMG Down");
receiver.buttonHMGDown();
});
//Press Button 1 HMG
on({ id: 'javascript.0.pioneer.buttonHMG1', val: true }, function(obj) {
console.log("Press Button HMG '1'");
receiver.buttonHMG1();
});
//Set Listening Stereo Mode
on({ id: 'javascript.0.pioneer.listeningStereo', val: true }, function(obj) {
console.log("Set Listening Stereo Mode");
receiver.listeningStereo();
});
//Set Listening Neo 6 Music Mode
on({ id: 'javascript.0.pioneer.listeningNeo6m', val: true }, function(obj) {
console.log("Set Listening Neo 6 Music Mode");
receiver.listeningNeo6m();
});
//Set Listening Dolby Prologic Movie Mode
on({ id: 'javascript.0.pioneer.listeningDolbypm', val: true }, function(obj) {
console.log("Set Listening Dolby Prologic Movie Mode");
receiver.listeningDolbypm();
});
//Set Tuner Preset 1
on({ id: 'javascript.0.pioneer.buttonTuner1', val: true }, function(obj) {
console.log("Set Tuner Preset '1'");
receiver.buttonTuner1();
});
//Set Tuner Preset 2
on({ id: 'javascript.0.pioneer.buttonTuner2', val: true }, function(obj) {
console.log("Set Tuner Preset '2'");
receiver.buttonTuner2();
});
//Set Tuner Preset 3
on({ id: 'javascript.0.pioneer.buttonTuner3', val: true }, function(obj) {
console.log("Set Tuner Preset '3'");
receiver.buttonTuner3();
});
//Set Tuner Preset 4
on({ id: 'javascript.0.pioneer.buttonTuner4', val: true }, function(obj) {
console.log("Set Tuner Preset '4'");
receiver.buttonTuner4();
});
//Set Tuner Preset 5
on({ id: 'javascript.0.pioneer.buttonTuner5', val: true }, function(obj) {
console.log("Set Tuner Preset '5'");
receiver.buttonTuner5();
});
//Set Tuner Preset 6
on({ id: 'javascript.0.pioneer.buttonTuner1', val: true }, function(obj) {
console.log("Set Tuner Preset '6'");
receiver.buttonTuner6();
});
//Set Tuner Preset 7
on({ id: 'javascript.0.pioneer.buttonTuner7', val: true }, function(obj) {
console.log("Set Tuner Preset '7'");
receiver.buttonTuner7();
});
//Set Tuner Preset 8
on({ id: 'javascript.0.pioneer.buttonTuner8', val: true }, function(obj) {
console.log("Set Tuner Preset '8'");
receiver.buttonTuner8();
});
//Set Tuner Preset 9
on({ id: 'javascript.0.pioneer.buttonTuner9', val: true }, function(obj) {
console.log("Set Tuner Preset '9'");
receiver.buttonTuner9();
});
//Set Tuner Preset 0
on({ id: 'javascript.0.pioneer.buttonTuner0', val: true }, function(obj) {
console.log("Set Tuner Preset '0'");
receiver.buttonTuner0();
});
Altes ersetzen und die IP Adresse ( 192.168.xxx.xxx ) anpassen.
Natürlich vorher für alle Fälle die alten Sachen sichern.
Läuft bei mir echt gut und ohne Verzögerungen.
Hier auch noch ein Screenshot: