save recentReceive in readngs

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

View File

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