From bd0a43a22ee7be1b8652d1ff28d509cbdd2a5b1c Mon Sep 17 00:00:00 2001 From: markusbloch <> Date: Sun, 17 Aug 2014 11:26:43 +0000 Subject: [PATCH] YAMAHA_AVR: display inputName for model RX-V2065; log http response status codes; fix permanent input/scene query git-svn-id: https://svn.fhem.de/fhem/trunk@6413 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/71_YAMAHA_AVR.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm index 353e78987..57e73fcf6 100755 --- a/fhem/FHEM/71_YAMAHA_AVR.pm +++ b/fhem/FHEM/71_YAMAHA_AVR.pm @@ -83,7 +83,7 @@ YAMAHA_AVR_GetStatus($;$) } # get all available inputs and scenes if nothing is available - if((not defined($hash->{helper}{INPUTS}) or length($hash->{helper}{INPUTS}) == 0) or (not defined($hash->{helper}{SCENES}) or length($hash->{helper}{SCENES}) == 0)) + if((not defined($hash->{helper}{INPUTS}) or length($hash->{helper}{INPUTS}) == 0)) { YAMAHA_AVR_getInputs($hash); } @@ -154,7 +154,7 @@ YAMAHA_AVR_Set($@) } # get all available inputs if nothing is available - if((not defined($hash->{helper}{INPUTS}) or length($hash->{helper}{INPUTS}) == 0) or (not defined($hash->{helper}{SCENES}) or length($hash->{helper}{SCENES}) == 0)) + if(not defined($hash->{helper}{INPUTS}) or length($hash->{helper}{INPUTS}) == 0) { YAMAHA_AVR_getInputs($hash); } @@ -174,9 +174,10 @@ YAMAHA_AVR_Set($@) return "No Argument given" if(!defined($a[1])); my $what = $a[1]; - my $usage = "Unknown argument $what, choose one of on:noArg off:noArg volumeStraight:slider,-80,1,16 volume:slider,0,1,100 volumeUp volumeDown ".(defined($hash->{helper}{INPUTS})?"input:".$inputs_comma." ":"")."mute:on,off,toggle remoteControl:setup,up,down,left,right,return,option,display,tunerPresetUp,tunerPresetDown,enter ".(defined($hash->{helper}{SCENES})?"scene:".$scenes_comma." ":"").($hash->{helper}{SELECTED_ZONE} eq "mainzone" ? "straight:on,off 3dCinemaDsp:off,auto adaptiveDrc:off,auto ".(exists($hash->{helper}{DIRECT_TAG}) ? "direct:on,off " : "").(exists($hash->{helper}{DSP_MODES}) ? "dsp:".$dsp_modes_comma." " : "")." enhancer:on,off " : "")."sleep:off,30min,60min,90min,120min,last statusRequest:noArg"; + my $usage = "Unknown argument $what, choose one of on:noArg off:noArg volumeStraight:slider,-80,1,16 volume:slider,0,1,100 volumeUp volumeDown ".(exists($hash->{helper}{INPUTS})?"input:".$inputs_comma." ":"")."mute:on,off,toggle remoteControl:setup,up,down,left,right,return,option,display,tunerPresetUp,tunerPresetDown,enter ".(exists($hash->{helper}{SCENES})?"scene:".$scenes_comma." ":"").($hash->{ACTIVE_ZONE} eq "mainzone" ? "straight:on,off 3dCinemaDsp:off,auto adaptiveDrc:off,auto ".(exists($hash->{helper}{DIRECT_TAG}) ? "direct:on,off " : "").(exists($hash->{helper}{DSP_MODES}) ? "dsp:".$dsp_modes_comma." " : "")." enhancer:on,off " : "")."sleep:off,30min,60min,90min,120min,last statusRequest:noArg"; Log3 $name, 5, "YAMAHA_AVR ($name) - set ".join(" ", @a); + if($what eq "on") { YAMAHA_AVR_SendCommand($hash, "<$zone>On" ,$what,undef); @@ -784,6 +785,11 @@ YAMAHA_AVR_ParseResponse ($$$) my $cmd = $param->{cmd}; my $arg = $param->{arg}; + if(exists($param->{code})) + { + Log3 $name, 5, "YAMAHA_AVR ($name) - received HTTP code ".$param->{code}." for command \"$cmd".(defined($arg) ? " ".(split("\\|", $arg))[0] : "")."\""; + } + if($err ne "") { Log3 $name, 5, "YAMAHA_AVR ($name) - could not execute command \"$cmd".(defined($arg) ? " ".(split("\\|", $arg))[0] : "")."\": $err"; @@ -967,6 +973,10 @@ YAMAHA_AVR_ParseResponse ($$$) { readingsBulkUpdate($hash, "inputName", $1); } + elsif($data =~ /.*?\s*(.+?)\s*<\/Input_Sel_Title>.*<\/Input>/) + { + readingsBulkUpdate($hash, "inputName", $1); + } if($data =~ /.*?.*?(.+?)<\/Straight>.*?<\/Current>.*?<\/Surround>/) {