diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm index 57e73fcf6..98ce06bf8 100755 --- a/fhem/FHEM/71_YAMAHA_AVR.pm +++ b/fhem/FHEM/71_YAMAHA_AVR.pm @@ -115,7 +115,6 @@ YAMAHA_AVR_Get($@) if(exists($hash->{READINGS}{$what})) { - if(defined($hash->{READINGS}{$what})) { return $hash->{READINGS}{$what}{VAL}; @@ -489,7 +488,7 @@ YAMAHA_AVR_Set($@) } elsif($a[2] eq "30min") { - YAMAHA_AVR_SendCommand($hash, "<$zone>30 min", $what, $a[2]); + YAMAHA_AVR_SendCommand($hash, "<$zone>30 min", $what, $a[2]); } elsif($a[2] eq "60min") { @@ -631,10 +630,8 @@ YAMAHA_AVR_Define($$) { if(defined(YAMAHA_AVR_getParamName($hash, lc $hash->{helper}{SELECTED_ZONE}, $hash->{helper}{ZONES}))) { - $hash->{ACTIVE_ZONE} = lc $hash->{helper}{SELECTED_ZONE}; - YAMAHA_AVR_getInputs($hash); - + YAMAHA_AVR_getInputs($hash); } else { @@ -659,7 +656,7 @@ YAMAHA_AVR_Define($$) $hash->{helper}{DISABLED} = 0 unless(exists($hash->{helper}{DISABLED})); YAMAHA_AVR_ResetTimer($hash,0); - return undef; + return undef; } @@ -674,8 +671,8 @@ YAMAHA_AVR_Attr(@) { if($a[3] eq "0") { - $hash->{helper}{DISABLED} = 0; - YAMAHA_AVR_GetStatus($hash, 1); + $hash->{helper}{DISABLED} = 0; + YAMAHA_AVR_GetStatus($hash, 1); } elsif($a[3] eq "1") { @@ -698,11 +695,11 @@ YAMAHA_AVR_Attr(@) sub YAMAHA_AVR_Undefine($$) { - my($hash, $name) = @_; - - # Stop the internal GetStatus-Loop and exit - RemoveInternalTimer($hash); - return undef; + my($hash, $name) = @_; + + # Stop the internal GetStatus-Loop and exit + RemoveInternalTimer($hash); + return undef; } @@ -736,7 +733,6 @@ YAMAHA_AVR_SendCommand($@) if($blocking == 1) { - Log3 $name, 5, "YAMAHA_AVR ($name) - execute blocking \"$cmd".(defined($arg) ? " ".(split("\\|", $arg))[0] : "")."\" on $name: $data"; my $param = { url => "http://".$address."/YamahaRemoteControl/ctrl", @@ -750,8 +746,7 @@ YAMAHA_AVR_SendCommand($@) }; my ($err, $data) = HttpUtils_BlockingGet($param); - return YAMAHA_AVR_ParseResponse($param, $err, $data); - + YAMAHA_AVR_ParseResponse($param, $err, $data); } else { @@ -777,7 +772,6 @@ YAMAHA_AVR_SendCommand($@) sub YAMAHA_AVR_ParseResponse ($$$) { - my ( $param, $err, $data ) = @_; my $hash = $param->{hash}; @@ -1247,16 +1241,16 @@ YAMAHA_AVR_ParseXML($$$) } Log3 $name, 4, "YAMAHA_AVR ($name) - adding zone: $2"; $hash->{helper}{ZONES} .= $2; - } delete( $hash->{helper}{DSP_MODES}) if(exists($hash->{helper}{DSP_MODES})); if($data =~ /.*?(.+?)<\/Get>/) { - my $modes = $1; + Log3 $name, 4, "YAMAHA_AVR ($name) - found DSP modes in XML"; + while($modes =~ /(.+?)<\/Direct>/gc) { if(defined($hash->{helper}{DSP_MODES}) and length($hash->{helper}{DSP_MODES}) > 0) @@ -1265,7 +1259,6 @@ YAMAHA_AVR_ParseXML($$$) } Log3 $name, 4, "YAMAHA_AVR ($name) - adding DSP mode $1"; $hash->{helper}{DSP_MODES} .= $1; - } } else @@ -1290,7 +1283,6 @@ YAMAHA_AVR_ParseXML($$$) Log3 $name, 2, "YAMAHA_AVR ($name) - selected zone >>".$hash->{helper}{SELECTED_ZONE}."<< is not available. Using Main Zone instead"; $hash->{ACTIVE_ZONE} = "mainzone"; } - } ############################# @@ -1317,7 +1309,6 @@ sub YAMAHA_AVR_volume_abs2rel($) # queries all available inputs and scenes sub YAMAHA_AVR_getInputs($) { - my ($hash) = @_; my $name = $hash->{NAME}; my $address = $hash->{helper}{ADDRESS}; @@ -1356,6 +1347,8 @@ sub YAMAHA_AVR_ResetTimer($;$) InternalTimer(gettimeofday()+$hash->{helper}{OFF_INTERVAL}, "YAMAHA_AVR_GetStatus", $hash, 0); } } + + return undef; } #############################