mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
PRESENCE: use getlogin and getpwuid to obtain FHEM username; use usleep instead of sleep.
git-svn-id: https://svn.fhem.de/fhem/trunk@5188 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
260b576037
commit
ece3afa80f
@ -30,7 +30,7 @@ package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Blocking;
|
||||
use Time::HiRes qw(gettimeofday sleep);
|
||||
use Time::HiRes qw(gettimeofday usleep sleep);
|
||||
use DevIo;
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ PRESENCE_Define($$)
|
||||
my ($hash, $def) = @_;
|
||||
my @a = split("[ \t]+", $def);
|
||||
my $dev;
|
||||
my $username = (getpwuid($<))[0];
|
||||
my $username = getlogin || getpwuid($<) || "[unknown]";
|
||||
|
||||
if(defined($a[2]) and defined($a[3]))
|
||||
{
|
||||
@ -582,7 +582,7 @@ PRESENCE_ExecuteFritzBoxCMD($$)
|
||||
qx(touch /var/tmp/fhem-PRESENCE-cmd-lock.tmp);
|
||||
|
||||
$status = qx($cmd);
|
||||
|
||||
usleep 200000;
|
||||
unlink("/var/tmp/fhem-PRESENCE-cmd-lock.tmp") if(-e "/var/tmp/fhem-PRESENCE-cmd-lock.tmp");
|
||||
|
||||
return $status;
|
||||
@ -668,7 +668,7 @@ PRESENCE_DoLocalFritzBoxScan($)
|
||||
}
|
||||
|
||||
$number++;
|
||||
sleep 0.2;
|
||||
|
||||
}
|
||||
|
||||
return ($status == 0 ? "$name|$local|absent" : "$name|$local|present").($number <= $max ? "|$number" : "");
|
||||
|
Loading…
Reference in New Issue
Block a user