From ee1be560e2b07f2ece6abe3f2aec7f99e2810323 Mon Sep 17 00:00:00 2001
From: markusbloch <>
Date: Mon, 28 Jul 2014 15:04:33 +0000
Subject: [PATCH] YAMAHA_AVR: fixing module startup error; added additional log
output
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@6324 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
FHEM/71_YAMAHA_AVR.pm | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/FHEM/71_YAMAHA_AVR.pm b/FHEM/71_YAMAHA_AVR.pm
index 9a83ae1e4..353e78987 100755
--- a/FHEM/71_YAMAHA_AVR.pm
+++ b/FHEM/71_YAMAHA_AVR.pm
@@ -75,7 +75,7 @@ YAMAHA_AVR_GetStatus($;$)
my $device = $hash->{helper}{ADDRESS};
# get the model informations and available zones if no informations are available
- if(not defined($hash->{ACTIVE_ZONE}) or not defined($hash->{helper}{ZONES}) or not defined($hash->{MODEL}) or not defined($hash->{FIRMWARE}) or not defined($hash->{helper}{DSP_MODES}))
+ if(not defined($hash->{ACTIVE_ZONE}) or not defined($hash->{helper}{ZONES}) or not defined($hash->{MODEL}) or not defined($hash->{FIRMWARE}))
{
YAMAHA_AVR_getModel($hash);
YAMAHA_AVR_ResetTimer($hash) unless($local == 1);
@@ -148,7 +148,7 @@ YAMAHA_AVR_Set($@)
my $address = $hash->{helper}{ADDRESS};
# get the model informations and available zones if no informations are available
- if(not defined($hash->{ACTIVE_ZONE}) or not defined($hash->{helper}{ZONES}) or (not defined($hash->{helper}{DSP_MODES}) or length($hash->{helper}{DSP_MODES}) == 0))
+ if(not defined($hash->{ACTIVE_ZONE}) or not defined($hash->{helper}{ZONES}))
{
YAMAHA_AVR_getModel($hash);
}
@@ -176,7 +176,7 @@ YAMAHA_AVR_Set($@)
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";
- Log3 $name, 5, "YAMAHA_AVR ($name) - ".join(" ", @a);
+ Log3 $name, 5, "YAMAHA_AVR ($name) - set ".join(" ", @a);
if($what eq "on")
{
YAMAHA_AVR_SendCommand($hash, "<$zone>On$zone>" ,$what,undef);
@@ -565,7 +565,11 @@ YAMAHA_AVR_Set($@)
return $usage;
}
}
- elsif($what ne "statusRequest")
+ elsif($what eq "statusRequest")
+ {
+ YAMAHA_AVR_GetStatus($hash, 1);
+ }
+ else
{
return $usage;
}
@@ -652,7 +656,7 @@ YAMAHA_AVR_Define($$)
# start the status update timer
$hash->{helper}{DISABLED} = 0 unless(exists($hash->{helper}{DISABLED}));
- YAMAHA_AVR_ResetTimer($hash,2);
+ YAMAHA_AVR_ResetTimer($hash,0);
return undef;
}
@@ -865,8 +869,8 @@ YAMAHA_AVR_ParseResponse ($$$)
{
$hash->{helper}{INPUTS} .= "|";
}
-
- $hash->{helper}{INPUTS} .= $1;
+ Log3 $name, 4, "YAMAHA_AVR ($name) - found input: $1";
+ $hash->{helper}{INPUTS} .= $1;
}
$hash->{helper}{INPUTS} = join("|", sort split("\\|", $hash->{helper}{INPUTS}));
@@ -874,7 +878,7 @@ YAMAHA_AVR_ParseResponse ($$$)
elsif($arg eq "getScenes")
{
delete($hash->{helper}{SCENES}) if(exists($hash->{helper}{SCENES}));
-
+
# get all available scenes from response
while($data =~ /.*?(.+?)<\/Param>.*?(\w+)<\/RW>.*?<\/Item_\d+>/gc)
{
@@ -885,6 +889,7 @@ YAMAHA_AVR_ParseResponse ($$$)
{
$hash->{helper}{SCENES} .= "|";
}
+ Log3 $name, 4, "YAMAHA_AVR ($name) - found scene: $1";
$hash->{helper}{SCENES} .= $1;
}
}
@@ -1222,13 +1227,15 @@ YAMAHA_AVR_ParseXML($$$)
delete($hash->{helper}{ZONES}) if(exists($hash->{helper}{ZONES}));
+ Log3 $name, 4, "YAMAHA_AVR ($name) - checking available zones";
+
while($data =~ /