2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 10:46:03 +00:00

CUL_HM: update alarm time calculation

git-svn-id: https://svn.fhem.de/fhem/trunk@12552 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2016-11-12 19:20:48 +00:00
parent 6c59336b8c
commit 23bcb8591c
3 changed files with 38 additions and 16 deletions

View File

@ -6587,13 +6587,6 @@ sub CUL_HM_SndCmd($$) {
)
){
# shall we delay commands if IO device is not present?
# it could cause trouble if light switches on after a long period
# repetition will be stopped after 1min forsecurity reason.
my @arr = ();
$hash->{cmdStack} = \@arr if(!$hash->{cmdStack});
unshift (@{$hash->{cmdStack}}, $cmd);#pushback cmd, wait for opportunity
# push device to list
if (!defined $modules{CUL_HM}{$ioName}{tmr}){
# some setup work for this timer
@ -6603,9 +6596,24 @@ sub CUL_HM_SndCmd($$) {
$modules{CUL_HM}{$ioName}{pendDev} = \@arr2;
}
}
# shall we delay commands if IO device is not present?
# it could cause trouble if light switches on after a long period
# repetition will be stopped after 1min forsecurity reason.
# so do: return cmd to queue and set state to pending again.
# device will be queued @ CUL_HM. Timer will perform cyclic check for IO to return.
#
my @arr = ();
$hash->{cmdStack} = \@arr if(!$hash->{cmdStack});
$cmd = $hash->{helper}{prt}{rspWait}{cmd} if( $hash->{helper}{prt}{rspWait}
&& $hash->{helper}{prt}{rspWait}{cmd});
unshift (@{$hash->{cmdStack}}, $cmd);#pushback cmd, wait for opportunity
@{$modules{CUL_HM}{$ioName}{pendDev}} =
CUL_HM_noDup(@{$modules{CUL_HM}{$ioName}{pendDev}},$hash->{NAME});
CUL_HM_respPendRm($hash);#rm timer - we are out
CUL_HM_protState($hash,"CMDs_pending");
if ($modules{CUL_HM}{$ioName}{tmr} != 1){# need to start timer
my $tn = gettimeofday();
InternalTimer($tn+$IOpoll, "CUL_HM_sndIfOpen", "sndIfOpen:$ioName", 0);
@ -7832,6 +7840,18 @@ sub CUL_HM_CvTflt($) { # config time -> float
my ($inValue) = @_;
return ($inValue & 0x1f)*((sort {$a <=> $b} keys(%fltCvT))[$inValue >> 5]);
}
sub CUL_HM_flt6CvT($) { # float -> config time
my ($inValue) = @_;
my $exp = ($inValue>127)?1:0;
return ($exp << 7)+int($inValue/($exp?60:1));
}
sub CUL_HM_CvTflt6($) { # config time -> float
my ($inValue) = @_;
$inValue = 129 if ($inValue == 128);
return ($inValue & 0x7f)*(($inValue >> 7)?60:1);
}
sub CUL_HM_min2time($) { # minutes -> time
my $min = shift;
$min = $min * 30;

View File

@ -1696,7 +1696,7 @@ sub HMInfo_help(){ ############################################################
."\n remove a template set"
."\n set templateExe -templateName-"
."\n write all assigned templates to the file"
."\n get templateUsg -templateName-"
."\n get templateUsg -templateName-[sortPeer|sortTemplate]"
."\n show template usage"
."\n get templateChk [-typeFilter-] -templateName- -peer:[long|short]- [-param1- ...] "
."\n compare whether register match the template values"
@ -2382,7 +2382,7 @@ sub HMinfo_templateUsg(@){#####################################################
next if(!defined $defs{$dName}{helper}{tmpl});
foreach my $tid(keys %{$defs{$dName}{helper}{tmpl}}){
my ($p,$t) = split(">",$tid);
if($tFilter){
if($tFilter && $tFilter =~ m/^sort.*/){
if($tFilter eq "sortTemplate"){
push @ul,sprintf("%-20s|%-15s|%s|%s",$t,$dName,$p,$defs{$dName}{helper}{tmpl}{$tid});
}
@ -2390,8 +2390,9 @@ sub HMinfo_templateUsg(@){#####################################################
my ($pn,$ls) = split(":",$p);
push @ul,sprintf("%-20s|%-15s|%5s:%-20s|%s",$pn,$t,$ls,$dName,$defs{$dName}{helper}{tmpl}{$tid});
}
elsif($tFilter ne $t){
next;}
# elsif($tFilter ne $t){
# next;
# }
}
else{
my @param;
@ -2404,8 +2405,9 @@ sub HMinfo_templateUsg(@){#####################################################
}
$para = join(" ",@param);
}
push @ul,sprintf("%-20s|%-15s|%s|%s",$dName,$p,$t,$para);}
push @ul,sprintf("%-20s|%-15s|%s|%s",$dName,$p,$t,$para) if(!$tFilter || $tFilter eq $t);
}
}
}
return join("\n",sort(@ul));
@ -2772,7 +2774,7 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
<li><a name="#HMinfotemplateList">templateList [&lt;name&gt;]</a><br>
list defined templates. If no name is given all templates will be listed<br>
</li>
<li><a name="#HMinfotemplateUsg">templateUsg</a> &lt;template&gt; <br>
<li><a name="#HMinfotemplateUsg">templateUsg</a> &lt;template&gt; [sortPeer|sortTemplate]<br>
templare usage<br>
template filters the output
</li>
@ -3220,7 +3222,7 @@ sub HMinfo_noDup(@) {#return list with no duplicates###########################
<li><a name="#HMinfotemplateList">templateList [&lt;name&gt;]</a><br>
zeigt eine Liste von Vorlagen. Ist kein Name angegeben, werden alle Vorlagen angezeigt<br>
</li>
<li><a name="#HMinfotemplateUsg">templateUsg</a> &lt;template&gt; <br>
<li><a name="#HMinfotemplateUsg">templateUsg</a> &lt;template&gt; [sortPeer|sortTemplate]<br>
Liste der genutzten templates.<br>
template filtert die Einträge nach diesem template
</li>

View File

@ -516,7 +516,7 @@ foreach my $al (keys %culHmModel){ # duplicate entries for alias devices
wakeupDefChan =>{a=> 32.0,s=>1.0,l=>0,min=>0 ,max=>20 ,c=>'' ,f=>'' ,u=>'' ,d=>0,t=>"wakeup default channel"},
wakeupBehavior =>{a=> 33.0,s=>0.1,l=>0,min=>0 ,max=>20 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"wakeup behavior" ,lit=>{off=>0,on=>1}},
wakeupBehavMsg =>{a=> 33.1,s=>0.1,l=>0,min=>0 ,max=>20 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"wakeup behavior status message" ,lit=>{off=>0,on=>1}},
alarmTimeMax =>{a=> 34.0,s=>1.0,l=>0,min=>1 ,max=>900 ,c=>'' ,f=>1.6 ,u=>'s' ,d=>0,t=>"maximum Alarm time" ,lit=>{unused=>0}},
alarmTimeMax =>{a=> 34.0,s=>1.0,l=>0,min=>1 ,max=>900 ,c=>'fltCvT60' ,f=>'' ,u=>'s' ,d=>0,t=>"maximum Alarm time" ,lit=>{unused=>0}},
baudrate =>{a=> 35.0,s=>1.0,l=>0,min=>0 ,max=>6 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"baudrate" ,lit=>{Bd300=>0,Bd600=>1,Bd1200=>2,Bd2400=>3,Bd4800=>4,Bd9600=>5,Bd19200=>6}},
serialFormat =>{a=> 36.0,s=>1.0,l=>0,min=>0 ,max=>3 ,c=>'lit' ,f=>'' ,u=>'' ,d=>0,t=>"serial Format" ,lit=>{s7D1PE1S=>0,s7D1PE2S=>1,s8D0PN1S=>2,s8D1PE1S=>3}},