mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
fhemweb better links, hminfo status report, cleanups in CUL_HM and HMLAN
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@3334 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5e76e75231
commit
2cc4f53808
@ -7,14 +7,25 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use Time::HiRes qw(gettimeofday time);
|
use Time::HiRes qw(gettimeofday time);
|
||||||
|
|
||||||
sub HMLAN_Parse($$);
|
sub HMLAN_Initialize($);
|
||||||
sub HMLAN_Read($);
|
sub HMLAN_Define($$);
|
||||||
sub HMLAN_Write($$$);
|
sub HMLAN_Undef($$);
|
||||||
|
sub HMLAN_RemoveHMPair($);
|
||||||
|
sub HMLAN_Attr(@);
|
||||||
|
sub HMLAN_Set($@);
|
||||||
sub HMLAN_ReadAnswer($$$);
|
sub HMLAN_ReadAnswer($$$);
|
||||||
|
sub HMLAN_Write($$$);
|
||||||
|
sub HMLAN_Read($);
|
||||||
sub HMLAN_uptime($@);
|
sub HMLAN_uptime($@);
|
||||||
sub HMLAN_secSince2000();
|
sub HMLAN_Parse($$);
|
||||||
|
sub HMLAN_Ready($);
|
||||||
sub HMLAN_SimpleWrite(@);
|
sub HMLAN_SimpleWrite(@);
|
||||||
|
sub HMLAN_DoInit($);
|
||||||
|
sub HMLAN_KeepAlive($);
|
||||||
|
sub HMLAN_secSince2000();
|
||||||
|
sub HMLAN_relOvrLd($);
|
||||||
|
sub HMLAN_relOvrLd($);
|
||||||
|
sub HMLAN_condUpdate($$);
|
||||||
|
|
||||||
my $debug = 1; # set 1 for better log readability
|
my $debug = 1; # set 1 for better log readability
|
||||||
my %sets = ( "hmPairForSec" => "HomeMatic"
|
my %sets = ( "hmPairForSec" => "HomeMatic"
|
||||||
|
@ -709,19 +709,25 @@ FW_makeTable($$$@)
|
|||||||
} else {
|
} else {
|
||||||
$val = FW_htmlEscape($val);
|
$val = FW_htmlEscape($val);
|
||||||
# if possible provide link to reference
|
# if possible provide link to reference
|
||||||
if ($defs{$val}){
|
if ($n eq "room"){
|
||||||
FW_pH "detail=$val", $val,1;
|
my @tmp;
|
||||||
|
push @tmp,FW_pH("room=$_" , $_ ,0,"",1,1)foreach(split(",",$val));
|
||||||
|
FW_pO "<td><div class=\"dval\">"
|
||||||
|
.join(",",@tmp)
|
||||||
|
."</div></td>";
|
||||||
}
|
}
|
||||||
elsif ($n eq "room"){
|
elsif ($n =~ m/^fp_(.*)/ && $defs{$1}){#special for Floorplan
|
||||||
FW_pO "<td><div class=\"dval\">";
|
|
||||||
FW_pH "room=$_", $_ foreach(split(",",$val));
|
|
||||||
FW_pO "</div></td>";
|
|
||||||
}
|
|
||||||
elsif ($n =~ m/^fp_(.*)/ && $defs{$1}){
|
|
||||||
FW_pH "detail=$1", $val,1;
|
FW_pH "detail=$1", $val,1;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
FW_pO "<td><div class=\"dval\">$val</div></td>";
|
my @tmp;
|
||||||
|
foreach(split(",",$val)){
|
||||||
|
if ($defs{$_}){ push @tmp, FW_pH( "detail=$_", $_ ,0,"",1,1);}
|
||||||
|
else{ push @tmp, $_;}
|
||||||
|
}
|
||||||
|
FW_pO "<td><div class=\"dval\">"
|
||||||
|
.join(",",@tmp)
|
||||||
|
."</div></td>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -808,7 +814,6 @@ FW_doDetail($)
|
|||||||
FW_makeSelect($d, "attr", $attrList,"attr");
|
FW_makeSelect($d, "attr", $attrList,"attr");
|
||||||
|
|
||||||
FW_makeTable("Attributes", $d, $attr{$d}, "deleteattr");
|
FW_makeTable("Attributes", $d, $attr{$d}, "deleteattr");
|
||||||
|
|
||||||
## dependent objects
|
## dependent objects
|
||||||
my @dob; # dependent objects - triggered by current device
|
my @dob; # dependent objects - triggered by current device
|
||||||
foreach my $dn (sort keys %defs) {
|
foreach my $dn (sort keys %defs) {
|
||||||
@ -1992,23 +1997,23 @@ FW_pO(@)
|
|||||||
sub
|
sub
|
||||||
FW_pH(@)
|
FW_pH(@)
|
||||||
{
|
{
|
||||||
my ($link, $txt, $td, $class, $doRet) = @_;
|
my ($link, $txt, $td, $class, $doRet,$nonl) = @_;
|
||||||
my $ret = "";
|
my $ret;
|
||||||
|
|
||||||
$ret .= "<td>" if($td);
|
|
||||||
$link = ($link =~ m,^/,) ? $link : "$FW_ME$FW_subdir?$link";
|
$link = ($link =~ m,^/,) ? $link : "$FW_ME$FW_subdir?$link";
|
||||||
$class = "" if(!defined($class));
|
#actually 'div' should be removed if no class is defined
|
||||||
$class = " class=\"$class\"" if($class);
|
# as I can't check all code for consistancy I add nonl instead
|
||||||
|
$class = ($class)?" class=\"$class\"":"";
|
||||||
|
$txt = "<div$class>$txt</div>" if (!$nonl);
|
||||||
|
|
||||||
# Using onclick, as href starts safari in a webapp.
|
# Using onclick, as href starts safari in a webapp.
|
||||||
# Known issue: the pointer won't change
|
# Known issue: the pointer won't change
|
||||||
if($FW_ss || $FW_tp) {
|
if($FW_ss || $FW_tp) {
|
||||||
$ret .= "<a onClick=\"location.href='$link'\"><div$class>$txt</div></a>";
|
$ret = "<a onClick=\"location.href='$link'\">$txt</a>";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$ret .= "<a href=\"$link\"><div$class>$txt</div></a>";
|
$ret = "<a href=\"$link\">$txt</a>";
|
||||||
}
|
}
|
||||||
$ret .= "</td>" if($td);
|
$ret = "<td>$ret</td>" if($td);
|
||||||
return $ret if($doRet);
|
return $ret if($doRet);
|
||||||
FW_pO $ret;
|
FW_pO $ret;
|
||||||
}
|
}
|
||||||
|
@ -36,41 +36,83 @@ my $K_actDetID =HMConfig::HMConfig_getHash("K_actDetID");
|
|||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
sub CUL_HM_Initialize($);
|
sub CUL_HM_Initialize($);
|
||||||
|
sub CUL_HM_reqStatus($);
|
||||||
|
sub CUL_HM_autoReadConfig($);
|
||||||
|
sub CUL_HM_updateConfig($);
|
||||||
sub CUL_HM_Define($$);
|
sub CUL_HM_Define($$);
|
||||||
sub CUL_HM_Undef($$);
|
sub CUL_HM_Undef($$);
|
||||||
|
sub CUL_HM_Rename($$$);
|
||||||
|
sub CUL_HM_Attr(@);
|
||||||
sub CUL_HM_Parse($$);
|
sub CUL_HM_Parse($$);
|
||||||
|
sub CUL_HM_parseCommon(@);
|
||||||
|
sub CUL_HM_queueAutoRead($);
|
||||||
sub CUL_HM_Get($@);
|
sub CUL_HM_Get($@);
|
||||||
sub CUL_HM_fltCvT($);
|
|
||||||
sub CUL_HM_Set($@);
|
sub CUL_HM_Set($@);
|
||||||
|
sub CUL_HM_valvePosUpdt(@);
|
||||||
sub CUL_HM_infoUpdtDevData($$$);
|
sub CUL_HM_infoUpdtDevData($$$);
|
||||||
|
sub CUL_HM_infoUpdtChanData(@);
|
||||||
sub CUL_HM_Pair(@);
|
sub CUL_HM_Pair(@);
|
||||||
sub CUL_HM_getConfig($$$$$);
|
sub CUL_HM_getConfig($$$$$);
|
||||||
sub CUL_HM_SndCmd($$);
|
sub CUL_HM_SndCmd($$);
|
||||||
sub CUL_HM_responseSetup($$);
|
sub CUL_HM_responseSetup($$);
|
||||||
sub CUL_HM_eventP($$);
|
sub CUL_HM_eventP($$);
|
||||||
|
sub CUL_HM_protState($$);
|
||||||
sub CUL_HM_respPendRm($);
|
sub CUL_HM_respPendRm($);
|
||||||
sub CUL_HM_respPendTout($);
|
sub CUL_HM_respPendTout($);
|
||||||
|
sub CUL_HM_respPendToutProlong($);
|
||||||
sub CUL_HM_PushCmdStack($$);
|
sub CUL_HM_PushCmdStack($$);
|
||||||
sub CUL_HM_ProcessCmdStack($);
|
sub CUL_HM_ProcessCmdStack($);
|
||||||
|
sub CUL_HM_pushConfig($$$$$$$$);
|
||||||
sub CUL_HM_Resend($);
|
sub CUL_HM_Resend($);
|
||||||
|
sub CUL_HM_ID2PeerList ($$$);
|
||||||
|
sub CUL_HM_peerChId($$$);
|
||||||
|
sub CUL_HM_peerChName($$$);
|
||||||
|
sub CUL_HM_getMId($);
|
||||||
|
sub CUL_HM_getRxType($);
|
||||||
|
sub CUL_HM_getFlag($);
|
||||||
|
sub CUL_HM_getAssChnIds($);
|
||||||
sub CUL_HM_Id($);
|
sub CUL_HM_Id($);
|
||||||
|
sub CUL_HM_IOid($);
|
||||||
|
sub CUL_HM_hash2Id($);
|
||||||
|
sub CUL_HM_hash2Name($);
|
||||||
sub CUL_HM_name2Hash($);
|
sub CUL_HM_name2Hash($);
|
||||||
sub CUL_HM_name2Id(@);
|
sub CUL_HM_name2Id(@);
|
||||||
sub CUL_HM_id2Name($);
|
sub CUL_HM_id2Name($);
|
||||||
|
sub CUL_HM_id2Hash($);
|
||||||
sub CUL_HM_getDeviceHash($);
|
sub CUL_HM_getDeviceHash($);
|
||||||
|
sub CUL_HM_getDeviceName($);
|
||||||
sub CUL_HM_DumpProtocol($$@);
|
sub CUL_HM_DumpProtocol($$@);
|
||||||
sub CUL_HM_parseCommon(@);
|
sub CUL_HM_getRegFromStore($$$$@);
|
||||||
|
sub CUL_HM_updtRegDisp($$$);
|
||||||
sub CUL_HM_encodeTime8($);
|
sub CUL_HM_encodeTime8($);
|
||||||
sub CUL_HM_decodeTime8($);
|
sub CUL_HM_decodeTime8($);
|
||||||
sub CUL_HM_encodeTime16($);
|
sub CUL_HM_encodeTime16($);
|
||||||
sub CUL_HM_convTemp($);
|
sub CUL_HM_convTemp($);
|
||||||
sub CUL_HM_updtRegDisp($$$);
|
|
||||||
sub CUL_HM_decodeTime16($);
|
sub CUL_HM_decodeTime16($);
|
||||||
sub CUL_HM_pushConfig($$$$$$$$);
|
|
||||||
sub CUL_HM_maticFn($$$$$);
|
|
||||||
sub CUL_HM_secSince2000();
|
sub CUL_HM_secSince2000();
|
||||||
|
sub CUL_HM_getChnLvl($);
|
||||||
|
sub CUL_HM_initRegHash();
|
||||||
|
sub CUL_HM_fltCvT($);
|
||||||
|
sub CUL_HM_CvTflt($);
|
||||||
|
sub CUL_HM_4DisText($);
|
||||||
|
sub CUL_HM_TCtempReadings($);
|
||||||
|
sub CUL_HM_repReadings($);
|
||||||
|
sub CUL_HM_dimLog($);
|
||||||
|
sub CUL_HM_ActGetCreateHash();
|
||||||
|
sub CUL_HM_time2sec($);
|
||||||
|
sub CUL_HM_ActAdd($$);
|
||||||
|
sub CUL_HM_ActDel($);
|
||||||
|
sub CUL_HM_ActCheck();
|
||||||
|
sub CUL_HM_UpdtReadBulk(@);
|
||||||
|
sub CUL_HM_UpdtReadSingle(@);
|
||||||
|
sub CUL_HM_setAttrIfCh($$$$);
|
||||||
sub CUL_HM_noDup(@); #return list with no duplicates
|
sub CUL_HM_noDup(@); #return list with no duplicates
|
||||||
sub CUL_HM_noDupInString($);#return string with no duplicates, comma separated
|
sub CUL_HM_noDupInString($);#return string with no duplicates, comma separated
|
||||||
|
sub CUL_HM_storeRssi(@);
|
||||||
|
sub CUL_HM_stateUpdat($);
|
||||||
|
sub CUL_HM_qStateUpdatIfEnab($@);
|
||||||
|
sub CUL_HM_getAttrInt($$);
|
||||||
|
sub CUL_HM_putHash($);
|
||||||
|
|
||||||
# ----------------modul globals-----------------------
|
# ----------------modul globals-----------------------
|
||||||
my $respRemoved; # used to control trigger of stack processing
|
my $respRemoved; # used to control trigger of stack processing
|
||||||
@ -1875,12 +1917,17 @@ sub CUL_HM_Set($@) {
|
|||||||
foreach my $var (keys %{$hash}){
|
foreach my $var (keys %{$hash}){
|
||||||
delete ($hash->{$var}) if ($var =~ m/^prot/);
|
delete ($hash->{$var}) if ($var =~ m/^prot/);
|
||||||
delete ($hash->{EVENTS});
|
delete ($hash->{EVENTS});
|
||||||
delete ($hash->{helper}{rssi});
|
|
||||||
}
|
}
|
||||||
CUL_HM_protState($hash,"Info_Cleared");
|
CUL_HM_protState($hash,"Info_Cleared");
|
||||||
}
|
}
|
||||||
|
elsif($sect eq "rssi"){
|
||||||
|
delete $defs{$name}{helper}{rssi};
|
||||||
|
foreach my $var (keys %{$hash}){
|
||||||
|
delete ($hash->{$var}) if ($var =~ m/^rssi_/);
|
||||||
|
}
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
return "unknown section. User readings or msgEvents";
|
return "unknown section. User readings, msgEvents or rssi";
|
||||||
}
|
}
|
||||||
$state = "";
|
$state = "";
|
||||||
}
|
}
|
||||||
@ -2833,7 +2880,8 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sub CUL_HM_eventP($$) {#handle protocol events
|
sub CUL_HM_eventP($$) {#handle protocol events
|
||||||
#todo: add severity, counter, history and acknowledge
|
# Current Events are Rcv,NACK,IOerr,Resend,ResendFail,Snd
|
||||||
|
# additional variables are protCmdDel,protCmdPend,protState,protLastRcv
|
||||||
my ($hash, $evntType) = @_;
|
my ($hash, $evntType) = @_;
|
||||||
my $nAttr = $hash;
|
my $nAttr = $hash;
|
||||||
if ($evntType eq "Rcv"){
|
if ($evntType eq "Rcv"){
|
||||||
@ -2870,7 +2918,7 @@ sub CUL_HM_protState($$){
|
|||||||
Log GetLogLevel($name,6),"CUL_HM $name protEvent:$state".
|
Log GetLogLevel($name,6),"CUL_HM $name protEvent:$state".
|
||||||
($hash->{cmdStack}?" pending:".scalar @{$hash->{cmdStack}}:"");
|
($hash->{cmdStack}?" pending:".scalar @{$hash->{cmdStack}}:"");
|
||||||
|
|
||||||
DoTrigger($name, undef) if ($state eq "CMDs_done");
|
DoTrigger($name, undef) if ($state =~ m/^CMDs_done/);
|
||||||
}
|
}
|
||||||
sub CUL_HM_respPendRm($) {#del response related entries in messageing entity
|
sub CUL_HM_respPendRm($) {#del response related entries in messageing entity
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
@ -3755,8 +3803,9 @@ sub CUL_HM_ActCheck() {# perform supervision
|
|||||||
$state = "switchedOff";
|
$state = "switchedOff";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$actHash->{helper}{$devId}{recent} = $devHash->{"protLastRcv"} #update recent
|
$actHash->{helper}{$devId}{recent} = ($devHash->{"protLastRcv"})?#update recent
|
||||||
if ($devHash->{"protLastRcv"});
|
$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",
|
||||||
@ -4033,6 +4082,7 @@ sub CUL_HM_putHash($) {# provide data for HMinfo
|
|||||||
<ul>
|
<ul>
|
||||||
readings: all readings will be deleted. Any new reading will be added usual. May be used to eliminate old data<br>
|
readings: all readings will be deleted. Any new reading will be added usual. May be used to eliminate old data<br>
|
||||||
msgEvents: all message event counter will be removed. Also commandstack will be cleared. <br>
|
msgEvents: all message event counter will be removed. Also commandstack will be cleared. <br>
|
||||||
|
rssi: collected rssi values will be cleared. <br>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><B>getConfig</B><a name="CUL_HMgetConfig"></a><br>
|
<li><B>getConfig</B><a name="CUL_HMgetConfig"></a><br>
|
||||||
@ -4879,7 +4929,7 @@ sub CUL_HM_putHash($) {# provide data for HMinfo
|
|||||||
[normal|added|addedStrong] #HM-CC-SCD<br>
|
[normal|added|addedStrong] #HM-CC-SCD<br>
|
||||||
SDteam [add|remove]_$dname<br>
|
SDteam [add|remove]_$dname<br>
|
||||||
battery [low|ok]<br>
|
battery [low|ok]<br>
|
||||||
smoke_detect on from $src<br>
|
smoke_detect [none|<src>]<br>
|
||||||
test:from $src<br>
|
test:from $src<br>
|
||||||
</li>
|
</li>
|
||||||
<li><B>threeStateSensor</B><br>
|
<li><B>threeStateSensor</B><br>
|
||||||
|
@ -5,8 +5,17 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use POSIX;
|
use POSIX;
|
||||||
|
|
||||||
sub CommandXmlList($$);
|
sub HMinfo_Initialize($$);
|
||||||
sub XmlEscape($);
|
sub HMinfo_Define($$);
|
||||||
|
sub HMinfo_getParam(@);
|
||||||
|
sub HMinfo_regCheck(@);
|
||||||
|
sub HMinfo_peerCheck(@);
|
||||||
|
sub HMinfo_peerCheck(@);
|
||||||
|
sub HMinfo_getEntities(@);
|
||||||
|
sub HMinfo_SetFn($$);
|
||||||
|
sub HMinfo_SetFnDly($);
|
||||||
|
sub HMinfo_post($);
|
||||||
|
|
||||||
use Blocking;
|
use Blocking;
|
||||||
|
|
||||||
sub HMinfo_Initialize($$) {####################################################
|
sub HMinfo_Initialize($$) {####################################################
|
||||||
@ -14,13 +23,33 @@ sub HMinfo_Initialize($$) {####################################################
|
|||||||
|
|
||||||
$hash->{DefFn} = "HMinfo_Define";
|
$hash->{DefFn} = "HMinfo_Define";
|
||||||
$hash->{SetFn} = "HMinfo_SetFn";
|
$hash->{SetFn} = "HMinfo_SetFn";
|
||||||
|
$hash->{AttrList} = "loglevel:0,1,2,3,4,5,6 ".
|
||||||
|
"sumStatus sumERROR ".
|
||||||
|
$readingFnAttributes;
|
||||||
|
|
||||||
}
|
}
|
||||||
sub HMinfo_Define($$){#########################################################
|
sub HMinfo_Define($$){#########################################################
|
||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
my @a = split("[ \t][ \t]*", $def);
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
$hash->{Version} = "01";
|
$hash->{Version} = "01";
|
||||||
$attr{$name}{webCmd} = "protoEvents:rssi:peerXref:configCheck:models";
|
$attr{$name}{webCmd} = "update:protoEvents:rssi:peerXref:configCheck:models";
|
||||||
|
$attr{$name}{sumStatus} = "battery"
|
||||||
|
.",sabotageError"
|
||||||
|
.",powerError"
|
||||||
|
.",motor";
|
||||||
|
$attr{$name}{sumERROR} = "battery:ok"
|
||||||
|
.",sabotageError:off"
|
||||||
|
.",powerError:ok"
|
||||||
|
.",overload:off"
|
||||||
|
.",overheat:off"
|
||||||
|
.",reduced:off"
|
||||||
|
.",motorError:no"
|
||||||
|
.",error:none"
|
||||||
|
.",uncertain:yes"
|
||||||
|
.",smoke_detect:none"
|
||||||
|
.",cover:closed"
|
||||||
|
;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sub HMinfo_getParam(@) { ######################################################
|
sub HMinfo_getParam(@) { ######################################################
|
||||||
@ -174,19 +203,17 @@ sub HMinfo_SetFn($$) {#########################################################
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd eq "?" ) {##actionImmediate: clear parameter--------------
|
if ($cmd eq "?" ) {##actionImmediate: clear parameter--------------
|
||||||
return "autoReadReg clear configCheck param peerCheck peerXref protoEvents models regCheck register rssi saveConfig";
|
return "autoReadReg clear configCheck param peerCheck peerXref protoEvents models regCheck register rssi saveConfig update";
|
||||||
}
|
}
|
||||||
elsif($cmd eq "clear" ) {##actionImmediate: clear parameter--------------
|
elsif($cmd eq "clear" ) {##actionImmediate: clear parameter--------------
|
||||||
my ($type) = @a;
|
my ($type) = @a;
|
||||||
$opt .= "d" if ($type ne "Readings");# readings apply to all, others device only
|
$opt .= "d" if ($type ne "Readings");# readings apply to all, others device only
|
||||||
my @entities;
|
my @entities;
|
||||||
|
return "unknown parameter - use Protocol,readings or rssi" if ($type !~ m/^(Protocol|readings|rssi)$/);
|
||||||
|
$type = "msgEvents" if ($type eq "Protocol");# translate parameter
|
||||||
foreach my $dName (HMinfo_getEntities($opt."v",$filter)){
|
foreach my $dName (HMinfo_getEntities($opt."v",$filter)){
|
||||||
push @entities,$dName;
|
push @entities,$dName;
|
||||||
if ($type eq "Rssi"){
|
CUL_HM_Set($defs{$dName},$dName,"clear",$type);
|
||||||
delete $defs{$dName}{helper}{rssi};
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
CUL_HM_Set($defs{$dName},$dName,"clear",(($type eq "Protocol")?"msgEvents":"readings"));
|
|
||||||
}
|
}
|
||||||
return $cmd.$type." done:" ."\n cleared" ."\n ".(join "\n ",sort @entities)
|
return $cmd.$type." done:" ."\n cleared" ."\n ".(join "\n ",sort @entities)
|
||||||
;
|
;
|
||||||
@ -371,6 +398,9 @@ sub HMinfo_SetFn($$) {#########################################################
|
|||||||
)
|
)
|
||||||
.join"\n ",grep(/$filter/,sort @model);
|
.join"\n ",grep(/$filter/,sort @model);
|
||||||
}
|
}
|
||||||
|
elsif($cmd eq "update") {##update hm counts -----------------------------
|
||||||
|
return HMinfo_status($hash);
|
||||||
|
}
|
||||||
elsif($cmd eq "help") {
|
elsif($cmd eq "help") {
|
||||||
$ret = " Unknown argument $cmd, choose one of "
|
$ret = " Unknown argument $cmd, choose one of "
|
||||||
."\n ---checks---"
|
."\n ---checks---"
|
||||||
@ -381,8 +411,9 @@ sub HMinfo_SetFn($$) {#########################################################
|
|||||||
."\n saveConfig [<typeFilter>] <file> # stores peers and register with saveConfig"
|
."\n saveConfig [<typeFilter>] <file> # stores peers and register with saveConfig"
|
||||||
."\n autoReadReg [<typeFilter>] # trigger update readings if attr autoReadReg is set"
|
."\n autoReadReg [<typeFilter>] # trigger update readings if attr autoReadReg is set"
|
||||||
."\n ---infos---"
|
."\n ---infos---"
|
||||||
|
."\n update # update HMindfo counts"
|
||||||
."\n register [<typeFilter>] # devicefilter parse devicename. Partial strings supported"
|
."\n register [<typeFilter>] # devicefilter parse devicename. Partial strings supported"
|
||||||
."\n peerXref [<typeFilter>] peer cross-reference"
|
."\n peerXref [<typeFilter>] # peer cross-reference"
|
||||||
."\n models [<typeFilter>] # list of models incl native parameter"
|
."\n models [<typeFilter>] # list of models incl native parameter"
|
||||||
."\n protoEvents [<typeFilter>] # protocol status - names can be filtered"
|
."\n protoEvents [<typeFilter>] # protocol status - names can be filtered"
|
||||||
."\n param [<typeFilter>] [<param1>] [<param2>] ... # displays params for all entities as table"
|
."\n param [<typeFilter>] [<param1>] [<param2>] ... # displays params for all entities as table"
|
||||||
@ -422,18 +453,6 @@ sub HMinfo_SetFn($$) {#########################################################
|
|||||||
my $chCnt = ($hash->{helper}{childCnt}+1)%1000;
|
my $chCnt = ($hash->{helper}{childCnt}+1)%1000;
|
||||||
my $childName = "child_".$chCnt;
|
my $childName = "child_".$chCnt;
|
||||||
|
|
||||||
|
|
||||||
# my $blkH = BlockingCall("HMinfo_SetFnDly",
|
|
||||||
# join( ",",($childName,$name,$cmd,$opt,$optEmpty,$filter,@a)),
|
|
||||||
# "HMinfo_post",
|
|
||||||
# 10);
|
|
||||||
# $hash->{helper}{child}{$childName} = " started:".gettimeofday();
|
|
||||||
# $hash->{helper}{childCnt} = $chCnt;
|
|
||||||
# my $chPid = $blkH->{pid};
|
|
||||||
# Log 1,"General parent started $childName PID:$chPid ".$hash->{helper}{child}{$childName};
|
|
||||||
# return "unblock started $childName PID:$chPid ".$hash->{helper}{child}{$childName};
|
|
||||||
|
|
||||||
|
|
||||||
return HMinfo_SetFnDly(join(",",($childName,$name,$cmd,$opt,$optEmpty,$filter,@a)));
|
return HMinfo_SetFnDly(join(",",($childName,$name,$cmd,$opt,$optEmpty,$filter,@a)));
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
@ -472,6 +491,109 @@ sub HMinfo_post($) {###########################################################
|
|||||||
Log 1,"General deleted $childName now++++++++++++++";
|
Log 1,"General deleted $childName now++++++++++++++";
|
||||||
return "finished";
|
return "finished";
|
||||||
}
|
}
|
||||||
|
sub HMinfo_status($){##########################################################
|
||||||
|
# - count defined HM entities, selected readings, errors on filtered readings
|
||||||
|
# - display Assigned IO devices
|
||||||
|
# - show ActionDetector status
|
||||||
|
# - prot events if error
|
||||||
|
my $hash = shift;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
my @IDs = keys%{$modules{CUL_HM}{defptr}};
|
||||||
|
my ($nbrE,$nbrD,$nbrC,$nbrV) = (scalar(@IDs),0,0,0);# count entities
|
||||||
|
my @crit = split ",",$attr{$name}{sumStatus};#prepare event
|
||||||
|
my %sum;
|
||||||
|
my @erro = split ",",$attr{$name}{sumERROR};
|
||||||
|
my %errFlt;
|
||||||
|
my %err;
|
||||||
|
my @errNames;
|
||||||
|
my @IOdev;
|
||||||
|
my %prot = (NACK =>0,IOerr =>0,ResendFail =>0,CmdDel =>0,CmdPend =>0);
|
||||||
|
my @protNames;
|
||||||
|
my @Anames;
|
||||||
|
foreach (@erro){ #prepare reading filter for error counts
|
||||||
|
my ($p,@a) = split ":",$_;
|
||||||
|
$errFlt{$p}{x}=1; # at least one reading
|
||||||
|
$errFlt{$p}{$_}=1 foreach (@a);
|
||||||
|
}
|
||||||
|
foreach my $id (@IDs){#search for Parameter
|
||||||
|
my $ehash = $modules{CUL_HM}{defptr}{$id};
|
||||||
|
my $eName = $ehash->{NAME};
|
||||||
|
$nbrC++ if ($ehash->{helper}{role}{chn});
|
||||||
|
$nbrV++ if ($ehash->{helper}{role}{vrt});
|
||||||
|
foreach my $read (@crit){
|
||||||
|
if ($ehash->{READINGS}{$read}){
|
||||||
|
my $val = $ehash->{READINGS}{$read}{VAL};
|
||||||
|
$sum{$read}{$val} =0 if (!$sum{$read}{$val});
|
||||||
|
$sum{$read}{$val}++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach my $read (keys %errFlt){
|
||||||
|
if ($ehash->{READINGS}{$read}){
|
||||||
|
my $val = $ehash->{READINGS}{$read}{VAL};
|
||||||
|
next if (grep (/$val/,(keys%{$errFlt{$read}})));# filter non-Error
|
||||||
|
$err{$read}{$val} =0 if (!$err{$read}{$val});
|
||||||
|
$err{$read}{$val}++;
|
||||||
|
push @errNames,$eName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($ehash->{helper}{role}{dev}){#restrict to devices
|
||||||
|
$nbrD++;
|
||||||
|
push @IOdev,$ehash->{IODev}{NAME} if($ehash->{IODev});
|
||||||
|
push @Anames,$eName if ($attr{$eName}{actStatus} && $attr{$eName}{actStatus} ne "alive");
|
||||||
|
foreach (keys%prot){
|
||||||
|
if ($ehash->{"prot".$_}){
|
||||||
|
$prot{$_}++;
|
||||||
|
push @protNames,$eName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $v(keys%{$hash}){# remove old readings
|
||||||
|
delete $hash->{$v} if($v =~ m/^(ERR_|sum_)/);
|
||||||
|
}
|
||||||
|
foreach my $read(@crit){
|
||||||
|
next if (!defined $sum{$read} );
|
||||||
|
$hash->{"sum_".$read} = "";
|
||||||
|
$hash->{"sum_".$read} .= "$_:$sum{$read}{$_};"foreach(keys %{$sum{$read}});
|
||||||
|
}
|
||||||
|
foreach my $read(keys %errFlt){
|
||||||
|
next if (!defined $err{$read} );
|
||||||
|
$hash->{"ERR_".$read} = "";
|
||||||
|
$hash->{"ERR_".$read} .= "$_:$err{$read}{$_};"foreach(keys %{$err{$read}});
|
||||||
|
}
|
||||||
|
delete $hash->{ERR_names};
|
||||||
|
$hash->{ERR_names} = join",",@errNames if(@errNames);
|
||||||
|
|
||||||
|
$hash->{sumDefined} = "entities:$nbrE device:$nbrD channel:$nbrC virtual:$nbrV";
|
||||||
|
# ------- what about IO devices??? ------
|
||||||
|
$hash->{actTotal} = $modules{CUL_HM}{defptr}{"000000"}{STATE};# display actionDetector
|
||||||
|
delete $hash->{ERRactNames}if(!@Anames);
|
||||||
|
$hash->{ERRactNames} = join",",@Anames;
|
||||||
|
|
||||||
|
# ------- what about IO devices??? ------
|
||||||
|
my %tmp;
|
||||||
|
$tmp{$_}=0 for @IOdev;
|
||||||
|
delete $tmp{""}; #remove empties if present
|
||||||
|
|
||||||
|
@IOdev = sort keys %tmp;
|
||||||
|
foreach (@IOdev){
|
||||||
|
$_ .= ":".$defs{$_}{READINGS}{cond}{VAL} if($defs{$_}{READINGS}{cond});
|
||||||
|
}
|
||||||
|
$hash->{HM_IOdevices}= join",",@IOdev;
|
||||||
|
# ------- what about protocol events ------
|
||||||
|
# Current Events are Rcv,NACK,IOerr,Resend,ResendFail,Snd
|
||||||
|
# additional variables are protCmdDel,protCmdPend,protState,protLastRcv
|
||||||
|
my @tp;
|
||||||
|
foreach (keys(%prot)){ push @tp,"$_:$prot{$_}" if ($prot{$_})};
|
||||||
|
delete $hash->{ERR__protocol};
|
||||||
|
delete $hash->{ERR__protoNames};
|
||||||
|
$hash->{ERR__protocol} = join",",@tp if(@tp);
|
||||||
|
$hash->{ERR__protoNames} = join",",@protNames if(@protNames);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
=pod
|
=pod
|
||||||
=begin html
|
=begin html
|
||||||
@ -481,7 +603,24 @@ sub HMinfo_post($) {###########################################################
|
|||||||
<ul>
|
<ul>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
HMinfo is a module that shall support in getting an overview of
|
HMinfo is a module that shall support in getting an overview of
|
||||||
eQ-3 HomeMatic devices as defines in <a href="#CUL_HM">CUL_HM</a>.
|
eQ-3 HomeMatic devices as defines in <a href="#CUL_HM">CUL_HM</a>. <br><br>
|
||||||
|
<B>Status information and counter</B><br>
|
||||||
|
hminfo tries to give an overview on the CUL_HM installed base including current conditions.
|
||||||
|
Readings and counter will not be updates automatically due to performance issues. <br>
|
||||||
|
Command <a href="#HMinfoupdate">update</a> must be used to refresh the values.
|
||||||
|
<ul><code>
|
||||||
|
set hm update<br>
|
||||||
|
</code></ul>
|
||||||
|
Webview of HMinfo will provide details, mainly based counter drivern, on how
|
||||||
|
many CUL_HM entities experience certain conditions. Areas provided are
|
||||||
|
<li>Action Detector status</li>
|
||||||
|
<li>CUL_HM related IO devices with their condition</li>
|
||||||
|
<li>Device protocol events which are related to communication errors</li>
|
||||||
|
<li>count of certain readings (e.g. batterie) with their condition - <a href="HMinfoattr">attribut controlled</a></li>
|
||||||
|
<li>count of error condition in readings (e.g. overheat, motorError) - <a href="HMinfoattr">attribut controlled</a></li>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
It also allows some HM wide commands such
|
It also allows some HM wide commands such
|
||||||
as store all collected register settings.<br><br>
|
as store all collected register settings.<br><br>
|
||||||
|
|
||||||
@ -489,7 +628,7 @@ sub HMinfo_post($) {###########################################################
|
|||||||
If applicable and evident execution is restricted to related entities.
|
If applicable and evident execution is restricted to related entities.
|
||||||
This means that rssi is executed only on devices, never channels since
|
This means that rssi is executed only on devices, never channels since
|
||||||
they never have support rssi values.<br><br>
|
they never have support rssi values.<br><br>
|
||||||
<b>Filter</b>
|
<a name="HMinfoFilter"><b>Filter</b></a>
|
||||||
<ul> can be applied as following:<br><br>
|
<ul> can be applied as following:<br><br>
|
||||||
<code>set <name> <cmd> <filter> [<param>]</code><br>
|
<code>set <name> <cmd> <filter> [<param>]</code><br>
|
||||||
whereby filter has two segments, typefilter and name filter<br>
|
whereby filter has two segments, typefilter and name filter<br>
|
||||||
@ -516,55 +655,59 @@ sub HMinfo_post($) {###########################################################
|
|||||||
</code></ul>
|
</code></ul>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<a name="HMinfodefine"></a>
|
<a name="HMinfodefine"><b>Define</b></a>
|
||||||
<b>Define</b>
|
|
||||||
<ul>
|
<ul>
|
||||||
<code>define <name> HMinfo</code><br>
|
<code>define <name> HMinfo</code><br>
|
||||||
Just one entity needs to be defines, no parameter are necessary.<br>
|
Just one entity needs to be defines, no parameter are necessary.<br>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<a name="HMinfoset"></a>
|
|
||||||
<b>Set</b>
|
<a name="HMinfoset"><b>Set</b></a>
|
||||||
<ul>
|
<ul>
|
||||||
even though the commands are more a get funktion they are implemented
|
even though the commands are more a get funktion they are implemented
|
||||||
as set to allow simple web interface usage<br>
|
as set to allow simple web interface usage<br>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a name="#models">models</a><br>
|
<li><a name="#HMinfoupdate">update</a><br>
|
||||||
|
updates HM status counter.
|
||||||
|
</li>
|
||||||
|
<li><a name="#HMinfomodels">models</a><br>
|
||||||
list all HM models that are supported in FHEM
|
list all HM models that are supported in FHEM
|
||||||
</li>
|
</li>
|
||||||
<li><a name="#param">param <name> <name>...</a><br>
|
<li><a name="#HMinfoparam">param</a> <a href="HMinfoFilter">[filter]</a> <name> <name>...<br>
|
||||||
returns a table parameter values (attribute, readings,...)
|
returns a table parameter values (attribute, readings,...)
|
||||||
for all entities as a table
|
for all entities as a table
|
||||||
</li>
|
</li>
|
||||||
<li><a name="#regCheck">regCheck</a><br>
|
<li><a name="#HMinfopeerXref">peerXref</a> <a href="HMinfoFilter">[filter]</a><br>
|
||||||
performs a consistancy check on register readings for completeness
|
provides a cross-reference on peerings, a kind of who-with-who summary over HM
|
||||||
</li>
|
</li>
|
||||||
<li><a name="#peerCheck">peerCheck</a><br>
|
<li><a name="#HMinforegister">register</a> <a href="HMinfoFilter">[filter]</a><br>
|
||||||
|
provides a tableview of register of an entity
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li><a name="#HMinfoconfigCheck">configCheck</a> <a href="HMinfoFilter">[filter]</a><br>
|
||||||
|
performs a consistancy check of HM settings. It includes regCheck and peerCheck
|
||||||
|
</li>
|
||||||
|
<li><a name="#HMinfopeerCheck">peerCheck</a> <a href="HMinfoFilter">[filter]</a><br>
|
||||||
performs a consistancy check on peers. If a peer is set in one channel
|
performs a consistancy check on peers. If a peer is set in one channel
|
||||||
this funktion will search wether the peer also exist on the opposit side.
|
this funktion will search wether the peer also exist on the opposit side.
|
||||||
</li>
|
</li>
|
||||||
<li><a name="#configCheck">configCheck</a><br>
|
<li><a name="#HMinforegCheck">regCheck</a> <a href="HMinfoFilter">[filter]</a><br>
|
||||||
performs a consistancy check of HM settings. It includes regCheck and peerCheck
|
performs a consistancy check on register readings for completeness
|
||||||
</li>
|
</li>
|
||||||
<li><a name="#peerXref">peerXref</a><br>
|
|
||||||
provides a cross-reference on peerings, a kind of who-with-who summary over HM
|
<li><a name="#HMinfoautoReadReg">autoReadReg</a> <a href="HMinfoFilter">[filter]</a><br>
|
||||||
|
schedules a read of the configuration for the CUL_HM devices with attribut autoReadReg set to 1 or higher.
|
||||||
</li>
|
</li>
|
||||||
<li><a name="#saveConfig">saveConfig</a><br>
|
<li><a name="#HMinfoclear">clear [Protocol|Readings|Rssi]</a> <a href="HMinfoFilter">[filter]</a><br>
|
||||||
|
executes a set clear ... on all HM entities<br>
|
||||||
|
<li>Protocol relates to set clear msgEvents</li>
|
||||||
|
<li>Readings relates to set clear readings</li>
|
||||||
|
<li>Rssi clears all rssi counters </li>
|
||||||
|
</li>
|
||||||
|
<li><a name="#HMinfosaveConfig">saveConfig</a> <a href="HMinfoFilter">[filter]</a><br>
|
||||||
performs a save for all HM register setting and peers. See <a href="#CUL_HMsaveConfig">CUL_HM saveConfig</a>.
|
performs a save for all HM register setting and peers. See <a href="#CUL_HMsaveConfig">CUL_HM saveConfig</a>.
|
||||||
</li>
|
</li>
|
||||||
<li><a name="#clearProtocol">clearProtocol</a><br>
|
|
||||||
executes a set clear msgEvents on all HM devices
|
|
||||||
</li>
|
|
||||||
<li><a name="#clearReadings">clearReadings</a><br>
|
|
||||||
executes a set clear readings on all HM devices
|
|
||||||
</li>
|
|
||||||
<li><a name="#clearRssi">clearRssi</a><br>
|
|
||||||
executes a set clear rssi on all HM devices
|
|
||||||
</li>
|
|
||||||
<li><a name="#autoReadReg">autoReadReg</a><br>
|
|
||||||
stimulates a read of the configuration for the CUL_HM devices with attribut autoReadReg set to 1 or higher.
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
@ -574,9 +717,39 @@ sub HMinfo_post($) {###########################################################
|
|||||||
<ul> N/A </ul>
|
<ul> N/A </ul>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
<a name="HMinfoattr"></a>
|
<a name="HMinfoattr"><b>Attributes</b></a>
|
||||||
<b>Attributes</b>
|
<ul>
|
||||||
<ul>N/A</ul>
|
<li><a href="#HMinfosumStatus">sumStatus</a><br>
|
||||||
|
List of readings that shall be screend and counted based on current presence.
|
||||||
|
I.e. counter is the number of entities with this reading and the same value.
|
||||||
|
Readings to be searched are separated by comma. <br>
|
||||||
|
Example: <br>
|
||||||
|
<code>
|
||||||
|
attr hm sumStatus battery,sabotageError<br>
|
||||||
|
</code>
|
||||||
|
will cause a reading like<br>
|
||||||
|
sum_batterie ok:5 low:3<br>
|
||||||
|
sum_sabotageError on:1<br>
|
||||||
|
<br>
|
||||||
|
Note: counter with '0' value will not be reported. HMinfo will find all present values autonomously<br>
|
||||||
|
Setting is meant to give user a fast overview of parameter that are expected to be system critical<br>
|
||||||
|
</li>
|
||||||
|
<li><a href="#HMinfosumERROR">sumERROR</a>
|
||||||
|
Similar to sumStatus but with a focus on error conditions in the system.
|
||||||
|
Here user can add reading<b>values</b> that are <b>not displayed</b>. I.e. the value is the
|
||||||
|
good-condition that will not be counted.<br>
|
||||||
|
This way user must not know all error values but it is sufficient to supress known non-ciritical ones.
|
||||||
|
Example: <br>
|
||||||
|
<code>
|
||||||
|
attr hm sumERROR battery:ok,sabotageError:off,overheat:off,Activity:alive:unknown<br>
|
||||||
|
</code>
|
||||||
|
will cause a reading like<br>
|
||||||
|
ERR_batterie low:3<br>
|
||||||
|
ERR_sabotageError on:1<br>
|
||||||
|
ERR_overheat on:3<br>
|
||||||
|
ERR_Activity dead:5<br>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
=end html
|
=end html
|
||||||
=cut
|
=cut
|
||||||
|
Loading…
x
Reference in New Issue
Block a user