HMInfo: remove test routines

git-svn-id: https://svn.fhem.de/fhem/trunk@10026 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2015-11-28 09:53:59 +00:00
parent 7946c2fdb9
commit 6f8d613d4b

View File

@ -1140,7 +1140,7 @@ sub HMinfo_GetFn($@) {#########################################################
$ret = ""; $ret = "";
} }
else{ else{
$ret = HMinfo_configCheck (join(",",("$name;;",$opt,$filter))); (undef,undef,undef,$ret) = split(";",HMinfo_configCheck (join(",",("$name;;",$opt,$filter))),4);
$ret =~s/-ret-/\n/g; $ret =~s/-ret-/\n/g;
} }
} }
@ -1211,57 +1211,6 @@ sub HMinfo_GetFn($@) {#########################################################
"HMinfo_bpAbort", "$name:0"); "HMinfo_bpAbort", "$name:0");
$hash->{nb}{$id}{$_} = $bl->{$_} foreach (keys %{$bl}); $hash->{nb}{$id}{$_} = $bl->{$_} foreach (keys %{$bl});
$ret = ""; $ret = "";
###################
# # devicenameFilter
# my $RegReply = "";
# my @noReg;
# foreach my $dName (HMinfo_getEntities($opt."v",$filter)){
# my $regs = CUL_HM_Get(CUL_HM_name2Hash($dName),$dName,"reg","all");
# if ($regs !~ m/[0-6]:/){
# push @noReg,$dName;
# next;
# }
# my ($peerOld,$ptOld,$ptLine,$peerLine) = ("","",pack('A23',""),pack('A23',""));
# foreach my $reg (split("\n",$regs)){
# my ($peer,$h1) = split ("\t",$reg);
# $peer =~s/ //g;
# if ($peer !~ m/3:/){
# $RegReply .= $reg."\n";
# next;
# }
# next if (!$h1);
# $peer =~s/3://;
# my ($regN,$h2) = split (":",$h1);
# my ($pt,$rN) = unpack 'A2A*',$regN;
# if (!defined($hash->{helper}{r}{$rN})){
# $hash->{helper}{r}{$rN}{v} = "";
# $hash->{helper}{r}{$rN}{u} = pack('A5',"");
# }
# my ($val,$unit) = split (" ",$h2);
# $hash->{helper}{r}{$rN}{v} .= pack('A16',$val);
# $hash->{helper}{r}{$rN}{u} = pack('A5',"[".$unit."]") if ($unit);
# if ($pt ne $ptOld){
# $ptLine .= pack('A16',$pt);
# $ptOld = $pt;
# }
# if ($peer ne $peerOld){
# $peerLine .= pack('A32',$peer);
# $peerOld = $peer;
# }
# }
# $RegReply .= $peerLine."\n".$ptLine."\n";
# foreach my $rN (sort keys %{$hash->{helper}{r}}){
# $hash->{helper}{r}{$rN} =~ s/( o..)/$1 /g
# if($rN =~ m/^MultiExec /); #shift thhis reading since it does not appear for short
# $RegReply .= pack ('A18',$rN)
# .$hash->{helper}{r}{$rN}{u}
# .$hash->{helper}{r}{$rN}{v}
# ."\n";
# }
# delete $hash->{helper}{r};
# }
# $ret = "No regs found for:".join(",",sort @noReg)."\n\n"
# .$RegReply;
} }
elsif($cmd eq "param") {##print param ---------------------------------- elsif($cmd eq "param") {##print param ----------------------------------
my @paramList; my @paramList;
@ -1323,10 +1272,10 @@ sub HMinfo_GetFn($@) {#########################################################
) )
.join"\n ", @model; .join"\n ", @model;
} }
elsif($cmd eq "overview") { # elsif($cmd eq "overview") {
my @entities = HMinfo_getEntities($opt."d",$filter); # my @entities = HMinfo_getEntities($opt."d",$filter);
return HMI_overview(\@entities,\@a); # return HMI_overview(\@entities,\@a);
} # }
elsif($cmd eq "help") { elsif($cmd eq "help") {
$ret = HMInfo_help(); $ret = HMInfo_help();
@ -1491,32 +1440,32 @@ sub HMinfo_SetFn($@) {#########################################################
sub HMInfo_help(){ ############################################################ sub HMInfo_help(){ ############################################################
return " Unknown argument choose one of " return " Unknown argument choose one of "
."\n ---checks---" ."\n ---checks---"
."\n get configCheck [<typeFilter>] # perform regCheck and regCheck" ."\n get configCheck [-typeFilter-] # perform regCheck and regCheck"
."\n get regCheck [<typeFilter>] # find incomplete or inconsistant register readings" ."\n get regCheck [-typeFilter-] # find incomplete or inconsistant register readings"
."\n get peerCheck [<typeFilter>] # find incomplete or inconsistant peer lists" ."\n get peerCheck [-typeFilter-] # find incomplete or inconsistant peer lists"
."\n ---actions---" ."\n ---actions---"
."\n set saveConfig [<typeFilter>] [<file>] # stores peers and register with saveConfig" ."\n set saveConfig [-typeFilter-] [-file-] # stores peers and register with saveConfig"
."\n set archConfig [-a] [<file>] # as saveConfig but only if data of entity is complete" ."\n set archConfig [-a] [-file-] # as saveConfig but only if data of entity is complete"
."\n set purgeConfig [<file>] # purge content of saved configfile " ."\n set purgeConfig [-file-] # purge content of saved configfile "
."\n set loadConfig [<typeFilter>] <file> # restores register and peer readings if missing" ."\n set loadConfig [-typeFilter-] -file- # restores register and peer readings if missing"
."\n set verifyConfig [<typeFilter>] <file> # compare curent date with configfile,report differences" ."\n set verifyConfig [-typeFilter-] -file- # compare curent date with configfile,report differences"
."\n set autoReadReg [<typeFilter>] # trigger update readings if attr autoReadReg is set" ."\n set autoReadReg [-typeFilter-] # trigger update readings if attr autoReadReg is set"
."\n set tempList [<typeFilter>][save|restore|verify|status|genPlot][<filename>]# handle tempList of thermostat devices" ."\n set tempList [-typeFilter-][save|restore|verify|status|genPlot][-filename-]# handle tempList of thermostat devices"
."\n ---infos---" ."\n ---infos---"
."\n set update # update HMindfo counts" ."\n set update # update HMindfo counts"
."\n get register [<typeFilter>] # devicefilter parse devicename. Partial strings supported" ."\n get register [-typeFilter-] # devicefilter parse devicename. Partial strings supported"
."\n get peerXref [<typeFilter>] # peer cross-reference" ."\n get peerXref [-typeFilter-] # peer cross-reference"
."\n get models [<typeFilter>] # list of models incl native parameter" ."\n get models [-typeFilter-] # list of models incl native parameter"
."\n get protoEvents [<typeFilter>] [short|long] # protocol status - names can be filtered" ."\n get protoEvents [-typeFilter-] [short|long] # protocol status - names can be filtered"
."\n get msgStat # view message statistic" ."\n get msgStat # view message statistic"
."\n get param [<typeFilter>] [<param1>] [<param2>] ... # displays params for all entities as table" ."\n get param [-typeFilter-] [-param1-] [-param2-] ... # displays params for all entities as table"
."\n get rssi [<typeFilter>] # displays receive level of the HM devices" ."\n get rssi [-typeFilter-] # displays receive level of the HM devices"
."\n last: most recent" ."\n last: most recent"
."\n avg: average overall" ."\n avg: average overall"
."\n range: min to max value" ."\n range: min to max value"
."\n count: number of events in calculation" ."\n count: number of events in calculation"
."\n ---clear status---" ."\n ---clear status---"
."\n set clear [<typeFilter>] [Protocol|readings|msgStat|register|rssi]" ."\n set clear [-typeFilter-] [Protocol|readings|msgStat|register|rssi]"
."\n Protocol # delete all protocol-events" ."\n Protocol # delete all protocol-events"
."\n readings # delete all readings" ."\n readings # delete all readings"
."\n register # delete all register-readings" ."\n register # delete all register-readings"
@ -1526,27 +1475,27 @@ sub HMInfo_help(){ ############################################################
."\n ---help---" ."\n ---help---"
."\n get help #" ."\n get help #"
."\n ***footnote***" ."\n ***footnote***"
."\n [<nameFilter>] : only matiching names are processed - partial names are possible" ."\n [-nameFilter-] : only matiching names are processed - partial names are possible"
."\n [<modelsFilter>] : any match in the output are searched. " ."\n [-modelsFilter-] : any match in the output are searched. "
."\n" ."\n"
."\n set cpRegs <src:peer> <dst:peer>" ."\n set cpRegs -src:peer- -dst:peer-"
."\n copy register for a channel or behavior of channel/peer" ."\n copy register for a channel or behavior of channel/peer"
."\n set templateDef <templateName> <param1[:<param2>...] <description> <reg1>:<val1> [<reg2>:<val2>] ... " ."\n set templateDef -templateName- -param1[:-param2-...] -description- -reg1-:-val1- [-reg2-:-val2-] ... "
."\n define a template" ."\n define a template"
."\n set templateSet <entity> <templateName> <peer:[long|short]> [<param1> ...] " ."\n set templateSet -entity- -templateName- -peer:[long|short]- [-param1- ...] "
."\n write register according to a given template" ."\n write register according to a given template"
."\n set templateDel <entity> <templateName> <peer:[long|short]> " ."\n set templateDel -entity- -templateName- -peer:[long|short]- "
."\n remove a template set" ."\n remove a template set"
."\n set templateExe <templateName>" ."\n set templateExe -templateName-"
."\n write all assigned templates to the file" ."\n write all assigned templates to the file"
."\n get templateUsg <templateName>" ."\n get templateUsg -templateName-"
."\n show template usage" ."\n show template usage"
."\n get templateChk [<typeFilter>] <templateName> <peer:[long|short]> [<param1> ...] " ."\n get templateChk [-typeFilter-] -templateName- -peer:[long|short]- [-param1- ...] "
."\n compare whether register match the template values" ."\n compare whether register match the template values"
."\n get templateList [<templateName>] # gives a list of templates or a description of the named template" ."\n get templateList [-templateName-] # gives a list of templates or a description of the named template"
."\n list all currently defined templates or the structure of a given template" ."\n list all currently defined templates or the structure of a given template"
."\n ======= typeFilter options: supress class of devices ====" ."\n ======= typeFilter options: supress class of devices ===="
."\n set <name> <cmd> [-dcasev] [-f <filter>] [params]" ."\n set -name- -cmd- [-dcasev] [-f -filter-] [params]"
."\n entities according to list will be processed" ."\n entities according to list will be processed"
."\n d - device :include devices" ."\n d - device :include devices"
."\n c - channels :include channels" ."\n c - channels :include channels"
@ -1934,16 +1883,19 @@ sub HMinfo_configCheck ($){ ###################################################
next if ($tr eq "unused"); next if ($tr eq "unused");
push @tlr,"$e: $tr" if($tr); push @tlr,"$e: $tr" if($tr);
} }
$ret .= "\n\n templist mismatch \n ".join("\n ",@tlr) if (@tlr); $ret .= "\n\n templist mismatch \n ".join("\n ",sort @tlr) if (@tlr);
$ret .= "\n\n templateCheck: \n";
@tlr = ();
foreach my $dName (HMinfo_getEntities($opt."v",$filter)){ foreach my $dName (HMinfo_getEntities($opt."v",$filter)){
next if (!defined $defs{$dName}{helper}{tmpl}); next if (!defined $defs{$dName}{helper}{tmpl});
foreach (keys %{$defs{$dName}{helper}{tmpl}}){ foreach (keys %{$defs{$dName}{helper}{tmpl}}){
my ($p,$t)=split(">",$_); my ($p,$t)=split(">",$_);
my $tck = HMinfo_templateChk($dName,$t,$p,split(" ",$defs{$dName}{helper}{tmpl}{$_})); my $tck = HMinfo_templateChk($dName,$t,$p,split(" ",$defs{$dName}{helper}{tmpl}{$_}));
$ret .= "\n ".$tck if ($tck); push @tlr,$tck if ($tck);
} }
} }
$ret .= "\n\n template mismatch \n ".join("\n ",sort @tlr) if (@tlr);
$ret =~ s/\n/-ret-/g; # replace return with a placeholder - we cannot transfere direct $ret =~ s/\n/-ret-/g; # replace return with a placeholder - we cannot transfere direct
return "$id;$ret"; return "$id;$ret";
} }
@ -2413,62 +2365,62 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
# $p1: regexp to select devicenames # $p1: regexp to select devicenames
# $p2: list of internals, readings and attributes to be displayed. Comma-separated, case sensitive. # $p2: list of internals, readings and attributes to be displayed. Comma-separated, case sensitive.
# #
#use vars qw($FW_encoding); #for handover from fhemweb # use vars qw($FW_encoding); #for handover from fhemweb
sub HMI_overview(@) { # sub HMI_overview(@) {
my ($p1,$paramList)=@_; # my ($p1,$paramList)=@_;
my @dd = @{$p1}; # my @dd = @{$p1};
my @p2l = ("DEF","peerList"); # my @p2l = ("DEF","peerList");
if (!defined($paramList)){ # if (!defined($paramList)){
@p2l=@{$paramList}; # @p2l=@{$paramList};
} # }
######### prepare html # ######### prepare html
my $html ='<html><table class="block wide">'."\n" # my $html ='<html><table class="block wide">'."\n"
.'<style> .HMIdev { border-top:3px solid #555555; width:10%; }' # .'<style> .HMIdev { border-top:3px solid #555555; width:10%; }'
.' .HMIchn { width:10%; }' # .' .HMIchn { width:10%; }'
.'</style>' # .'</style>'
."\n" # ."\n"
.'<tr><th>Device/Channel</th><th>' # .'<tr><th>Device/Channel</th><th>'
.join('</th><th>',@p2l) # .join('</th><th>',@p2l)
."</th></tr>\n"; # ."</th></tr>\n";
######### loop for output # ######### loop for output
my $row=0; # my $row=0;
foreach my $d (sort @dd) { # foreach my $d (sort @dd) {
$html.=HMI_output($defs{$d},1,$row++,\@p2l); # $html.=HMI_output($defs{$d},1,$row++,\@p2l);
foreach my $c (CUL_HM_getAssChnNames($d)) { # foreach my $c (CUL_HM_getAssChnNames($d)) {
$html.=HMI_output($defs{$c},2,$row++,\@p2l); # $html.=HMI_output($defs{$c},2,$row++,\@p2l);
} # }
} # }
$html.="</table></html>\n"; # $html.="</table></html>\n";
return ('text/html; charset=UTF-8',$html); # return ('text/html; charset=UTF-8',$html);
} #end sub HMI_overview # } #end sub HMI_overview
#
sub HMI_output(@) { # sub HMI_output(@) {
my ($hash,$lvl,$drow,$l)=@_; # my ($hash,$lvl,$drow,$l)=@_;
my @list = @{$l}; # my @list = @{$l};
my $n=$hash->{NAME}; # my $n=$hash->{NAME};
my $class= ($lvl==1)?'HMIdev':'HMIchn'; # my $class= ($lvl==1)?'HMIdev':'HMIchn';
######### device/channel # ######### device/channel
my $html.='<tr class = "' # my $html.='<tr class = "'
.(($drow/2==int($drow/2))?"even":"odd") # .(($drow/2==int($drow/2))?"even":"odd")
."\"><td class=\"$class\">" # ."\"><td class=\"$class\">"
.($lvl==2?"&nbsp&nbsp&nbsp":"") # .($lvl==2?"&nbsp&nbsp&nbsp":"")
."<a href=\"$FW_ME?detail=$n\">$n<\/a>" # ."<a href=\"$FW_ME?detail=$n\">$n<\/a>"
.'</td>'; # .'</td>';
######### further values # ######### further values
#
foreach my $p (@list) { # foreach my $p (@list) {
$html.="<td class=\"$class\">"; # $html.="<td class=\"$class\">";
foreach my $pp (split(',',CUL_HM_Get($defs{$n},$n,"param",$p))) { # foreach my $pp (split(',',CUL_HM_Get($defs{$n},$n,"param",$p))) {
$pp =~ s/(.*)/<a href=\"$FW_ME?detail=$1\">$1<\/a>/ if (defined($defs{$pp})); # $pp =~ s/(.*)/<a href=\"$FW_ME?detail=$1\">$1<\/a>/ if (defined($defs{$pp}));
$pp = "" if($pp eq "undefined"); # $pp = "" if($pp eq "undefined");
$html.=$pp.', ' if ($pp !~ /HASH.*/); # $html.=$pp.', ' if ($pp !~ /HASH.*/);
} # }
$_ =~ s/(.*), $/$1/; # $_ =~ s/(.*), $/$1/;
$html.='</td>'; # $html.='</td>';
} # }
$html.="</tr>\n"; # $html.="</tr>\n";
return $html; # return $html;
} #end sub HMI_output # } #end sub HMI_output
1; 1;