PRESENCE: fixing not working timer, when using set [...] statusRequest

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@7184 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2014-12-10 20:49:34 +00:00
parent b6125b8a0d
commit 90f64f2f32
2 changed files with 41 additions and 39 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- bugfix: PRESENCE: fixing not working timer, when using set [...] statusRequest
- bugfix: FB_CALLMONITOR: fixing reverse search for klicktel.de - bugfix: FB_CALLMONITOR: fixing reverse search for klicktel.de
- feature: new module 52_I2C_MCP342x.pm added (klausw) - feature: new module 52_I2C_MCP342x.pm added (klausw)
- feature: SYSMON: read cpu temp on FritzBox - feature: SYSMON: read cpu temp on FritzBox

View File

@ -42,8 +42,6 @@ PRESENCE_Initialize($)
{ {
my ($hash) = @_; my ($hash) = @_;
require "$attr{global}{modpath}/FHEM/DevIo.pm";
# Provider # Provider
$hash->{ReadFn} = "PRESENCE_Read"; $hash->{ReadFn} = "PRESENCE_Read";
$hash->{ReadyFn} = "PRESENCE_Ready"; $hash->{ReadyFn} = "PRESENCE_Ready";
@ -229,8 +227,6 @@ PRESENCE_Define($$)
{ {
return DevIo_OpenDev($hash, 0, "PRESENCE_DoInit"); return DevIo_OpenDev($hash, 0, "PRESENCE_DoInit");
} }
} }
@ -269,8 +265,8 @@ PRESENCE_Set($@)
if($hash->{MODE} ne "lan-bluetooth") if($hash->{MODE} ne "lan-bluetooth")
{ {
Log3 $name, 5, "PRESENCE ($name) - starting local scan"; Log3 $name, 5, "PRESENCE ($name) - starting local scan";
PRESENCE_StartLocalScan($hash, 1);
return undef; return PRESENCE_StartLocalScan($hash, 1);
} }
else else
{ {
@ -468,13 +464,11 @@ PRESENCE_Read($)
} }
readingsEndUpdate($hash, 1); readingsEndUpdate($hash, 1);
} }
sub sub
PRESENCE_DoInit($) PRESENCE_DoInit($)
{ {
my ($hash) = @_; my ($hash) = @_;
if( not exists($hash->{helper}{DISABLED}) or (exists($hash->{helper}{DISABLED}) and $hash->{helper}{DISABLED} == 0)) if( not exists($hash->{helper}{DISABLED}) or (exists($hash->{helper}{DISABLED}) and $hash->{helper}{DISABLED} == 0))
@ -488,7 +482,6 @@ PRESENCE_DoInit($)
} }
return undef; return undef;
} }
@ -498,7 +491,6 @@ PRESENCE_Ready($)
my ($hash) = @_; my ($hash) = @_;
return DevIo_OpenDev($hash, 1, "PRESENCE_DoInit") if($hash->{MODE} eq "lan-bluetooth"); return DevIo_OpenDev($hash, 1, "PRESENCE_DoInit") if($hash->{MODE} eq "lan-bluetooth");
} }
########################################################################################################################## ##########################################################################################################################
@ -517,9 +509,11 @@ sub PRESENCE_StartLocalScan($;$)
if(not (exists($hash->{ADDRESS}) or exists($hash->{helper}{call}))) if(not (exists($hash->{ADDRESS}) or exists($hash->{helper}{call})))
{ {
return; return undef;
} }
unless(exists($hash->{helper}{RUNNING_PID}))
{
$hash->{STATE} = "active" if($hash->{STATE} eq "???" or $hash->{STATE} eq "defined"); $hash->{STATE} = "active" if($hash->{STATE} eq "???" or $hash->{STATE} eq "defined");
if($local == 0) if($local == 0)
@ -531,27 +525,34 @@ sub PRESENCE_StartLocalScan($;$)
if($mode eq "local-bluetooth") if($mode eq "local-bluetooth")
{ {
Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode local-bluetooth"; Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode local-bluetooth";
$hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalBluetoothScan", $name."|".$hash->{ADDRESS}."|".$local, "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash) unless(exists($hash->{helper}{RUNNING_PID})); $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalBluetoothScan", $name."|".$hash->{ADDRESS}."|".$local, "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
} }
elsif($mode eq "lan-ping") elsif($mode eq "lan-ping")
{ {
Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode lan-ping"; Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode lan-ping";
$hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalPingScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "ping_count", "4"), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash) unless(exists($hash->{helper}{RUNNING_PID})); $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalPingScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "ping_count", "4"), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
} }
elsif($mode eq "fritzbox") elsif($mode eq "fritzbox")
{ {
Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode fritzbox"; Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode fritzbox";
$hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalFritzBoxScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "fritzbox_speed", "0"), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash) unless(exists($hash->{helper}{RUNNING_PID})); $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalFritzBoxScan", $name."|".$hash->{ADDRESS}."|".$local."|".AttrVal($name, "fritzbox_speed", "0"), "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
} }
elsif($mode eq "shellscript") elsif($mode eq "shellscript")
{ {
Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode shellscript"; Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode shellscript";
$hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalShellScriptScan", $name."|".$hash->{helper}{call}."|".$local, "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash) unless(exists($hash->{helper}{RUNNING_PID})); $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalShellScriptScan", $name."|".$hash->{helper}{call}."|".$local, "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
} }
elsif($mode eq "function") elsif($mode eq "function")
{ {
Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode function"; Log3 $name, 5, "PRESENCE ($name) - starting blocking call for mode function";
$hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalFunctionScan", $name."|".$hash->{helper}{call}."|".$local, "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash) unless(exists($hash->{helper}{RUNNING_PID})); $hash->{helper}{RUNNING_PID} = BlockingCall("PRESENCE_DoLocalFunctionScan", $name."|".$hash->{helper}{call}."|".$local, "PRESENCE_ProcessLocalScan", 60, "PRESENCE_ProcessAbortedScan", $hash);
}
return undef;
}
else
{
return "another check is currently running";
} }
} }