[Plugin Tiers] yamaha remote
Re: Plugin yamaha remote
Bonjour,
Est ce que quelqu'un a sous la main les requêtes pour obtenir le statut de l'ampli ?
Marche ou Arret, entrée active, volume
Est ce que quelqu'un a sous la main les requêtes pour obtenir le statut de l'ampli ?
Marche ou Arret, entrée active, volume
Master : VM Debian ( Virtualbox) Ipx800 v2,zwave(vr,relaySwitch,oeil), xpl(oregon), x10(dimmer,relay), rfxcom(Lan) nodemcu , JPI
Re: Plugin yamaha remote
Pour mes scipts je me suis inspiré de ce post : http://www.touteladomotique.com/forum/v ... 14&t=11438
Il y a pas mal d'infos.
Si c'est des statuts que tu veux c'est avec des GET du genre : <YAMAHA_AV cmd="GET"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>
Un exemple de mon script d'allumage de l'ampli : curl -X POST http://xx.xx.xx.xx/YamahaRemoteControl/ctrl -d '{"post_data":"<YAMAHA_AV cmd="PUT"><System><Power_Control><Power>On</Power></Power_Control></System></YAMAHA_AV>"}'
Il y a pas mal d'infos.
Si c'est des statuts que tu veux c'est avec des GET du genre : <YAMAHA_AV cmd="GET"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>
Un exemple de mon script d'allumage de l'ampli : curl -X POST http://xx.xx.xx.xx/YamahaRemoteControl/ctrl -d '{"post_data":"<YAMAHA_AV cmd="PUT"><System><Power_Control><Power>On</Power></Power_Control></System></YAMAHA_AV>"}'
Gen8 Esxi + Z-Stick (GEN5) + RFXCOM
2 FGK, 2 FGMS, 2 FGD, 1 FGSD, 1 FGRM, Clavier RFID, 2 Greenwave 6, Sirène Gen5
2 FGK, 2 FGMS, 2 FGD, 1 FGSD, 1 FGRM, Clavier RFID, 2 Greenwave 6, Sirène Gen5
Re: Plugin yamaha remote
Code get
Je remonte les infos suivantes:
Etat: 1/0 (permet d'utiliser un binary pour la remontée des valeurs)
Volume
Mute
Input
Ce script sh permet de:
- Allumer/Eteindre
- Regler le volume avec bouton
- Regler le volume par curseur
- Mute on/off
Code PUT:
Je remonte les infos suivantes:
Etat: 1/0 (permet d'utiliser un binary pour la remontée des valeurs)
Volume
Mute
Input
Code : Tout sélectionner
<?php
function send_to_host($host,$method,$path='/',$data=''){
$buf="";
$method = strtoupper($method);
$fp = fsockopen($host, 80) or die("Unable to open socket");
fputs($fp, "$method $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: text/plain\r\n");
if ($method == 'POST') fputs($fp, "Content-length: " . strlen($data) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST') fputs($fp, $data);
while (!feof($fp))
$buf .= fgets($fp,256);
fclose($fp);
return $buf;
}
$command = '<YAMAHA_AV cmd="GET"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>';
$yamip = '192.168.2.55'; //IP de mon yamaha
$test = send_to_host($yamip.':80/YamahaRemoteControl/ctrl','POST','/YamahaRemoteControl/ctrl',$command);
$resul=explode("Connection: close",$test);// on explose la reponse pour séparé les entete HTTP et la reponse XML
$flux_programme_tnt = simplexml_load_string($resul[1]); // on ouvre le flux avec simple xml
$vol = $flux_programme_tnt->Main_Zone->Basic_Status->Volume->Lvl->Val; // on extrait la valeur voulu
$mute = $flux_programme_tnt->Main_Zone->Basic_Status->Volume->Mute; // on extrait la valeur voulu
$status = $flux_programme_tnt->Main_Zone->Basic_Status->Power_Control->Power; // on extrait la valeur voulu
$input = $flux_programme_tnt->Main_Zone->Basic_Status->Input->Input_Sel; // on extrait la valeur voulu
switch ($argv[1]) {
case "status":
if ($status == "On") {
echo 1;
} else {
echo 0;
}
break;
case "volume":
echo $vol;
break;
case "mute":
echo $mute ;
break;
case "input":
echo $input ;
break;
}
?>
- Allumer/Eteindre
- Regler le volume avec bouton
- Regler le volume par curseur
- Mute on/off
Code PUT:
Code : Tout sélectionner
#!/bin/bash
# rxvremote.sh : power ON/OFF mute vol up/down input select pour yamaha RX
declare VOL=0
VOL="$20"
VERSION="2016.05.20"
# Yamaha IP Address
IP="192.168.2.55"
URL="YamahaRemoteControl/ctrl"
ORDRE="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"
POWER_ON="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>On</Power></Power_Control></Main_Zone></YAMAHA_AV>"
POWER_OFF="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>Standby</Power></Power_Control></Main_Zone></YAMAHA_AV>"
VOLUME_MUTE="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Mute>On/Off</Mute></Volume></Main_Zone></YAMAHA_AV>"
VOLUME_UP="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>Up 5 dB</Val><Exp></Exp><Unit></Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>"
VOLUME_DOWN="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>Down 5 dB</Val><Exp></Exp><Unit></Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>"
INP_AV5="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AV5</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI1="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI1</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI2="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI2</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI3="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI3</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
STATUS="<YAMAHA_AV cmd=\"GET\"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>"
VOL_TRIM="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>$VOL</Val><Exp>1</Exp><Unit>dB</Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>"
if [[ $# -eq 1 && $1 == "ON" ]]; then
ORDRE+=$POWER_ON
echo "ON"
elif [[ $# -eq 1 && $1 == "OFF" ]]; then
ORDRE+=$POWER_OFF
echo "OFF"
elif [[ $# -eq 1 && $1 == "MUTE" ]]; then
ORDRE+=$VOLUME_MUTE
echo "MUTE"
elif [[ $# -eq 1 && $1 == "VOLUP" ]]; then
ORDRE+=$VOLUME_UP
echo "VOLUP"
elif [[ $# -eq 1 && $1 == "VOLDOWN" ]]; then
ORDRE+=$VOLUME_DOWN
echo "VOLDOWN"
elif [[ $# -eq 1 && $1 == "AV5" ]]; then
ORDRE+=$INP_AV5
echo "AV5"
elif [[ $# -eq 1 && $1 == "HDMI1" ]]; then
ORDRE+=$INP_HDMI1
echo "HDMI2"
elif [[ $# -eq 1 && $1 == "HDMI2" ]]; then
ORDRE+=$INP_HDMI2
echo "HDMI2"
elif [[ $# -eq 1 && $1 == "HDMI3" ]]; then
ORDRE+=$INP_HDMI3
echo "HDMI3"
elif [[ $# -eq 1 && $1 == "STATUS" ]]; then
ORDRE+=$STATUS
echo $STATUS
elif [[ $1 == "VOLTRIM" ]]; then
ORDRE+=$VOL_TRIM
else
echo -e "rien" && exit 0
fi
curl -v -H "Content-Type: text/xml" -X POST -d "${ORDRE}" http://${IP}/${URL}
echo
- Pièces jointes
-
- script4.png (45.18 Kio) Consulté 5548 fois
-
- script2.png (54.08 Kio) Consulté 5548 fois
-
- script1.png (44.33 Kio) Consulté 5548 fois
Re: Plugin yamaha remote
La suite:
- Pièces jointes
-
- script5.png (29.32 Kio) Consulté 5543 fois
-
- equipement.png (6.92 Kio) Consulté 5543 fois
Re: Plugin yamaha remote
Mon widget final avec Control des sources CEC (play, stop, pause, haut, bas, gauche, droite, select et return)
- Pièces jointes
-
- yamaha.png (13.89 Kio) Consulté 5520 fois
Re: Plugin yamaha remote
Pas mal , je vais essayer!
Master : VM Debian ( Virtualbox) Ipx800 v2,zwave(vr,relaySwitch,oeil), xpl(oregon), x10(dimmer,relay), rfxcom(Lan) nodemcu , JPI
Re: Plugin yamaha remote
hello!
je ne trouve pas le plugin, il a disparu du market place ?
je ne trouve pas le plugin, il a disparu du market place ?
Re: Plugin yamaha remote
oui plus personne ne sen occupe actuellement dsl moi aussi je suis deg
Re: Plugin yamaha remote
Bonjour,
Je suis à la recherche d'un script qui fonctionne.... juste une base pour débuter...
Si jamais ça peut servir à des personnes compétentes, j'ai la liste complétes des commandes PUT et GET.... trop lourde pour être postée ici.
A+
Je suis à la recherche d'un script qui fonctionne.... juste une base pour débuter...
Si jamais ça peut servir à des personnes compétentes, j'ai la liste complétes des commandes PUT et GET.... trop lourde pour être postée ici.
A+
Re: Plugin yamaha remote
Salut Auden69, voici ci-dessous un script que j'utilise pour allumer une net-radio chez moi.
Petite subtilité, j'éteins l'ampli et le rallume pour réinitialiser le volume.
Mon ampli RX-V673 est sur l'IP 192.168.1.4, visible dans la première fonction, je ne me suis pas embêté je l'ai mis en dur.
J'espère que c'est ce que tu attendais
Code : Tout sélectionner
function getYamaha($command)
{
$url = 'http://192.168.1.4/YamahaRemoteControl/ctrl';
$curl = getPostCurl($url, $command);
return curlHttpRequest($curl);
}
function curlHttpRequest($_curl) {
log::add('yamaharemote', 'debug', "Http Request : ".json_encode(curl_getinfo($_curl)));
$response = curl_exec($_curl);
if ($response == null) {
log::add('yamaharemote', 'error', "Reponse : ".curl_error($_curl) );
}
$header_size = curl_getinfo($_curl, CURLINFO_HEADER_SIZE);
curl_close($_curl);
$header = substr($response, 0, $header_size);
$response = substr($response, $header_size);
log::add('yamaharemote', 'debug', "Reponse : ".htmlspecialchars($response));
return $response;
}
function getPostCurl($_url,$_post){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HEADER=> 1,
CURLOPT_VERBOSE=> 1,
CURLOPT_URL => $_url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $_post,
CURLOPT_CONNECTTIMEOUT=> 300,
CURLOPT_FOLLOWLOCATION=> 1,
CURLOPT_FRESH_CONNECT => TRUE,
CURLOPT_HTTPHEADER=> array('HTTP/1.1 Content-Type: text/xml;charset="utf-8"'),
CURLOPT_RETURNTRANSFER => 1
)
);
return $curl;
}
try {
getYamaha('<YAMAHA_AV cmd="PUT"><Main_Zone><Power_Control><Power>Standby</Power></Power_Control></Main_Zone></YAMAHA_AV>'); sleep(1);
getYamaha('<YAMAHA_AV cmd="PUT"><Main_Zone><Power_Control><Power>On</Power></Power_Control></Main_Zone></YAMAHA_AV>'); sleep(1);
getYamaha('<YAMAHA_AV cmd="PUT"><Main_Zone><Input><Input_Sel>NET RADIO</Input_Sel></Input></Main_Zone></YAMAHA_AV>'); sleep(2);
getYamaha('<YAMAHA_AV cmd="PUT"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>'); sleep(2);
getYamaha('<YAMAHA_AV cmd="PUT"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>'); sleep(2);
getYamaha('<YAMAHA_AV cmd="PUT"><NET_RADIO><List_Control><Direct_Sel>Line_1</Direct_Sel></List_Control></NET_RADIO></YAMAHA_AV>'); sleep(2);
} catch (Exception $e) {
$scenario->setLog($e);
}
Re: Plugin yamaha remote
C'est curieux, les retours chariot dans le code ne fonctionnent pas, peut-être le nouveau look du forum. En citant mon message le code est indenté.
Re: Plugin yamaha remote
Merci, du coup j'ai avancé de mon coté, et merci pour l'astuce de citer le texte pour avoir la bonne mise en page du code....
Pour le moment ça fonctionne mais je dois encore vérifier quelques commandes...
Code : Tout sélectionner
#!/bin/bash
# yamaha-remote.sh : power ON/OFF a yamaha amplifier
#
# Author: Mr Xhark -> @xhark
# License : Creative Commons http://creativecommons.org/licenses/by-nd/4.0/deed.fr
# Website : http://blogmotion.fr
VERSION="2016.02.07"
# Yamaha IP Address
IP="192.168.1.113"
URL="YamahaRemoteControl/ctrl"
ORDRE="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"
POWER_ON="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>On</Power></Power_Control></Main_Zone></YAMAHA_AV>"
POWER_OFF="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>Standby</Power></Power_Control></Main_Zone></YAMAHA_AV>"
#VOLUME
MUTE=""<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Mute>On/Off</Mute></Volume></Main_Zone></YAMAHA_AV>""
VOLUME_UP="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>Up 5 dB</Val><Exp></Exp><Unit></Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>"
VOLUME_DOWN="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>Down 5 dB</Val><Exp></Exp><Unit></Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>"
#AUDIO
AUDIO_2ch_stereo="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Sound_Program>2ch Stereo</Sound_Program></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_7ch_stereo="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Sound_Program>7ch Stereo</Sound_Program></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_STRAIGHT_OFF="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Straight>Off</Straight></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_STRAIGHT_ON="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Straight>On</Straight></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_ENHANCER_OFF="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Enhancer>Off</Enhancer></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_ENHANCER_ON="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Enhancer>On</Enhancer></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_AUTO="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Decoder_Sel><Current>Auto</Current></Decoder_Sel></Input></Main_Zone></YAMAHA_AV>"
AUDIO_DTS="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Decoder_Sel><Current>DTS</Current></Decoder_Sel></Input></Main_Zone></YAMAHA_AV>"
#INPUT
INP_HDMI1="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI1</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI2="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI2</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI3="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI3</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI4="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI4</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI5="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI5</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI6="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI6</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AV1="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AV1</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AV2="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AV2</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AV3="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AV3</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AUDIO1="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AUDIO1</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AUDIO2="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AUDIO2</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_USB="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>USB</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_TUNER="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>TUNER</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
if [[ $# -eq 1 && $1 == "ON" ]]; then
ORDRE+=$POWER_ON
echo "ON"
elif [[ $# -eq 1 && $1 == "OFF" ]]; then
ORDRE+=$POWER_OFF
echo "OFF"
elif [[ $# -eq 1 && $1 == "HDMI1" ]]; then
ORDRE+=$INP_HDMI1
echo "HDMI1"
elif [[ $# -eq 1 && $1 == "HDMI2" ]]; then
ORDRE+=$INP_HDMI2
echo "HDMI2"
elif [[ $# -eq 1 && $1 == "HDMI3" ]]; then
ORDRE+=$INP_HDMI3
echo "HDMI3"
elif [[ $# -eq 1 && $1 == "HDMI4" ]]; then
ORDRE+=$INP_HDMI4
echo "HDMI4"
elif [[ $# -eq 1 && $1 == "HDMI5" ]]; then
ORDRE+=$INP_HDMI5
echo "HDMI5"
elif [[ $# -eq 1 && $1 == "HDMI6" ]]; then
ORDRE+=$INP_HDMI6
echo "HDMI6"
elif [[ $# -eq 1 && $1 == "USB" ]]; then
ORDRE+=$INP_USB
echo "USB"
elif [[ $# -eq 1 && $1 == "TUNER" ]]; then
ORDRE+=$INP_TUNER
echo "TUNER"
elif [[ $# -eq 1 && $1 == "AV1" ]]; then
ORDRE+=$INP_AV1
echo "AV1"
elif [[ $# -eq 1 && $1 == "AV2" ]]; then
ORDRE+=$INP_AV2
echo "AV2"
elif [[ $# -eq 1 && $1 == "AV3" ]]; then
ORDRE+=$INP_AV3
echo "AV3"
elif [[ $# -eq 1 && $1 == "AUDIO1" ]]; then
ORDRE+=$AUDIO1
echo "AUDIO1"
elif [[ $# -eq 1 && $1 == "AUDIO2" ]]; then
ORDRE+=$AUDIO2
echo "AUDIO2"
elif [[ $# -eq 1 && $1 == "MUTE" ]]; then
ORDRE+=$MUTE
echo "MUTE"
elif [[ $# -eq 1 && $1 == "VOLUME_UP" ]]; then
ORDRE+=$VOLUME_UP
echo "VOLUME_UP"
elif [[ $# -eq 1 && $1 == "VOLUME_DOWN" ]]; then
ORDRE+=$VOLUME_DOWN
echo "VOLUME_DOWN"
elif [[ $# -eq 1 && $1 == "AUDIO_STRAIGHT_OFF" ]]; then
ORDRE+=$AUDIO_STRAIGHT_OFF
echo "STRAIGHT_OFF"
elif [[ $# -eq 1 && $1 == "AUDIO_STRAIGHT_ON" ]]; then
ORDRE+=$AUDIO_STRAIGHT_ON
echo "STRAIGHT_ON"
elif [[ $# -eq 1 && $1 == "AUDIO_ENHANCER_ON" ]]; then
ORDRE+=$AUDIO_ENHANCER_ON
echo "ENHANCER_ON"
elif [[ $# -eq 1 && $1 == "AUDIO_ENHANCER_OFF" ]]; then
ORDRE+=$AUDIO_ENHANCER_OFF
echo "ENHANCER_OFF"
elif [[ $# -eq 1 && $1 == "AUDIO_AUTO" ]]; then
ORDRE+=$AUDIO_AUTO
echo "AUDIO_AUTO"
elif [[ $# -eq 1 && $1 == "AUDIO_DTS" ]]; then
ORDRE+=$AUDIO_DTS
echo "AUDIO_DTS"
else
echo -e "Usage : `basename $0` <ON>|<OFF>" && exit 0
fi
curl -v -H "Content-Type: text/xml" -X POST -d "${ORDRE}" http://${IP}/${URL}
echo
- maxredphenix
- Actif
- Messages : 539
- Inscription : 18 sept. 2015, 21:36
- Localisation : Bourgogne
Re: Plugin yamaha remote
Salut,
J'ai voulu tenté l'installation du plugin car je viens seulement d'avoir mon ampli et... mauvaise surprise.
Bref, je vais bien suivre le post pour avoir un script fonctionnel
J'ai voulu tenté l'installation du plugin car je viens seulement d'avoir mon ampli et... mauvaise surprise.
Bref, je vais bien suivre le post pour avoir un script fonctionnel
DIY Intel NUC i5 7Gen(via Proxmox) - Jeedom 3.2.
IPX800 v4 + 2 modules X-4FP
Détecteur fuite d'eau + fumée fibaro
Divers modules Zwave
IPX800 v4 + 2 modules X-4FP
Détecteur fuite d'eau + fumée fibaro
Divers modules Zwave
Re: [Plugin Tiers] yamaha remote
moi aussi je suis en attent lol trop deg
- maxredphenix
- Actif
- Messages : 539
- Inscription : 18 sept. 2015, 21:36
- Localisation : Bourgogne
Re: [Plugin Tiers] yamaha remote
Salut Auden69,
Je viens aux nouvelles
Est-ce que tu as avancé sur ton script ?
Merci
Je viens aux nouvelles
Est-ce que tu as avancé sur ton script ?
Merci
DIY Intel NUC i5 7Gen(via Proxmox) - Jeedom 3.2.
IPX800 v4 + 2 modules X-4FP
Détecteur fuite d'eau + fumée fibaro
Divers modules Zwave
IPX800 v4 + 2 modules X-4FP
Détecteur fuite d'eau + fumée fibaro
Divers modules Zwave
Re: Plugin yamaha remote
Salut,
Pas besoin d’être deg, mes scripts fonctionnent très bien, il faut juste mettre les mains dans le cambouis.
Ensuite il faut créer un device script
Pour info le 1er script info est du PHP et le 2eme action est en script shell.
Pas besoin d’être deg, mes scripts fonctionnent très bien, il faut juste mettre les mains dans le cambouis.
Ensuite il faut créer un device script
Pour info le 1er script info est du PHP et le 2eme action est en script shell.
byackee a écrit : ↑23 janv. 2017, 16:38Code get
Je remonte les infos suivantes:
Etat: 1/0 (permet d'utiliser un binary pour la remontée des valeurs)
Volume
Mute
Input
Ce script sh permet de:Code : Tout sélectionner
<?php function send_to_host($host,$method,$path='/',$data=''){ $buf=""; $method = strtoupper($method); $fp = fsockopen($host, 80) or die("Unable to open socket"); fputs($fp, "$method $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Content-type: text/plain\r\n"); if ($method == 'POST') fputs($fp, "Content-length: " . strlen($data) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); if ($method == 'POST') fputs($fp, $data); while (!feof($fp)) $buf .= fgets($fp,256); fclose($fp); return $buf; } $command = '<YAMAHA_AV cmd="GET"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>'; $yamip = '192.168.2.55'; //IP de mon yamaha $test = send_to_host($yamip.':80/YamahaRemoteControl/ctrl','POST','/YamahaRemoteControl/ctrl',$command); $resul=explode("Connection: close",$test);// on explose la reponse pour séparé les entete HTTP et la reponse XML $flux_programme_tnt = simplexml_load_string($resul[1]); // on ouvre le flux avec simple xml $vol = $flux_programme_tnt->Main_Zone->Basic_Status->Volume->Lvl->Val; // on extrait la valeur voulu $mute = $flux_programme_tnt->Main_Zone->Basic_Status->Volume->Mute; // on extrait la valeur voulu $status = $flux_programme_tnt->Main_Zone->Basic_Status->Power_Control->Power; // on extrait la valeur voulu $input = $flux_programme_tnt->Main_Zone->Basic_Status->Input->Input_Sel; // on extrait la valeur voulu switch ($argv[1]) { case "status": if ($status == "On") { echo 1; } else { echo 0; } break; case "volume": echo $vol; break; case "mute": echo $mute ; break; case "input": echo $input ; break; } ?>
- Allumer/Eteindre
- Regler le volume avec bouton
- Regler le volume par curseur
- Mute on/off
Code PUT:Code : Tout sélectionner
#!/bin/bash # rxvremote.sh : power ON/OFF mute vol up/down input select pour yamaha RX declare VOL=0 VOL="$20" VERSION="2016.05.20" # Yamaha IP Address IP="192.168.2.55" URL="YamahaRemoteControl/ctrl" ORDRE="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n" POWER_ON="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>On</Power></Power_Control></Main_Zone></YAMAHA_AV>" POWER_OFF="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>Standby</Power></Power_Control></Main_Zone></YAMAHA_AV>" VOLUME_MUTE="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Mute>On/Off</Mute></Volume></Main_Zone></YAMAHA_AV>" VOLUME_UP="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>Up 5 dB</Val><Exp></Exp><Unit></Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>" VOLUME_DOWN="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>Down 5 dB</Val><Exp></Exp><Unit></Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>" INP_AV5="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AV5</Input_Sel></Input></Main_Zone></YAMAHA_AV>" INP_HDMI1="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI1</Input_Sel></Input></Main_Zone></YAMAHA_AV>" INP_HDMI2="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI2</Input_Sel></Input></Main_Zone></YAMAHA_AV>" INP_HDMI3="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI3</Input_Sel></Input></Main_Zone></YAMAHA_AV>" STATUS="<YAMAHA_AV cmd=\"GET\"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>" VOL_TRIM="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>$VOL</Val><Exp>1</Exp><Unit>dB</Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>" if [[ $# -eq 1 && $1 == "ON" ]]; then ORDRE+=$POWER_ON echo "ON" elif [[ $# -eq 1 && $1 == "OFF" ]]; then ORDRE+=$POWER_OFF echo "OFF" elif [[ $# -eq 1 && $1 == "MUTE" ]]; then ORDRE+=$VOLUME_MUTE echo "MUTE" elif [[ $# -eq 1 && $1 == "VOLUP" ]]; then ORDRE+=$VOLUME_UP echo "VOLUP" elif [[ $# -eq 1 && $1 == "VOLDOWN" ]]; then ORDRE+=$VOLUME_DOWN echo "VOLDOWN" elif [[ $# -eq 1 && $1 == "AV5" ]]; then ORDRE+=$INP_AV5 echo "AV5" elif [[ $# -eq 1 && $1 == "HDMI1" ]]; then ORDRE+=$INP_HDMI1 echo "HDMI2" elif [[ $# -eq 1 && $1 == "HDMI2" ]]; then ORDRE+=$INP_HDMI2 echo "HDMI2" elif [[ $# -eq 1 && $1 == "HDMI3" ]]; then ORDRE+=$INP_HDMI3 echo "HDMI3" elif [[ $# -eq 1 && $1 == "STATUS" ]]; then ORDRE+=$STATUS echo $STATUS elif [[ $1 == "VOLTRIM" ]]; then ORDRE+=$VOL_TRIM else echo -e "rien" && exit 0 fi curl -v -H "Content-Type: text/xml" -X POST -d "${ORDRE}" http://${IP}/${URL} echo
- sfingers76
- Timide
- Messages : 61
- Inscription : 22 mai 2017, 09:45
Re: [Plugin Tiers] yamaha remote
Bonjour,
Testé sur mon RX-V673. Nickel. Commandes instantanées. Parfait pour automatiser l'allumage de l'ampli à mon réveil.
Merci donc pour ce script.
En revanche, sauriez vous me dire où peut on trouver la liste des commandes pour les amplis Yamaha ?
Testé sur mon RX-V673. Nickel. Commandes instantanées. Parfait pour automatiser l'allumage de l'ampli à mon réveil.
Merci donc pour ce script.
En revanche, sauriez vous me dire où peut on trouver la liste des commandes pour les amplis Yamaha ?
Maupertuis, ose et rit !
- sfingers76
- Timide
- Messages : 61
- Inscription : 22 mai 2017, 09:45
Re: [Plugin Tiers] yamaha remote
Bonjour à tous.
Réponse à moi même et info pour la communauté : http://www.awe-europe.com/documents/Con ... reland.zip
... et je n'avais pas vu le post de "auron007" qui donne déjà indirectement ce lien ...
Réponse à moi même et info pour la communauté : http://www.awe-europe.com/documents/Con ... reland.zip
... et je n'avais pas vu le post de "auron007" qui donne déjà indirectement ce lien ...
Maupertuis, ose et rit !
Re: [Plugin Tiers] yamaha remote
bonjour un petit tuto pour les nul comme moi car je c pas quoi faire des scripts et le utiliser je n'ai pas les bases merci
Re: [Plugin Tiers] yamaha remote
Bonsoir,
Si jamais ça peut aider :
Il faudra saisir à la main l'IP de son ampli dans chacun des deux scripts.
Les scripts ne sont pas des moi, je les ai juste modifier pour qu'ils fonctionnent chez moi.
Je m'en sers tous les jours avec ampli yamaya rx-v671 et ça fonctionne très bien depuis des mois....
Il faut avoir le plugin "script" d'installer :
yamaha_put.sh (qui permet d'envoyer des commandes) :
Mon fichier : yamaha_get.php qui permet d'interroger l'ampli (son status, entrée en cours...)
Ensuite, dans le plugin "mes scripts" j'ai crée un objet "ampli" où j'ai mis toutes les commandes.
Si jamais ça peut aider :
Il faudra saisir à la main l'IP de son ampli dans chacun des deux scripts.
Les scripts ne sont pas des moi, je les ai juste modifier pour qu'ils fonctionnent chez moi.
Je m'en sers tous les jours avec ampli yamaya rx-v671 et ça fonctionne très bien depuis des mois....
Il faut avoir le plugin "script" d'installer :
yamaha_put.sh (qui permet d'envoyer des commandes) :
Code : Tout sélectionner
#!/bin/bash
# yamaha-remote.sh : power ON/OFF a yamaha amplifier
#
# Author: Mr Xhark -> @xhark
# License : Creative Commons http://creativecommons.org/licenses/by-nd/4.0/deed.fr
# Website : http://blogmotion.fr
VERSION="2016.02.07"
# Yamaha IP Address
IP="192.168.1.113"
URL="YamahaRemoteControl/ctrl"
ORDRE="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"
POWER_ON="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>On</Power></Power_Control></Main_Zone></YAMAHA_AV>"
POWER_OFF="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>Standby</Power></Power_Control></Main_Zone></YAMAHA_AV>"
#VOLUME
MUTE="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Mute>On/Off</Mute></Volume></Main_Zone></YAMAHA_AV>"
VOLUME_UP="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>Up 2 dB</Val><Exp></Exp><Unit></Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>"
VOLUME_DOWN="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>Down 2 dB</Val><Exp></Exp><Unit></Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>"
#AUDIO
AUDIO_2ch_stereo="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Sound_Program>2ch Stereo</Sound_Program></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_7ch_stereo="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Sound_Program>7ch Stereo</Sound_Program></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_STRAIGHT_OFF="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Straight>Off</Straight></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_STRAIGHT_ON="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Straight>On</Straight></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_ENHANCER_OFF="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Enhancer>Off</Enhancer></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_ENHANCER_ON="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Surround><Program_Sel><Current><Enhancer>On</Enhancer></Current></Program_Sel></Surround></Main_Zone></YAMAHA_AV>"
AUDIO_AUTO="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Decoder_Sel><Current>Auto</Current></Decoder_Sel></Input></Main_Zone></YAMAHA_AV>"
AUDIO_DTS="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Decoder_Sel><Current>DTS</Current></Decoder_Sel></Input></Main_Zone></YAMAHA_AV>"
#INPUT
INP_HDMI1="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI1</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI2="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI2</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI3="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI3</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI4="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI4</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI5="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI5</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_HDMI6="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>HDMI6</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AV1="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AV1</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AV2="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AV2</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AV3="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AV3</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AUDIO1="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AUDIO1</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_AUDIO2="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>AUDIO2</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_USB="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>USB</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
INP_TUNER="<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Input><Input_Sel>TUNER</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
if [[ $# -eq 1 && $1 == "ON" ]]; then
ORDRE+=$POWER_ON
echo "ON"
elif [[ $# -eq 1 && $1 == "OFF" ]]; then
ORDRE+=$POWER_OFF
echo "OFF"
elif [[ $# -eq 1 && $1 == "HDMI1" ]]; then
ORDRE+=$INP_HDMI1
echo "HDMI1"
elif [[ $# -eq 1 && $1 == "HDMI2" ]]; then
ORDRE+=$INP_HDMI2
echo "HDMI2"
elif [[ $# -eq 1 && $1 == "HDMI3" ]]; then
ORDRE+=$INP_HDMI3
echo "HDMI3"
elif [[ $# -eq 1 && $1 == "HDMI4" ]]; then
ORDRE+=$INP_HDMI4
echo "HDMI4"
elif [[ $# -eq 1 && $1 == "HDMI5" ]]; then
ORDRE+=$INP_HDMI5
echo "HDMI5"
elif [[ $# -eq 1 && $1 == "HDMI6" ]]; then
ORDRE+=$INP_HDMI6
echo "HDMI6"
elif [[ $# -eq 1 && $1 == "USB" ]]; then
ORDRE+=$INP_USB
echo "USB"
elif [[ $# -eq 1 && $1 == "TUNER" ]]; then
ORDRE+=$INP_TUNER
echo "TUNER"
elif [[ $# -eq 1 && $1 == "AV1" ]]; then
ORDRE+=$INP_AV1
echo "AV1"
elif [[ $# -eq 1 && $1 == "AV2" ]]; then
ORDRE+=$INP_AV2
echo "AV2"
elif [[ $# -eq 1 && $1 == "AV3" ]]; then
ORDRE+=$INP_AV3
echo "AV3"
elif [[ $# -eq 1 && $1 == "AUDIO1" ]]; then
ORDRE+=$INP_AUDIO1
echo "AUDIO1"
elif [[ $# -eq 1 && $1 == "AUDIO2" ]]; then
ORDRE+=$INP_AUDIO2
echo "AUDIO2"
elif [[ $# -eq 1 && $1 == "MUTE" ]]; then
ORDRE+=$MUTE
echo "MUTE"
elif [[ $# -eq 1 && $1 == "VOLUME_UP" ]]; then
ORDRE+=$VOLUME_UP
echo "VOLUME_UP"
elif [[ $# -eq 1 && $1 == "VOLUME_DOWN" ]]; then
ORDRE+=$VOLUME_DOWN
echo "VOLUME_DOWN"
elif [[ $# -eq 1 && $1 == "AUDIO_2ch_stereo" ]]; then
ORDRE+=$AUDIO_2ch_stereo
echo "AUDIO_2ch_stereo"
elif [[ $# -eq 1 && $1 == "AUDIO_7ch_stereo" ]]; then
ORDRE+=$AUDIO_7ch_stereo
echo "AUDIO_7ch_stereo"
elif [[ $# -eq 1 && $1 == "AUDIO_STRAIGHT_OFF" ]]; then
ORDRE+=$AUDIO_STRAIGHT_OFF
echo "STRAIGHT_OFF"
elif [[ $# -eq 1 && $1 == "AUDIO_STRAIGHT_ON" ]]; then
ORDRE+=$AUDIO_STRAIGHT_ON
echo "STRAIGHT_ON"
elif [[ $# -eq 1 && $1 == "AUDIO_ENHANCER_ON" ]]; then
ORDRE+=$AUDIO_ENHANCER_ON
echo "ENHANCER_ON"
elif [[ $# -eq 1 && $1 == "AUDIO_ENHANCER_OFF" ]]; then
ORDRE+=$AUDIO_ENHANCER_OFF
echo "ENHANCER_OFF"
elif [[ $# -eq 1 && $1 == "AUDIO_AUTO" ]]; then
ORDRE+=$AUDIO_AUTO
echo "AUDIO_AUTO"
elif [[ $# -eq 1 && $1 == "AUDIO_DTS" ]]; then
ORDRE+=$AUDIO_DTS
echo "AUDIO_DTS"
else
echo -e "Usage : `basename $0` <ON>|<OFF>" && exit 0
fi
curl -v -H "Content-Type: text/xml" -X POST -d "${ORDRE}" http://${IP}/${URL}
echo
Code : Tout sélectionner
<?php
function send_to_host($host,$method,$path='/',$data=''){
$buf="";
$method = strtoupper($method);
$fp = fsockopen("192.168.1.113", 80) or die("Unable to open socket");
fputs($fp, "$method $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: text/plain\r\n");
if ($method == 'POST') fputs($fp, "Content-length: " . strlen($data) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST') fputs($fp, $data);
while (!feof($fp))
$buf .= fgets($fp,256);
fclose($fp);
return $buf;
}
$command = '<YAMAHA_AV cmd="GET"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>';
$yamip = '192.168.1.113'; //IP de mon yamaha
$test = send_to_host($yamip.':80/YamahaRemoteControl/ctrl','POST','/YamahaRemoteControl/ctrl',$command);
$resul=explode("Connection: close",$test);// on explose la reponse pour séparé les entete HTTP et la reponse XML
$flux_programme_tnt = simplexml_load_string($resul[1]); // on ouvre le flux avec simple xml
$vol = $flux_programme_tnt->Main_Zone->Basic_Status->Volume->Lvl->Val; // on extrait la valeur voulu
$mute = $flux_programme_tnt->Main_Zone->Basic_Status->Volume->Mute; // on extrait la valeur voulu
$status = $flux_programme_tnt->Main_Zone->Basic_Status->Power_Control->Power; // on extrait la valeur voulu
$input = $flux_programme_tnt->Main_Zone->Basic_Status->Input->Input_Sel; // on extrait la valeur voulu
switch ($argv[1]) {
case "status":
if ($status == "On") {
echo 1;
} else {
echo 0;
}
break;
case "volume":
echo $vol;
break;
case "mute":
echo $mute ;
break;
case "input":
echo $input ;
break;
}
Qui est en ligne ?
Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 3 invités