mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
update some checks
git-svn-id: https://svn.fhem.de/fhem/trunk@6229 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
56ff0eca9f
commit
df6cc23063
@ -381,7 +381,7 @@ sub CUL_HM_updateConfig($){
|
||||
|
||||
CUL_HM_qStateUpdatIfEnab($name);
|
||||
next if (0 == (0x07 & CUL_HM_getAttrInt($name,"autoReadReg")));
|
||||
if(!CUL_HM_peersValid($name)){
|
||||
if(CUL_HM_peerUsed($name) == 2){
|
||||
CUL_HM_qAutoRead($name,1);
|
||||
}
|
||||
else{
|
||||
@ -3322,7 +3322,9 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
|
||||
elsif($cmd eq "level") { ####################################################
|
||||
#level =>"<level> <relockDly> <speed>..."
|
||||
my (undef,undef,$lvl,$rLocDly,$speed) = @a;
|
||||
return "please enter level 0 to 100" if (!defined($lvl) || $lvl>100);
|
||||
return "" if($lvl !~ m/^\d+\.?\d+$/)
|
||||
|
||||
return "please enter level 0 to 100" if (!defined($lvl) || $lvl !~ m/^\d+\.?\d+$/ || $lvl>100);
|
||||
return "reloclDelay range 0..65535 or ignore"
|
||||
if (defined($rLocDly) &&
|
||||
($rLocDly > 65535 ||
|
||||
@ -6804,12 +6806,14 @@ sub CUL_HM_getAttrInt($@){#return attrValue as integer
|
||||
#+++++++++++++++++ external use +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
sub CUL_HM_peerUsed($) {# are peers expected?
|
||||
# return 0: no peers expected
|
||||
# 1: peers expected, list valid
|
||||
# 2: peers expected, list invalid
|
||||
# 3: peers possible (virtuall actor)
|
||||
my $name = shift;
|
||||
my $hash = $defs{$name};
|
||||
return 0 if (!$hash->{helper}{role}{chn});#device has no channels
|
||||
my $devId = substr($hash->{DEF},0,6);
|
||||
my $peerIDs = AttrVal($name,"peerIDs",undef);
|
||||
return 0 if (AttrVal(CUL_HM_id2Name($devId),"subType","") eq "virtual");
|
||||
return 3 if ($hash->{helper}{role}{vrt});
|
||||
|
||||
my $mId = CUL_HM_getMId($hash);
|
||||
my $cNo = hex(substr($hash->{DEF}."01",6,2))."p"; #default to channel 01
|
||||
@ -6818,18 +6822,11 @@ sub CUL_HM_peerUsed($) {# are peers expected?
|
||||
my ($l,$c) = split":",$ls;
|
||||
if ( ($l =~ m/^(p|3|4)$/ && !$c ) # 3,4,p without chanspec
|
||||
||($c && $c =~ m/$cNo/ )){
|
||||
return (AttrVal($name,"peerIDs","") =~ m/00000000/?1:2);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
sub CUL_HM_peersValid($) {# is list valid?
|
||||
my $name = shift;
|
||||
if (CUL_HM_peerUsed($name)
|
||||
&& AttrVal($name,"peerIDs","") !~ m/00000000/){
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
sub CUL_HM_reglUsed($) {# provide data for HMinfo
|
||||
my $name = shift;
|
||||
my $hash = $defs{$name};
|
||||
@ -6886,7 +6883,7 @@ sub CUL_HM_complConfig($) {# read config if enabled and not complete
|
||||
my $name = shift;
|
||||
return if ($modules{CUL_HM}{helper}{hmManualOper});#no autoaction when manual
|
||||
return if ((CUL_HM_getAttrInt($name,"autoReadReg") & 0x07) < 5);
|
||||
if (CUL_HM_peerUsed($name) && !CUL_HM_peersValid($name) ){
|
||||
if (CUL_HM_peerUsed($name) == 2){
|
||||
CUL_HM_qAutoRead($name,0);
|
||||
CUL_HM_complConfigTest($name);
|
||||
delete $modules{CUL_HM}{helper}{cfgCmpl}{$name};
|
||||
|
@ -373,7 +373,8 @@ sub HMinfo_peerCheck(@) { #####################################################
|
||||
my @peerIDsNoPeer;
|
||||
foreach my $eName (@entities){
|
||||
next if (!$defs{$eName}{helper}{role}{chn});#device has no channels
|
||||
next if (!CUL_HM_peerUsed($eName));
|
||||
my $peersUsed = CUL_HM_peerUsed($eName);
|
||||
next if ($peersUsed == 0);
|
||||
|
||||
my $id = $defs{$eName}{DEF};
|
||||
my $devId = substr($id,0,6);
|
||||
@ -382,9 +383,9 @@ sub HMinfo_peerCheck(@) { #####################################################
|
||||
my $peerIDs = AttrVal($eName,"peerIDs",undef);
|
||||
|
||||
if (!$peerIDs){ # no peers - is this correct?
|
||||
push @peerIDsEmpty,"empty: ".$eName;
|
||||
push @peerIDsEmpty,"empty: ".$eName if ($peersUsed != 3);
|
||||
}
|
||||
elsif($peerIDs !~ m/00000000/){#peerList incomplete
|
||||
elsif($peersUsed == 2){#peerList incomplete
|
||||
push @peerIDsFail,"incomplete: ".$eName.":".$peerIDs;
|
||||
}
|
||||
else{# work on a valid list:
|
||||
@ -425,7 +426,7 @@ sub HMinfo_burstCheck(@) { ####################################################
|
||||
my @peerIDsCond;
|
||||
foreach my $eName (@entities){
|
||||
next if (!$defs{$eName}{helper}{role}{chn} #entity has no channels
|
||||
|| !CUL_HM_peerUsed($eName) #entity not peered
|
||||
|| CUL_HM_peerUsed($eName) != 1 #entity not peered or list incomplete
|
||||
|| CUL_HM_Get($defs{$eName},$eName,"regList")#option not supported
|
||||
!~ m/peerNeedsBurst/);
|
||||
|
||||
@ -467,7 +468,7 @@ sub HMinfo_paramCheck(@) { ####################################################
|
||||
foreach my $eName (@entities){
|
||||
if ($defs{$eName}{helper}{role}{dev}){
|
||||
my $ehash = $defs{$eName};
|
||||
my $pairId = CUL_HM_Get($ehash,$eName,"param","R-pairCentral");
|
||||
my $pairId = ReadingsVal($eName,"R-pairCentral","undefined");
|
||||
my $IoDev = $ehash->{IODev} if ($ehash->{IODev});
|
||||
my $ioHmId = AttrVal($IoDev->{NAME},"hmId","-");
|
||||
my ($ioCCU,$prefIO) = split":",AttrVal($eName,"IOgrp","");
|
||||
@ -485,12 +486,14 @@ sub HMinfo_paramCheck(@) { ####################################################
|
||||
}
|
||||
}
|
||||
if (!$IoDev) { push @noIoDev,$eName;}
|
||||
if ($pairId eq "undefined") { push @noID,$eName;}
|
||||
elsif ($pairId !~ m /$ioHmId/
|
||||
&& $IoDev ) { push @idMismatch,"$eName paired:$pairId IO attr: $ioHmId";}
|
||||
|
||||
elsif (AttrVal($eName,"aesCommReq",0) && $IoDev->{TYPE} ne "HMLAN")
|
||||
{ push @aesInval,"$eName ";}
|
||||
|
||||
if (!$defs{$eName}{helper}{role}{vrt}){
|
||||
if ($pairId eq "undefined") { push @noID,$eName;}
|
||||
elsif ($pairId !~ m /$ioHmId/
|
||||
&& $IoDev ) { push @idMismatch,"$eName paired:$pairId IO attr: $ioHmId";}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -804,11 +807,11 @@ sub HMinfo_GetFn($@) {#########################################################
|
||||
$ret = $cmd." done:" .HMinfo_regCheck(@entities);
|
||||
}
|
||||
elsif($cmd eq "peerCheck") {##check peers-----------------------------------
|
||||
my @entities = HMinfo_getEntities($opt."v",$filter);
|
||||
my @entities = HMinfo_getEntities($opt,$filter);
|
||||
$ret = $cmd." done:" .HMinfo_peerCheck(@entities);
|
||||
}
|
||||
elsif($cmd eq "configCheck"){##check peers and register----------------------
|
||||
my @entities = HMinfo_getEntities($opt."v",$filter);
|
||||
my @entities = HMinfo_getEntities($opt,$filter);
|
||||
$ret = $cmd." done:" .HMinfo_regCheck(@entities)
|
||||
.HMinfo_peerCheck(@entities)
|
||||
.HMinfo_burstCheck(@entities)
|
||||
@ -836,8 +839,13 @@ sub HMinfo_GetFn($@) {#########################################################
|
||||
elsif($cmd eq "peerXref") {##print cross-references------------------------
|
||||
my @peerPairs;
|
||||
my @peerFhem;
|
||||
my @peerUndef;
|
||||
my @fheml = ();
|
||||
foreach my $dName (HMinfo_getEntities($opt,$filter)){
|
||||
# search for irregular trigger
|
||||
my @failTrig = map {"$dName: $_"} grep /^trigDst_/,keys %{$defs{$dName}{READINGS}};
|
||||
push @peerUndef,@failTrig if (@failTrig);
|
||||
#--- check regular references
|
||||
my $peerIDs = AttrVal($dName,"peerIDs",undef);
|
||||
next if(!$peerIDs);
|
||||
my $dId = unpack 'A6',CUL_HM_name2Id($dName);
|
||||
@ -861,6 +869,10 @@ sub HMinfo_GetFn($@) {#########################################################
|
||||
$ret = $cmd." done:" ."\n x-ref list"."\n ".(join "\n ",sort @peerPairs)
|
||||
."\n ".(join "\n ",sort @peerFhem)
|
||||
;
|
||||
$ret .= "\n warning: sensor triggers but no config found"
|
||||
."\n ".(join "\n ",sort @peerUndef)
|
||||
if(@peerUndef)
|
||||
;
|
||||
}
|
||||
elsif($cmd eq "templateList"){##template: list templates --------------------
|
||||
return HMinfo_templateList($a[0]);
|
||||
@ -1415,7 +1427,7 @@ sub HMinfo_archConfigExec($) {################################################
|
||||
my @archs;
|
||||
@eN = ();
|
||||
foreach(HMinfo_noDup(@names)){
|
||||
if (CUL_HM_peersValid($_) !=1 ||HMinfo_regCheck($_)){
|
||||
if (CUL_HM_peerUsed($_) !=1 ||HMinfo_regCheck($_)){
|
||||
push @eN,$_;
|
||||
}
|
||||
else{
|
||||
|
Loading…
Reference in New Issue
Block a user