diff --git a/FHEM/71_YAMAHA_AVR.pm b/FHEM/71_YAMAHA_AVR.pm
index 9b59dfd48..c50caf38a 100755
--- a/FHEM/71_YAMAHA_AVR.pm
+++ b/FHEM/71_YAMAHA_AVR.pm
@@ -180,11 +180,11 @@ YAMAHA_AVR_Set($@)
if($what eq "on")
{
- YAMAHA_AVR_SendCommand($hash, "<$zone>On$zone>" ,$what,undef);
+ YAMAHA_AVR_SendCommand($hash, "<$zone>On$zone>" ,$what,undef, 1);
}
elsif($what eq "off")
{
- YAMAHA_AVR_SendCommand($hash, "<$zone>Standby$zone>", $what, undef);
+ YAMAHA_AVR_SendCommand($hash, "<$zone>Standby$zone>", $what, undef, 1);
}
elsif($what eq "input")
{
@@ -719,26 +719,54 @@ YAMAHA_AVR_Undefine($$)
sub
YAMAHA_AVR_SendCommand($@)
{
- my ($hash, $data,$cmd,$arg) = @_;
+ my ($hash, $data,$cmd,$arg,$blocking) = @_;
my $name = $hash->{NAME};
my $address = $hash->{helper}{ADDRESS};
+
+ $blocking = 0 unless(defined($blocking));
+
- Log3 $name, 5, "YAMAHA_AVR ($name) - execute \"$cmd".(defined($arg) ? " ".(split("\\|", $arg))[0] : "")."\" on $name: $data";
+
# In case any URL changes must be made, this part is separated in this function".
- HttpUtils_NonblockingGet({
- url => "http://".$address."/YamahaRemoteControl/ctrl",
- timeout => AttrVal($name, "request-timeout", 4),
- noshutdown => 1,
- data => "".$data,
- loglevel => ($hash->{helper}{AVAILABLE} ? undef : 5),
- hash => $hash,
- cmd => $cmd,
- arg => $arg,
- callback => \&YAMAHA_AVR_ParseResponse
- }
- );
+ 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",
+ timeout => AttrVal($name, "request-timeout", 4),
+ noshutdown => 1,
+ data => "".$data,
+ loglevel => ($hash->{helper}{AVAILABLE} ? undef : 5),
+ hash => $hash,
+ cmd => $cmd,
+ arg => $arg
+ };
+
+ my ($err, $data) = HttpUtils_BlockingGet($param);
+ return YAMAHA_AVR_ParseResponse($param, $err, $data);
+
+
+ }
+ else
+ {
+ Log3 $name, 5, "YAMAHA_AVR ($name) - execute nonblocking \"$cmd".(defined($arg) ? " ".(split("\\|", $arg))[0] : "")."\" on $name: $data";
+
+ HttpUtils_NonblockingGet({
+ url => "http://".$address."/YamahaRemoteControl/ctrl",
+ timeout => AttrVal($name, "request-timeout", 4),
+ noshutdown => 1,
+ data => "".$data,
+ loglevel => ($hash->{helper}{AVAILABLE} ? undef : 5),
+ hash => $hash,
+ cmd => $cmd,
+ arg => $arg,
+ callback => \&YAMAHA_AVR_ParseResponse
+ }
+ );
+ }
}
#############################
@@ -1173,8 +1201,8 @@ sub YAMAHA_AVR_getModel($)
{
my ($hash) = @_;
- YAMAHA_AVR_SendCommand($hash, "GetParam", "statusRequest","unitDescription");
- YAMAHA_AVR_SendCommand($hash, "GetParam", "statusRequest","systemConfig");
+ YAMAHA_AVR_SendCommand($hash, "GetParam", "statusRequest","unitDescription", 1);
+ YAMAHA_AVR_SendCommand($hash, "GetParam", "statusRequest","systemConfig", 1);
}
#############################
@@ -1276,10 +1304,10 @@ sub YAMAHA_AVR_getInputs($)
return undef if (not defined($zone) or $zone eq "");
# query all inputs
- YAMAHA_AVR_SendCommand($hash, "<$zone>GetParam$zone>", "statusRequest","getInputs");
+ YAMAHA_AVR_SendCommand($hash, "<$zone>GetParam$zone>", "statusRequest","getInputs", 1);
# query all available scenes
- YAMAHA_AVR_SendCommand($hash, "<$zone>GetParam$zone>", "statusRequest","getScenes");
+ YAMAHA_AVR_SendCommand($hash, "<$zone>GetParam$zone>", "statusRequest","getScenes", 1);
}
#############################