2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

HMInfo: info handling

git-svn-id: https://svn.fhem.de/fhem/trunk@10997 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2016-03-05 16:14:57 +00:00
parent a824537274
commit 692c8367a5
2 changed files with 37 additions and 17 deletions

View File

@ -4652,16 +4652,23 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
CUL_HM_PushCmdStack($hash,'++'.$flag."11$id$dst"."8604$temp"); CUL_HM_PushCmdStack($hash,'++'.$flag."11$id$dst"."8604$temp");
my $idTch = ($md =~ m/HM-CC-RT-DN/ ? $dst."05" : $dst."02"); my $idTch = ($md =~ m/HM-CC-RT-DN/ ? $dst."05" : $dst."02");
my @teamList = ( split(",",InternalVal(CUL_HM_id2Name($dst."05"),"peerList","")) # peers of RT team my @teamList = ( split(",",AttrVal(CUL_HM_id2Name($dst."05"),"peerIDs","")) # peers of RT team
,split(",",InternalVal(CUL_HM_id2Name($dst."02"),"peerList","")) # peers RT/TC team ,split(",",AttrVal(CUL_HM_id2Name($dst."02"),"peerIDs","")) # peers RT/TC team
,$name # myself ,$dst."02" # myself
); );
foreach my $team (@teamList){ foreach my $tId (@teamList){
next if (!defined $defs{$team} ); my $teamC = CUL_HM_id2Name($tId);
my $tId = substr(CUL_HM_name2Id($team),0,6); $tId = substr($tId,0,6);
CUL_HM_PushCmdStack($defs{$team},'++'.$flag."11$id$tId"."8604$temp"); my $teamD = CUL_HM_id2Name($tId);
CUL_HM_UpdtReadSingle($defs{$team},"state",$state,1); next if (!defined $defs{$teamC} );
CUL_HM_PushCmdStack($defs{$teamD},'++'.$flag."11$id$tId"."8604$temp");
CUL_HM_UpdtReadSingle($defs{$teamC},"state",$state,1);
if ( $tId ne $dst
&& CUL_HM_getRxType($defs{$teamD}) & "02"){
# burst device - we need to send immediately
CUL_HM_SndCmd($defs{$teamD},"++B112$id".substr($tId,0,6));
}
} }
} }
else{ else{

View File

@ -240,7 +240,7 @@ sub HMinfo_status($){##########################################################
$nbrD++; $nbrD++;
push @IOdev,$ehash->{IODev}{NAME} if($ehash->{IODev} && $ehash->{IODev}{NAME}); push @IOdev,$ehash->{IODev}{NAME} if($ehash->{IODev} && $ehash->{IODev}{NAME});
$IOccu{(split ":",AttrVal($eName,"IOgrp","no"))[0]}=1; $IOccu{(split ":",AttrVal($eName,"IOgrp","no"))[0]}=1;
push @Anames,$eName if ($attr{$eName}{actStatus} && $attr{$eName}{actStatus} ne "alive"); push @Anames,$eName if ($attr{$eName}{actStatus} && $attr{$eName}{actStatus} eq "dead");
foreach (grep /ErrIoId_/, keys %{$ehash}){# detect addtional critical entries foreach (grep /ErrIoId_/, keys %{$ehash}){# detect addtional critical entries
my $k = $_; my $k = $_;
@ -265,11 +265,23 @@ sub HMinfo_status($){##########################################################
$d .= "$_:$sum{$read}{$_},"foreach(keys %{$sum{$read}}); $d .= "$_:$sum{$read}{$_},"foreach(keys %{$sum{$read}});
push @updates,"I_sum_$read:".$d; push @updates,"I_sum_$read:".$d;
} }
foreach my $read(grep {defined $err{$_}} keys %errFlt){#--- disp err count foreach my $read(keys %errFlt) {
if (defined $err{$read}) {
my $d; my $d;
$d .= "$_:$err{$read}{$_},"foreach(keys %{$err{$read}}); $d .= "$_:$err{$read}{$_},"foreach(keys %{$err{$read}});
push @updates,"ERR_$read:".$d; push @updates,"ERR_$read:".$d;
} }
elsif (defined $hash->{READINGS}{"ERR_$read"}) {
if ($hash->{READINGS}{"ERR_$read"}{VAL} ne '-') {
# Error condition has been resolved, push empty update
push @updates,"ERR_$read:";
}
else {
# Delete reading again if it was already empty
delete $hash->{READINGS}{"ERR_$read"};
}
}
}
@errNames = grep !/^$/,HMinfo_noDup(@errNames); @errNames = grep !/^$/,HMinfo_noDup(@errNames);
$hash->{ERR_names} = join",",@errNames if(@errNames);# and name entities $hash->{ERR_names} = join",",@errNames if(@errNames);# and name entities
@ -294,9 +306,9 @@ sub HMinfo_status($){##########################################################
# Current Events are Rcv,NACK,IOerr,Resend,ResendFail,Snd # Current Events are Rcv,NACK,IOerr,Resend,ResendFail,Snd
# additional variables are protCmdDel,protCmdPend,protState,protLastRcv # additional variables are protCmdDel,protCmdPend,protState,protLastRcv
push @updates,"CRIT__protocol:" .join(",",map {"$_:$protC{$_}"} grep {$protC{$_}} keys(%protC)); push @updates,"CRIT__protocol:" .join(",",map {"$_:$protC{$_}"} grep {$protC{$_}} sort keys(%protC));
push @updates,"ERR__protocol:" .join(",",map {"$_:$protE{$_}"} grep {$protE{$_}} keys(%protE)); push @updates,"ERR__protocol:" .join(",",map {"$_:$protE{$_}"} grep {$protE{$_}} sort keys(%protE));
push @updates,"W__protocol:" .join(",",map {"$_:$protW{$_}"} grep {$protW{$_}} keys(%protW)); push @updates,"W__protocol:" .join(",",map {"$_:$protW{$_}"} grep {$protW{$_}} sort keys(%protW));
my @tpu = devspec2array("TYPE=CUL_HM:FILTER=state=unreachable"); my @tpu = devspec2array("TYPE=CUL_HM:FILTER=state=unreachable");
push @updates,"ERR__unreachable:".scalar(@tpu); push @updates,"ERR__unreachable:".scalar(@tpu);
@ -327,6 +339,7 @@ sub HMinfo_status($){##########################################################
foreach (grep(/^(ERR|W_|I_|C_|CRI_)/,keys%{$hash})){# remove empty entries foreach (grep(/^(ERR|W_|I_|C_|CRI_)/,keys%{$hash})){# remove empty entries
delete $hash->{$_} if(!$hash->{$_}); delete $hash->{$_} if(!$hash->{$_});
# delete $hash->{READINGS}{$_};
} }
readingsBeginUpdate($hash); readingsBeginUpdate($hash);