mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-04 05:16:45 +00:00
HMInfo:cleanup unused shadowregs
git-svn-id: https://svn.fhem.de/fhem/trunk@11522 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cbdc9e22cb
commit
9a421775fb
@ -1281,8 +1281,8 @@ sub CUL_HM_Parse($$) {#########################################################
|
|||||||
my $ack = $mh{devH}->{helper}{rpt}{ack};#shorthand
|
my $ack = $mh{devH}->{helper}{rpt}{ack};#shorthand
|
||||||
my $i=0;
|
my $i=0;
|
||||||
$mh{devH}->{helper}{rpt}{ts} = gettimeofday();
|
$mh{devH}->{helper}{rpt}{ts} = gettimeofday();
|
||||||
CUL_HM_SndCmd($mh{$ack}[$i++],$mh{$ack}[$i++]
|
CUL_HM_SndCmd(${$ack}[$i++],${$ack}[$i++]
|
||||||
.(defined $mh{devH}->{helper}{aesAuthBytes}
|
.($mh{devH}->{helper}{aesAuthBytes}
|
||||||
?$mh{devH}->{helper}{aesAuthBytes}
|
?$mh{devH}->{helper}{aesAuthBytes}
|
||||||
:"")
|
:"")
|
||||||
) while ($i<@{$ack});
|
) while ($i<@{$ack});
|
||||||
@ -7227,7 +7227,6 @@ sub CUL_HM_getRegFromStore($$$$@) {#read a register from backup data
|
|||||||
my $rRL = ($hash->{READINGS}{$regLN}) #realRegList
|
my $rRL = ($hash->{READINGS}{$regLN}) #realRegList
|
||||||
?$hash->{READINGS}{$regLN}{VAL}
|
?$hash->{READINGS}{$regLN}{VAL}
|
||||||
:"";
|
:"";
|
||||||
|
|
||||||
my $data=0;
|
my $data=0;
|
||||||
my $convFlg = "";# confirmation flag - indicates data not confirmed by device
|
my $convFlg = "";# confirmation flag - indicates data not confirmed by device
|
||||||
for (my $size2go = $size;$size2go>0;$size2go -=8){
|
for (my $size2go = $size;$size2go>0;$size2go -=8){
|
||||||
@ -8708,6 +8707,27 @@ sub CUL_HM_configUpdate($) {# mark entities with changed data
|
|||||||
CUL_HM_noDup(@{$modules{CUL_HM}{helper}{confUpdt}},$name);
|
CUL_HM_noDup(@{$modules{CUL_HM}{helper}{confUpdt}},$name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub CUL_HM_cleanShadowReg($){
|
||||||
|
# remove shadow-regs if those are identical to readings or
|
||||||
|
# the reading does not exist.
|
||||||
|
# return dirty "1" if some shadowregs still remain active
|
||||||
|
my ($name) = @_;
|
||||||
|
my $hash = $defs{$name};
|
||||||
|
my $dirty = 0;
|
||||||
|
foreach my $rLn (keys %{$hash->{helper}{shadowReg}}){
|
||||||
|
my $rLnP = ($hash->{helper}{expert}{raw}?"":".").$rLn;
|
||||||
|
if ( !$hash->{READINGS}{$rLnP}
|
||||||
|
|| $hash->{READINGS}{$rLnP}{VAL} eq $hash->{helper}{shadowReg}{$rLn}){
|
||||||
|
delete $hash->{helper}{shadowReg}{$rLn};
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$dirty = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $dirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#+++++++++++++++++ templates ++++++++++++++++++++++++++++++++++++++++++++++++++
|
#+++++++++++++++++ templates ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
sub CUL_HM_tempListTmpl(@) { ##################################################
|
sub CUL_HM_tempListTmpl(@) { ##################################################
|
||||||
# $name is comma separated list of names
|
# $name is comma separated list of names
|
||||||
|
@ -223,7 +223,9 @@ sub HMinfo_status($){##########################################################
|
|||||||
$nbrE++;
|
$nbrE++;
|
||||||
$nbrC++ if ($ehash->{helper}{role}{chn});
|
$nbrC++ if ($ehash->{helper}{role}{chn});
|
||||||
$nbrV++ if ($ehash->{helper}{role}{vrt});
|
$nbrV++ if ($ehash->{helper}{role}{vrt});
|
||||||
push @shdwNames,$eName if (keys %{$ehash->{helper}{shadowReg}});
|
push @shdwNames,$eName if (CUL_HM_cleanShadowReg($eName)); # are shadowRegs active?
|
||||||
|
|
||||||
|
|
||||||
foreach my $read (grep {$ehash->{READINGS}{$_}} @info){ #---- count critical readings
|
foreach my $read (grep {$ehash->{READINGS}{$_}} @info){ #---- count critical readings
|
||||||
my $val = $ehash->{READINGS}{$read}{VAL};
|
my $val = $ehash->{READINGS}{$read}{VAL};
|
||||||
$sum{$read}{$val} =0 if (!$sum{$read}{$val});
|
$sum{$read}{$val} =0 if (!$sum{$read}{$val});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user