From 2e7c9aac1469aa7a6c7ec7e600c9d37b706ff97c Mon Sep 17 00:00:00 2001 From: fhemrocks <> Date: Wed, 23 Jul 2014 10:15:26 +0000 Subject: [PATCH] improved on/off handling via notifications git-svn-id: https://svn.fhem.de/fhem/trunk@6307 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/97_SB_SERVER.pm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/fhem/contrib/97_SB_SERVER.pm b/fhem/contrib/97_SB_SERVER.pm index 36aaadf40..39cd781b7 100644 --- a/fhem/contrib/97_SB_SERVER.pm +++ b/fhem/contrib/97_SB_SERVER.pm @@ -1522,7 +1522,30 @@ sub SB_SERVER_Notify( $$ ) { Log3( $hash, 4, "SB_SERVER_Notify($name): called" . "Own:" . $name . " Device:" . $devName ); - return( "" ); + + if( $devName eq $hash->{RCCNAME} ) { + Log3( $hash, 1, "SB_SERVER_Notify($name): from $hash->{RCCNAME} " . + "with " . ReadingsVal( $hash->{RCCNAME}, "state", "off" ) ); + if( ReadingsVal( $hash->{RCCNAME}, "state", "off" ) eq "off" ) { + RemoveInternalTimer( $hash ); + InternalTimer( gettimeofday() + 10, + "SB_SERVER_Alive", + $hash, + 0 ); + } elsif( ReadingsVal( $hash->{RCCNAME}, "state", "off" ) eq "on" ) { + RemoveInternalTimer( $hash ); + # do an update of the status, but SB CLI must come up + InternalTimer( gettimeofday() + 20, + "SB_SERVER_Alive", + $hash, + 0 ); + } else { + return( undef ); + } + return( "" ); + } else { + return( undef ); + } }