save recentReceive in readngs

git-svn-id: https://svn.fhem.de/fhem/trunk@4376 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876
2013-12-13 18:37:08 +00:00
parent 3436f6d21e
commit fd959cb000

View File

@@ -2436,10 +2436,8 @@ sub CUL_HM_Set($@) {
delete $hash->{helper}{prt}{rspWaitSec}; delete $hash->{helper}{prt}{rspWaitSec};
delete $hash->{helper}{prt}{mmcA}; delete $hash->{helper}{prt}{mmcA};
delete $hash->{helper}{prt}{mmcS}; delete $hash->{helper}{prt}{mmcS};
#rescue "protLastRcv" for action detector.
my $protLastRcv = $hash->{protLastRcv} if ($hash->{protLastRcv});
delete ($hash->{$_}) foreach (grep(/^prot/,keys %{$hash})); delete ($hash->{$_}) foreach (grep(/^prot/,keys %{$hash}));
$hash->{protLastRcv} = $protLastRcv if ($protLastRcv);
if ($hash->{IODev}{NAME} && if ($hash->{IODev}{NAME} &&
$modules{CUL_HM}{$hash->{IODev}{NAME}} && $modules{CUL_HM}{$hash->{IODev}{NAME}} &&
$modules{CUL_HM}{$hash->{IODev}{NAME}}{pendDev}){ $modules{CUL_HM}{$hash->{IODev}{NAME}}{pendDev}){
@@ -4005,6 +4003,7 @@ sub CUL_HM_eventP($$) {#handle protocol events
my $nAttr = $hash; my $nAttr = $hash;
if ($evntType eq "Rcv"){ if ($evntType eq "Rcv"){
$nAttr->{"protLastRcv"} = TimeNow(); $nAttr->{"protLastRcv"} = TimeNow();
readingsSingleUpdate($hash,".protLastRcv",$nAttr->{"protLastRcv"},0);
return; return;
} }
@@ -4987,9 +4986,7 @@ sub CUL_HM_ActCheck() {# perform supervision
$state = "switchedOff"; $state = "switchedOff";
} }
else{ else{
$actHash->{helper}{$devId}{recent} = ($devHash->{"protLastRcv"})?#update recent $actHash->{helper}{$devId}{recent} = ReadingsVal($devName,".protLastRcv",0);
$devHash->{"protLastRcv"}
:0;
my $tLast = $actHash->{helper}{$devId}{recent}; my $tLast = $actHash->{helper}{$devId}{recent};
my @t = localtime($tod - $tSec); #time since when a trigger is expected my @t = localtime($tod - $tSec); #time since when a trigger is expected
my $tSince = sprintf("%04d-%02d-%02d %02d:%02d:%02d", my $tSince = sprintf("%04d-%02d-%02d %02d:%02d:%02d",