From a948d3d656e7624a1db6203c2675ee6ed27fa246 Mon Sep 17 00:00:00 2001 From: markusbloch Date: Thu, 29 May 2014 17:46:15 +0000 Subject: [PATCH] YAMAHA_AVR: fixing presence detection git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@6004 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/71_YAMAHA_AVR.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/71_YAMAHA_AVR.pm b/fhem/FHEM/71_YAMAHA_AVR.pm index 9efe6fd0f..396e86784 100755 --- a/fhem/FHEM/71_YAMAHA_AVR.pm +++ b/fhem/FHEM/71_YAMAHA_AVR.pm @@ -755,7 +755,7 @@ YAMAHA_AVR_ParseResponse ($$$) my $cmd = $param->{cmd}; my $arg = $param->{arg}; - $hash->{helper}{AVAILABLE} = ($err eq "" ? 1 : 0); + if($err ne "") { @@ -766,7 +766,9 @@ YAMAHA_AVR_ParseResponse ($$$) Log3 $name, 3, "YAMAHA_AVR ($name) - could not execute command on device $name. Please turn on your device in case of deactivated network standby or check for correct hostaddress."; readingsSingleUpdate($hash, "presence", "absent", 1); readingsSingleUpdate($hash, "state", "absent", 1); - } + } + + $hash->{helper}{AVAILABLE} = 0; } elsif($data ne "") { @@ -778,6 +780,8 @@ YAMAHA_AVR_ParseResponse ($$$) readingsSingleUpdate($hash, "presence", "present", 1); } + $hash->{helper}{AVAILABLE} = 1; + if(not $data =~ /RC="0"/) { # if the returncode isn't 0, than the command was not successful