70_ONKYO_AVR.pm: fix reading configuration after fhem restart (Forum #15024)

git-svn-id: https://svn.fhem.de/fhem/trunk@12247 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
loredo
2016-10-02 20:49:46 +00:00
parent 9f55eccd6b
commit aaa2cdcfeb

View File

@@ -321,14 +321,15 @@ sub ONKYO_AVR_Notify($$) {
foreach my $change ( @{ $dev->{CHANGED} } ) {
# DISCONNECTED
if ( $change eq "DISCONNECTED" && $presence ne "absent" ) {
if ( $change eq "DISCONNECTED" ) {
Log3 $hash, 5, "ONKYO_AVR " . $name . ": processing change $change";
# disable connectionCheck and wait
# until DevIo reopened the connection
RemoveInternalTimer($hash);
readingsBulkUpdate( $hash, "presence", "absent" );
readingsBulkUpdate( $hash, "presence", "absent" )
if ( $presence ne "absent" );
readingsBulkUpdate( $hash, "power", "off" )
if ( ReadingsVal( $name, "power", "on" ) ne "off" );
@@ -354,10 +355,11 @@ sub ONKYO_AVR_Notify($$) {
}
# CONNECTED
elsif ( $change eq "CONNECTED" && $presence ne "present" ) {
elsif ( $change eq "CONNECTED" ) {
Log3 $hash, 5, "ONKYO_AVR " . $name . ": processing change $change";
readingsBulkUpdate( $hash, "presence", "present" );
readingsBulkUpdate( $hash, "presence", "present" )
if ( $presence ne "present" );
# stateAV
my $stateAV = ONKYO_AVR_GetStateAV($hash);
@@ -1977,6 +1979,9 @@ sub ONKYO_AVR_Set($$$) {
$channels_txt =~ s/\s/_/g;
$channels_txt = substr( $channels_txt, 0, -1 );
}
else {
$channels_txt = ReadingsVal( $name, "channelList", "" );
}
# for each reading, check if there is a known command for it
# and allow to set values if there are any available