mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
CUL_HM: enhance MDIR, improve template and include rename
git-svn-id: https://svn.fhem.de/fhem/trunk@11266 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
62aed27ba7
commit
6c5b9f9be2
@ -566,19 +566,28 @@ sub CUL_HM_Rename($$$) {#############################
|
||||
}
|
||||
if ($hash->{helper}{role}{chn}){
|
||||
my $HMidCh = substr($HMid."01",0,8);
|
||||
foreach my $pId (keys %{$modules{CUL_HM}{defptr}}){
|
||||
foreach my $pId (keys %{$modules{CUL_HM}{defptr}}){#all devices for peer
|
||||
my $pH = $modules{CUL_HM}{defptr}{$pId};
|
||||
my $pN = $pH->{NAME};
|
||||
my $pPeers = AttrVal($pN, "peerIDs", "");
|
||||
if ($pPeers =~ m/$HMidCh/){
|
||||
CUL_HM_ID2PeerList ($pN,"x",0);
|
||||
foreach my $pR (grep /-$oldName-/,keys%{$pH->{READINGS}}){
|
||||
foreach my $pR (grep /-$oldName-/,keys%{$pH->{READINGS}}){#update reading of the peer
|
||||
my $pRn = $pR;
|
||||
$pRn =~ s/$oldName/$name/;
|
||||
$pH->{READINGS}{$pRn}{VAL} = $pH->{READINGS}{$pR}{VAL};
|
||||
$pH->{READINGS}{$pRn}{VAL} = $pH->{READINGS}{$pR}{VAL};
|
||||
$pH->{READINGS}{$pRn}{TIME} = $pH->{READINGS}{$pR}{TIME};
|
||||
delete $pH->{READINGS}{$pR};
|
||||
}
|
||||
if (eval "defined(&HMinfo_templateMark)"){
|
||||
foreach my $pT (grep /$oldName:/,keys%{$pH->{helper}{tmpl}}){#update reading of the peer
|
||||
my $param = $pH->{helper}{tmpl}{$pT};
|
||||
my ($px,$tmpl) = split(">",$pT);
|
||||
HMinfo_templateDel($pN,$tmpl,$px);
|
||||
$px =~ s/$oldName/$name/;
|
||||
HMinfo_templateMark($pH,"$px>$tmpl",split(" ",$param));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2386,16 +2395,23 @@ sub CUL_HM_Parse($$) {#########################################################
|
||||
push @evtEt,[$mh{devH},1,"battery:". (($err&0x80)?"low" :"ok" )];
|
||||
}
|
||||
elsif($mh{mTp} eq "41") {#01 is channel
|
||||
my($chn,$cnt,$bright) = (hex($mI[0]),hex($mI[1]),hex($mI[2]));
|
||||
my $nextTr = (@mI >3)? (int((1<<((hex($mI[3])>>4)-1))/1.1)."s")
|
||||
: "-";
|
||||
my $chId = $mh{src}.sprintf("%02X",$chn&0x3f);
|
||||
my($chn,$cnt,$bright,$nextTr) = map{hex($_)} (@mI,0);
|
||||
if ($nextTr){
|
||||
$nextTr = (15 << ($nextTr >> 4) - 4); # strange mapping of literals
|
||||
RemoveInternalTimer($mh{devN}.":motionCheck");
|
||||
InternalTimer(gettimeofday()+$nextTr,"CUL_HM_motionCheck", $mh{devN}.":motionCheck", 0);
|
||||
}
|
||||
else{
|
||||
$nextTr = "none ";
|
||||
}
|
||||
|
||||
my $chId = $mh{src}.sprintf("%02X",$chn & 0x3f);
|
||||
$mh{shash} = $modules{CUL_HM}{defptr}{$chId}
|
||||
if($modules{CUL_HM}{defptr}{$chId});
|
||||
|
||||
push @evtEt,[$mh{shash},1,"state:motion"];
|
||||
push @evtEt,[$mh{shash},1,"motion:on$target"];
|
||||
push @evtEt,[$mh{shash},1,"motionCount:$cnt"."_next:$nextTr"];
|
||||
push @evtEt,[$mh{shash},1,"motionCount:$cnt"."_next:$nextTr"."s"];
|
||||
push @evtEt,[$mh{shash},1,"brightness:$bright"];
|
||||
}
|
||||
elsif($mh{mTp} eq "70" && $mh{p} =~ m/^7F(..)(.*)/) {
|
||||
@ -3678,6 +3694,16 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
|
||||
$tl = $ok?$tl:"";
|
||||
$usg =~ s/ tempTmplSet/ tempTmplSet$tl/;
|
||||
}
|
||||
if ( $usg =~ m/ templateDel/
|
||||
&& eval "defined(&HMinfo_templateDel)"
|
||||
&& keys %{$hash->{helper}{tmpl}}){
|
||||
my $tl = join(",",(sort keys %{$hash->{helper}{tmpl}}));
|
||||
# $tl =~ s/:/>/;
|
||||
$usg =~ s/ templateDel/ templateDel:$tl/;
|
||||
}
|
||||
else{
|
||||
$usg =~ s/ templateDel//;#not an option
|
||||
}
|
||||
return $usg;
|
||||
}
|
||||
elsif($h eq "" && @a != 2) {
|
||||
@ -3827,6 +3853,8 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
|
||||
foreach my $h(@cH){
|
||||
delete $h->{READINGS}{$_}
|
||||
foreach (grep /^(\.?)(R-|RegL)/,keys %{$h->{READINGS}});
|
||||
delete $h->{helper}{shadowReg}{$_}
|
||||
foreach (grep /^(\.?)(R-|RegL)/,keys %{$h->{helper}{shadowReg}});
|
||||
delete $modules{CUL_HM}{helper}{cfgCmpl}{$name};
|
||||
CUL_HM_complConfig($h->{NAME});
|
||||
}
|
||||
@ -4841,9 +4869,9 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
|
||||
$ret = "verifed with no faults" if (!$ret && $action eq "verify");
|
||||
return $ret;
|
||||
}
|
||||
elsif($cmd eq "tempTmplSet") { #############################################
|
||||
elsif($cmd eq "tempTmplSet") { ##############################################
|
||||
$state= "";
|
||||
return "tempate missing" if (!defined $a[2]);
|
||||
return "template missing" if (!defined $a[2]);
|
||||
CommandAttr(undef, "$name tempListTmpl $a[2]");
|
||||
|
||||
my ($fn,$template) = split(":",AttrVal($name,"tempListTmpl",$name));
|
||||
@ -4857,6 +4885,13 @@ sub CUL_HM_Set($@) {#+++++++++++++++++ set command+++++++++++++++++++++++++++++
|
||||
}
|
||||
CUL_HM_tempListTmpl($name,"restore",$template);
|
||||
}
|
||||
elsif($cmd eq "templateDel") { ##############################################
|
||||
$state= "";
|
||||
return "template missing" if (!defined $a[2]);
|
||||
my ($p,$t) = split(">",$a[2]);
|
||||
HMinfo_templateDel($name,$t,$p) if (eval "defined(&HMinfo_templateDel)");
|
||||
return;
|
||||
}
|
||||
elsif($cmd eq "sysTime") { ##################################################
|
||||
$state = "";
|
||||
my $s2000 = sprintf("%02X", CUL_HM_secSince2000());
|
||||
@ -8262,6 +8297,11 @@ sub CUL_HM_readValIfTO($){#
|
||||
my ($name,$rd,$val) = split(":",shift);# uncertain:$name:$reading:$value
|
||||
readingsSingleUpdate($defs{$name},$rd,$val,1);
|
||||
}
|
||||
sub CUL_HM_motionCheck($){#
|
||||
my ($name) = split(":",shift);# uncertain:$name:$reading:$value
|
||||
CUL_HM_UpdtReadBulk($defs{$name},1,"state:noMotion"
|
||||
,"motion:no");
|
||||
}
|
||||
|
||||
sub CUL_HM_getAttr($$$){#return attrValue - consider device if empty
|
||||
my ($name,$attrName,$default) = @_;
|
||||
@ -9207,6 +9247,9 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
|
||||
<li><B>tempTmplSet =>"[[ <file> :]templateName]</B><br>
|
||||
Set the attribut and apply the change to the device
|
||||
</li>
|
||||
<li><B>templateDel =>" <template> </B><br>
|
||||
Delete templateentry for this entity
|
||||
</li>
|
||||
<li><B>partyMode <HH:MM><durationDays></B><br>
|
||||
set control mode to party and device ending time. Add the time it ends
|
||||
and the <b>number of days</b> it shall last. If it shall end next day '1'
|
||||
@ -10570,6 +10613,10 @@ sub CUL_HM_tempListTmpl(@) { ##################################################
|
||||
<li><B>tempTmplSet =>"[[ <file> :]templateName]</B><br>
|
||||
Setzt das Attribut und sendet die Änderungen an das Device.
|
||||
</li>
|
||||
<li><B>templateDel =>" <template> </B><br>
|
||||
Löscht eine Templateeintrag an dieser entity.
|
||||
</li>
|
||||
|
||||
</ul><br>
|
||||
</li>
|
||||
<li>OutputUnit (HM-OU-LED16)
|
||||
|
@ -2281,11 +2281,16 @@ sub HMinfo_templateSet(@){#####################################################
|
||||
return $ret if ($ret);
|
||||
}
|
||||
my ($ret,undef) = CUL_HM_Set($aHash,$aName,"regSet","exec",split(",",$regCh[0]),$pName);
|
||||
HMinfo_templateMark($aHash,$tmplID,@p);
|
||||
return $ret;
|
||||
}
|
||||
sub HMinfo_templateMark(@){####################################################
|
||||
my ($aHash,$tmplID,@p) = @_;
|
||||
$aHash->{helper}{tmpl}{$tmplID} = join(" ",@p);
|
||||
$HMConfig::culHmTpl{tmplUsgChange} = 1; # mark change
|
||||
$aHash->{helper}{tmplChg} = 1;
|
||||
CUL_HM_setTmplDisp($aHash);#set readings if desired
|
||||
return $ret;
|
||||
return;
|
||||
}
|
||||
sub HMinfo_templateDel(@){#####################################################
|
||||
my ($aName,$tmpl,$pSet) = @_;
|
||||
@ -2349,6 +2354,9 @@ sub HMinfo_templateChk(@){#####################################################
|
||||
}
|
||||
else{
|
||||
my $pRnm = $pName ? $pName."-" : "";
|
||||
if ($pName){
|
||||
$pRnm = $pName.(($defs{$pName}{helper}{role}{dev})?"_chn-01-":"-");
|
||||
}
|
||||
my $pRnmLS = $pTyp eq "long"?"lg":($pTyp eq "short"?"sh":"");
|
||||
foreach my $rn (keys%{$HMConfig::culHmTpl{$tmpl}{reg}}){
|
||||
my $regV;
|
||||
|
@ -1520,6 +1520,7 @@ $culHmRegChan{"HM-OU-CFM-TW02"}= $culHmRegChan{"HM-OU-CFM-PL02"};
|
||||
,getConfig => ""
|
||||
,regSet => "[prep|exec] -regName- -value- ... [-peerChannel-]"
|
||||
,clear => "[readings|trigger|register|oldRegs|rssi|msgEvents|attack|all]"
|
||||
,templateDel => "tmplt"
|
||||
);
|
||||
%culHmGlobalSetsVrtDev = (# virtuals and devices without subtype
|
||||
virtual => "-noButtons-"
|
||||
@ -1531,6 +1532,7 @@ $culHmRegChan{"HM-OU-CFM-TW02"}= $culHmRegChan{"HM-OU-CFM-PL02"};
|
||||
,unpair => ""
|
||||
,assignHmKey => ""
|
||||
,deviceRename => "newName"
|
||||
,fwUpdate =>"-filename- -bootTime- ..."
|
||||
);
|
||||
|
||||
%culHmSubTypeDevSets = (# device of this subtype
|
||||
@ -1710,15 +1712,7 @@ $culHmModelSets{"HM-OU-CM-PCB"} = $culHmModelSets{"HM-SEC-SD"};
|
||||
,off =>""
|
||||
,toggle =>""
|
||||
}
|
||||
,"HM-Sen-RD-O00" =>{ fwUpdate =>"-filename- -bootTime- ..."}
|
||||
,"HM-Sen-LI-O00" =>{ fwUpdate =>"-filename- -bootTime- ..."}
|
||||
,"HM-Sen-MDIR-WM5500" =>{ fwUpdate =>"-filename- -bootTime- ..."}
|
||||
,"HM-MOD-Re-800" =>{ fwUpdate =>"-filename- -bootTime- ..."}
|
||||
,"HM-LC-Bl1PBU-FM00" =>{ fwUpdate =>"-filename- -bootTime- ..."}
|
||||
,"HM-LC-Dim1TPBU-FM00" =>{ fwUpdate =>"-filename- -bootTime- ..."}
|
||||
,"HM-CC-RT-DN00" =>{ sysTime =>""
|
||||
,fwUpdate =>"-filename- -bootTime- ..."
|
||||
}
|
||||
,"HM-CC-RT-DN00" =>{ sysTime =>"" }
|
||||
,"HM-CC-RT-DN04" =>{ controlMode =>"[auto|manual|boost|day|night]"
|
||||
,controlManu =>"[on|off|5.0..30.0]"
|
||||
,controlParty =>"-temp- -startDate- -startTime- -enddate- -endTime-"
|
||||
@ -1737,7 +1731,6 @@ $culHmModelSets{"HM-OU-CM-PCB"} = $culHmModelSets{"HM-SEC-SD"};
|
||||
,"HM-CC-RT-DN06" =>{ press =>"[long|short] [-peer-] [-repCount(long only)-] [-repDelay-] ..."}
|
||||
,"HM-TC-IT-WM-W-EU00" =>{ sysTime =>""
|
||||
,getSerial => ""
|
||||
,fwUpdate =>"-filename- -bootTime- ..."
|
||||
}
|
||||
,"HM-TC-IT-WM-W-EU01" =>{ peerChan =>"-btnNumber- -actChn- ... single [set|unset] [actor|remote|both]"}
|
||||
,"HM-TC-IT-WM-W-EU02" =>{ controlMode =>"[auto|manual|boost|day|night]"
|
||||
@ -1765,8 +1758,7 @@ $culHmModelSets{"HM-OU-CM-PCB"} = $culHmModelSets{"HM-SEC-SD"};
|
||||
,inhibit =>"[on|off]"
|
||||
,statusRequest =>""
|
||||
}
|
||||
,"HM-ES-PMSw1-Pl00" =>{ fwUpdate =>"-filename- -bootTime- ..."
|
||||
,getSerial => ""
|
||||
,"HM-ES-PMSw1-Pl00" =>{ getSerial => ""
|
||||
,getDevInfo => ""
|
||||
}
|
||||
,"HM-Dis-WM5501" =>{ displayWM =>"[long|short|help] -lineX- -textNo1- -color1- -icon1- [-textNo2- -color2- -icon2-] ...[-textNo6- -color6- -icon6-] "}
|
||||
|
Loading…
Reference in New Issue
Block a user