From 27d103ba9775b2d0aa9f3acb07260e9ae36cf303 Mon Sep 17 00:00:00 2001
From: martinp876 <>
Date: Sun, 21 Feb 2016 15:49:03 +0000
Subject: [PATCH] HMInfo: default parameter setting for HMdefices
git-svn-id: https://svn.fhem.de/fhem/trunk@10904 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/10_CUL_HM.pm | 13 ++++++---
fhem/FHEM/98_HMinfo.pm | 60 +++++++++++++++++++++++++++++++++++++++---
fhem/FHEM/HMConfig.pm | 8 ++----
3 files changed, 68 insertions(+), 13 deletions(-)
diff --git a/fhem/FHEM/10_CUL_HM.pm b/fhem/FHEM/10_CUL_HM.pm
index 6ca44e7c3..916a741cf 100755
--- a/fhem/FHEM/10_CUL_HM.pm
+++ b/fhem/FHEM/10_CUL_HM.pm
@@ -144,7 +144,6 @@ sub CUL_HM_Initialize($) {
$hash->{Attr}{dev} = "ignore:1,0 dummy:1,0 " # -- device only attributes
."IODev IOList IOgrp "
- ."hmProtocolEvents:0_off,1_dump,2_dumpFull,3_dumpTrigger "
."rssiLog:1,0 " # enable writing RSSI to Readings (device only)
."actCycle " # also for action detector
."hmKey hmKey2 hmKey3 "
@@ -8172,7 +8171,8 @@ sub CUL_HM_getAttr($$$){#return attrValue - consider device if empty
my $devN = $defs{$name}{device}?$defs{$name}{device}:$name;
$val = (defined $attr{$devN}{$attrName})
? $attr{$devN}{$attrName}
- : $default;
+ : ($modules{CUL_HM}{AttrListDef} && $modules{CUL_HM}{AttrListDef}{$attrName})?$modules{CUL_HM}{AttrListDef}{$attrName}
+ :$default;
}
}
return $val;
@@ -8180,9 +8180,16 @@ sub CUL_HM_getAttr($$$){#return attrValue - consider device if empty
sub CUL_HM_getAttrInt($@){#return attrValue as integer
my ($name,$attrName,$default) = @_;
$default = 0 if (!defined $default);
+
+ if($modules{CUL_HM}{AttrListDef} && $modules{CUL_HM}{AttrListDef}{$attrName}){
+ }
+
if($name && $defs{$name}){
my $devN = $defs{$name}{device}?$defs{$name}{device}:$name;
- my $val = "0".AttrVal($name,$attrName,AttrVal($devN,$attrName,$default));
+ my $val = "0".AttrVal($name,$attrName
+ ,AttrVal($devN,$attrName
+ ,($modules{CUL_HM}{AttrListDef} && $modules{CUL_HM}{AttrListDef}{$attrName})?$modules{CUL_HM}{AttrListDef}{$attrName}
+ :$default));
$val =~s/(\d*).*/$1/;
return int($val);
}
diff --git a/fhem/FHEM/98_HMinfo.pm b/fhem/FHEM/98_HMinfo.pm
index 88917c4a2..fe46d6223 100644
--- a/fhem/FHEM/98_HMinfo.pm
+++ b/fhem/FHEM/98_HMinfo.pm
@@ -32,6 +32,7 @@ sub HMinfo_Initialize($$) {####################################################
."hmAutoReadScan hmIoMaxDly "
."hmManualOper:0_auto,1_manual "
."configDir configFilename configTempFile "
+ ."hmDefaults "
.$readingFnAttributes;
}
@@ -146,6 +147,34 @@ sub HMinfo_Attr(@) {###########################################################
}
HMinfo_listOfTempTemplates();
}
+ elsif($attrName eq "hmDefaults"){
+ if ($cmd eq "set"){
+ delete $modules{CUL_HM}{AttrListDef};
+ my @defpara = ( "hmProtocolEvents"
+ ,"rssiLog"
+ ,"autoReadReg"
+ ,"msgRepeat"
+ ,"expert"
+ ,"actAutoTry"
+ );
+ my %culAH;
+ foreach (split" ",$modules{CUL_HM}{AttrList}){
+ my ($p,$v) = split(":",$_);
+ $culAH{$p} = ",$v,";
+ }
+
+ foreach (split(",",$attrVal)){
+ my ($para,$val) = split(":",$_,2);
+ return "no value defined for $para" if (!defined "val");
+ return "param $para not allowed" if (!grep /$para/,@defpara);
+ return "param $para :$val not allowed, use $culAH{$para}" if ($culAH{$para} !~ m/,$val,/);
+ $modules{CUL_HM}{AttrListDef}{$para} = $val;
+ }
+ }
+ else{
+ delete $modules{CUL_HM}{AttrListDef};
+ }
+ }
return;
}
@@ -392,6 +421,7 @@ sub HMinfo_peerCheck(@) { #####################################################
my @peerIDsNoPeer;
my @peerIDsTrigUnp;
my @peerIDsTrigUnd;
+ my @peerIDsTeamRT;
my @peeringStrange; # devices likely should not be peered
my @peerIDsAES;
foreach my $eName (@entities){
@@ -463,7 +493,12 @@ sub HMinfo_peerCheck(@) { #####################################################
elsif($chn eq "04"){
# compare templist template are identical and boost is same
my $rtCn = CUL_HM_id2Name(substr($pId,0,6)."04");
- Log 1,"General $eName peered with $rtCn rt/rt";
+ my $ob = CUL_HM_Get($defs{$eName},$eName,"regVal","boostPeriod");
+ my $pb = CUL_HM_Get($defs{$rtCn} ,$rtCn ,"regVal","boostPeriod");
+ my $ot = AttrVal($eName,"tempListTmpl","--");
+ my $pt = AttrVal($rtCn ,"tempListTmpl","--");
+ push @peerIDsTeamRT,$eName." team:$rtCn boost differ $ob / $pb" if ($ob ne $pb);
+ push @peerIDsTeamRT,$eName." team:$rtCn tempListTmpl differ $ot / $pt" if ($ot ne $pt);
}
}
elsif($chn eq "02"){
@@ -480,7 +515,12 @@ sub HMinfo_peerCheck(@) { #####################################################
else{
# compare templist template are identical and boost is same
my $rtCn = CUL_HM_id2Name(substr($pId,0,6)."04");
- Log 1,"General $eName peered with $rtCn tc/rt";
+ my $ob = CUL_HM_Get($defs{$eName},$eName,"regVal","boostPeriod");
+ my $pb = CUL_HM_Get($defs{$rtCn} ,$rtCn ,"regVal","boostPeriod");
+ my $ot = AttrVal($eName,"tempListTmpl","--");
+ my $pt = AttrVal($rtCn ,"tempListTmpl","--");
+ push @peerIDsTeamRT,$eName." team:$rtCn boost differ $ob / $pb" if ($ob ne $pb);
+ push @peerIDsTeamRT,$eName." team:$rtCn tempListTmpl differ $ot / $pt" if ($ot ne $pt);
}
}
}
@@ -495,6 +535,7 @@ sub HMinfo_peerCheck(@) { #####################################################
$ret .="\n\n trigger sent to unpeered device" ."\n ".(join "\n ",sort @peerIDsTrigUnp)if(@peerIDsTrigUnp);
$ret .="\n\n trigger sent to undefined device" ."\n ".(join "\n ",sort @peerIDsTrigUnd)if(@peerIDsTrigUnd);
$ret .="\n\n aesComReq set but virtual peer is not vccu - won't work"."\n ".(join "\n ",sort @peerIDsAES )if(@peerIDsAES);
+ $ret .="\n\n boost or template differ in team" ."\n ".(join "\n ",sort @peerIDsTeamRT )if(@peerIDsTeamRT);
return $ret;
}
@@ -2919,14 +2960,20 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
loadConfig
verifyConfig
-