2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 11:16:36 +00:00

update actionDetector handling

git-svn-id: https://svn.fhem.de/fhem/trunk@6469 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2014-08-27 08:56:45 +00:00
parent 8cae6cca14
commit e8c57f202d

View File

@ -597,9 +597,16 @@ sub CUL_HM_Attr(@) {#################################
} }
} }
elsif($attrName eq "actCycle"){#"000:00" or 'off' elsif($attrName eq "actCycle"){#"000:00" or 'off'
return if (CUL_HM_name2Id($name) eq $K_actDetID); if ($cmd eq "set"){
if (CUL_HM_name2Id($name) eq $K_actDetID){
return "$attrName must be higher then 30, $attrVal not allowed"
if ($attrVal < 30);
}
else{
return "attribut not allowed for channels" return "attribut not allowed for channels"
if (!$hash->{helper}{role}{dev}); if (!$hash->{helper}{role}{dev});
}
}
$updtReq = 1; $updtReq = 1;
} }
elsif($attrName eq "param"){ elsif($attrName eq "param"){
@ -6472,16 +6479,13 @@ sub CUL_HM_ActGetCreateHash() {# get ActionDetector - create if necessary
} }
my $actHash = $modules{CUL_HM}{defptr}{"000000"}; my $actHash = $modules{CUL_HM}{defptr}{"000000"};
my $actName = $actHash->{NAME} if($actHash); my $actName = $actHash->{NAME} if($actHash);
my $ac = AttrVal($actName,"actCycle",600);
if (!$actHash->{helper}{actCycle} || if (!$actHash->{helper}{actCycle} ||
$actHash->{helper}{actCycle} != $attr{$actName}{actCycle}){ $actHash->{helper}{actCycle} != $ac){
$attr{$actName}{actCycle} = 30 if(!$attr{$actName}{actCycle} || $actHash->{helper}{actCycle} = $ac;
$attr{$actName}{actCycle}<30);
$actHash->{helper}{actCycle} = $attr{$actName}{actCycle};
RemoveInternalTimer("ActionDetector"); RemoveInternalTimer("ActionDetector");
$actHash->{STATE} = "active"; $actHash->{STATE} = "active";
InternalTimer(gettimeofday()+$attr{$actName}{actCycle}, InternalTimer(gettimeofday()+$ac,"CUL_HM_ActCheck", "ActionDetector", 0);
"CUL_HM_ActCheck", "ActionDetector", 0);
} }
return $actHash; return $actHash;
} }
@ -6604,10 +6608,9 @@ sub CUL_HM_ActCheck($) {# perform supervision
CUL_HM_UpdtReadBulk($actHash,1,@event); CUL_HM_UpdtReadBulk($actHash,1,@event);
$attr{$actName}{actCycle} = 600 if($attr{$actName}{actCycle}<30); $actHash->{helper}{actCycle} = AttrVal($actName,"actCycle",600);
$actHash->{helper}{actCycle} = $attr{$actName}{actCycle}; InternalTimer(gettimeofday()+$actHash->{helper}{actCycle}
InternalTimer(gettimeofday()+$attr{$actName}{actCycle}, ,"CUL_HM_ActCheck", "ActionDetector", 0);
"CUL_HM_ActCheck", "ActionDetector", 0);
} }
#+++++++++++++++++ helper +++++++++++++++++++++++++++++++++++++++++++++++++++++ #+++++++++++++++++ helper +++++++++++++++++++++++++++++++++++++++++++++++++++++