From 470226cae15d36851f63e23e08f3c764656da351 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 22 Dec 2015 14:01:50 +0100 Subject: [PATCH] =?UTF-8?q?automatisches=20LockScreen=20Reading=20l=C3=B6s?= =?UTF-8?q?chen=20wenn=20Attr=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_AMAD.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/74_AMAD.pm b/74_AMAD.pm index 172f936..3873378 100644 --- a/74_AMAD.pm +++ b/74_AMAD.pm @@ -37,7 +37,7 @@ use TcpServerUtils; use Encode qw(encode); -my $version = "1.1.3"; +my $version = "1.1.7"; @@ -200,6 +200,9 @@ my ( $cmd, $name, $attrName, $attrVal ) = @_; elsif( $attrName eq "setScreenlockPIN" ) { if( $cmd eq "set" && $attrVal ) { $attrVal = AMAD_encrypt($attrVal); + + } else { + CommandDeleteReading( undef, "$name screenLock" ); } } @@ -704,12 +707,13 @@ sub AMAD_SelectSetCmd($$@) { } elsif( lc $cmd eq 'screenlock' ) { - my $lockmode = join( " ", @data ); + my $lockmod = join( " ", @data ); my $PIN = AttrVal( $name, "setScreenlockPIN", undef ); - my $PIN = AMAD_decrypt($PIN); + $PIN = AMAD_decrypt($PIN); - my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenlock?mode=".$lockmode."&lockPIN=".$PIN; - + my $url = "http://" . $host . ":" . $port . "/fhem-amad/setCommands/screenlock?mode=".$lockmod."&lockPIN=".$PIN; + + readingsSingleUpdate( $hash, $cmd, $lockmod, 1 ); return AMAD_HTTP_POST( $hash,$url ); }