2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-26 10:34:52 +00:00

PRESENCE: add set command active/inactive (by KernSani, Forum: #95696)

git-svn-id: https://svn.fhem.de/fhem/trunk@18314 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2019-01-18 13:49:05 +00:00
parent b27a4f1454
commit 04455e653d
2 changed files with 41 additions and 3 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 73_PRESENCE: new set command active/inactive to temporarily
disable presence checks
- bugfix: DarkSkyAPI: fix reading values, add API Version
- bugfix: 82_LGTV_WebOS: add SkyOnline at set commands
- feature: 49_SSCam: 8.5.0, SVS device has "snapCams" command to take

View File

@ -342,6 +342,7 @@ PRESENCE_Set($@)
$usage .= " overrideInterval" if($hash->{MODE} !~ /^event|lan-bluetooth$/);
$usage .= " clearOverride:noArg" if($hash->{INTERVAL_OVERRIDED});
$usage .= " inactive:noArg active:noArg";
if($a[1] eq "statusRequest")
{
@ -403,6 +404,40 @@ PRESENCE_Set($@)
{
delete($hash->{INTERVAL_OVERRIDED});
}
elsif($a[1] eq "inactive")
{
if(defined($hash->{FD}))
{
DevIo_SimpleWrite($hash, "stop\n", 2);
}
RemoveInternalTimer($hash);
$hash->{helper}{DISABLED} = 1;
readingsSingleUpdate($hash, "state", "disabled",1);
}
elsif($a[1] eq "active")
{
readingsSingleUpdate($hash, "state", "defined",0) if(exists($hash->{helper}{DISABLED}) and $hash->{helper}{DISABLED} == 1);
if(defined($hash->{DeviceName}))
{
$hash->{helper}{DISABLED} = 0;
if(defined($hash->{FD}))
{
PRESENCE_DoInit($hash) if(exists($hash->{helper}{DISABLED}));
}
else
{
DevIo_OpenDev($hash, 0, "PRESENCE_DoInit");
}
}
else
{
$hash->{helper}{DISABLED} = 0;
PRESENCE_StartLocalScan($hash);
}
}
else
{
return $usage;
@ -427,14 +462,15 @@ PRESENCE_Attr(@)
if(defined($hash->{DeviceName}))
{
$hash->{helper}{DISABLED} = 0;
if(defined($hash->{FD}))
{
PRESENCE_DoInit($hash) if(exists($hash->{helper}{DISABLED}));
$hash->{helper}{DISABLED} = 0;
}
else
{
$hash->{helper}{DISABLED} = 0;
DevIo_OpenDev($hash, 0, "PRESENCE_DoInit");
}
}