From 99e113b60c18cb1646e2c3b13218a8ea9ed3714c Mon Sep 17 00:00:00 2001 From: markusbloch Date: Tue, 26 Feb 2013 21:57:48 +0000 Subject: [PATCH] fixing non-root check; set state to disabled, when reconnecting to presenced/collectord and device is disabled git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2819 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/73_PRESENCE.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/FHEM/73_PRESENCE.pm b/FHEM/73_PRESENCE.pm index 3ce696250..8ee2d8b01 100755 --- a/FHEM/73_PRESENCE.pm +++ b/FHEM/73_PRESENCE.pm @@ -118,7 +118,7 @@ PRESENCE_Define($$) return $msg; } - if(-X "/usr/bin/ctlmgr_ctl" and $destination eq "fritzbox" or $destination eq "lan-ping" and not $< == 0) + if(-X "/usr/bin/ctlmgr_ctl" and ($destination eq "fritzbox" or $destination eq "lan-ping") and not $< == 0) { my $msg = "FHEM is not running under root (currently ".(getpwuid($<))[0].") This check can only performed with root access to the FritzBox"; @@ -355,8 +355,14 @@ PRESENCE_DoInit($) my ($hash) = @_; - DevIo_SimpleWrite($hash, $hash->{ADDRESS}."|".$hash->{TIMEOUT}."\n", 0) unless($hash->{helper}{DISABLED}); - + unless($hash->{helper}{DISABLED}) + { + DevIo_SimpleWrite($hash, $hash->{ADDRESS}."|".$hash->{TIMEOUT}."\n", 0); + } + else + { + readingsSingleUpdate($hash, "state", "disabled",1); + } }