mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 20:24:36 +00:00
YAMAHA_AVR: improving on/off event trigger
git-svn-id: https://svn.fhem.de/fhem/trunk@6016 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
303330138e
commit
bd9b5820d7
@ -115,7 +115,6 @@ YAMAHA_AVR_Get($@)
|
|||||||
|
|
||||||
if(exists($hash->{READINGS}{$what}))
|
if(exists($hash->{READINGS}{$what}))
|
||||||
{
|
{
|
||||||
YAMAHA_AVR_GetStatus($hash, 1);
|
|
||||||
|
|
||||||
if(defined($hash->{READINGS}{$what}))
|
if(defined($hash->{READINGS}{$what}))
|
||||||
{
|
{
|
||||||
@ -572,8 +571,8 @@ YAMAHA_AVR_Set($@)
|
|||||||
return $usage;
|
return $usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Call the GetStatus() Function to retrieve the new values after setting something (with local flag, so the internal timer is not getting interupted)
|
# Call the GetStatus() Function by resetting the timer to one second to retrieve the new values after setting something.
|
||||||
YAMAHA_AVR_GetStatus($hash, 1);
|
YAMAHA_AVR_ResetTimer($hash, 1);
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -1062,14 +1061,30 @@ YAMAHA_AVR_ParseResponse ($$$)
|
|||||||
elsif($cmd eq "on")
|
elsif($cmd eq "on")
|
||||||
{
|
{
|
||||||
if($data =~ /RC="0"/ and $data =~ /<Power><\/Power>/)
|
if($data =~ /RC="0"/ and $data =~ /<Power><\/Power>/)
|
||||||
{
|
{
|
||||||
# As the receiver startup takes about 5 seconds, the status will be already set, if the return code of the command is 0.
|
# As the receiver startup takes about 5 seconds, the status will be already set, if the return code of the command is 0.
|
||||||
readingsBulkUpdate($hash, "power", "on");
|
readingsBulkUpdate($hash, "power", "on");
|
||||||
readingsBulkUpdate($hash, "state","on");
|
readingsBulkUpdate($hash, "state","on");
|
||||||
}
|
|
||||||
else
|
readingsEndUpdate($hash, 1);
|
||||||
{
|
|
||||||
Log3 $name, 3, "YAMAHA_AVR ($name) - Could not set power to off";
|
YAMAHA_AVR_ResetTimer($hash, 5);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif($cmd eq "off")
|
||||||
|
{
|
||||||
|
if($data =~ /RC="0"/ and $data =~ /<Power><\/Power>/)
|
||||||
|
{
|
||||||
|
readingsBulkUpdate($hash, "power", "off");
|
||||||
|
readingsBulkUpdate($hash, "state","off");
|
||||||
|
|
||||||
|
readingsEndUpdate($hash, 1);
|
||||||
|
|
||||||
|
YAMAHA_AVR_ResetTimer($hash, 3);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($cmd eq "volume")
|
elsif($cmd eq "volume")
|
||||||
@ -1109,7 +1124,7 @@ YAMAHA_AVR_ParseResponse ($$$)
|
|||||||
|
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
|
|
||||||
YAMAHA_AVR_GetStatus($hash, 1) if($cmd ne "statusRequest");
|
YAMAHA_AVR_ResetTimer($hash, 1) if($cmd ne "statusRequest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user