mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-07 22:29:19 +00:00
insert stop for blind actor to stop protect relais
git-svn-id: https://svn.fhem.de/fhem/trunk@3377 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8865516fb2
commit
40cf4131a6
@ -162,14 +162,15 @@ sub CUL_HM_reqStatus($){
|
|||||||
sub CUL_HM_autoReadConfig($){
|
sub CUL_HM_autoReadConfig($){
|
||||||
# will trigger a getConfig and statusrequest for each device assigned.
|
# will trigger a getConfig and statusrequest for each device assigned.
|
||||||
#
|
#
|
||||||
while(@{$modules{CUL_HM}{helper}{updtCfgLst}}){
|
while(@{$modules{CUL_HM}{helper}{autoRdCfgLst}}){
|
||||||
my $name = shift(@{$modules{CUL_HM}{helper}{updtCfgLst}});
|
my $name = shift(@{$modules{CUL_HM}{helper}{autoRdCfgLst}});
|
||||||
my $hash = $defs{$name};
|
my $hash = $defs{$name};
|
||||||
|
delete $hash->{autoRead};
|
||||||
if (0 != CUL_HM_getAttrInt($name,"autoReadReg")){
|
if (0 != CUL_HM_getAttrInt($name,"autoReadReg")){
|
||||||
CUL_HM_Set($hash,$name,"getSerial");
|
CUL_HM_Set($hash,$name,"getSerial");
|
||||||
CUL_HM_Set($hash,$name,"getConfig");
|
CUL_HM_Set($hash,$name,"getConfig");
|
||||||
CUL_HM_Set($hash,$name,"statusRequest");
|
CUL_HM_Set($hash,$name,"statusRequest");
|
||||||
InternalTimer(gettimeofday()+15,"CUL_HM_autoReadConfig","updateConfig",0);
|
InternalTimer(gettimeofday()+15,"CUL_HM_autoReadConfig","autoRdCfg",0);
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,13 +180,12 @@ sub CUL_HM_updateConfig($){
|
|||||||
# this gives FHEM sufficient time to fill in attributes
|
# this gives FHEM sufficient time to fill in attributes
|
||||||
# it will also be called after each manual definition
|
# it will also be called after each manual definition
|
||||||
# Purpose is to parse attributes and read config
|
# Purpose is to parse attributes and read config
|
||||||
my @getConfList;
|
Log 1,"General starting Update";
|
||||||
my @nameList = CUL_HM_noDup(@{$modules{CUL_HM}{helper}{updtCfgLst}});
|
foreach my $name (@{$modules{CUL_HM}{helper}{updtCfgLst}}){
|
||||||
while(@nameList){
|
|
||||||
my $name = shift(@nameList);
|
|
||||||
my $hash = $defs{$name};
|
my $hash = $defs{$name};
|
||||||
my $id = $hash->{DEF};
|
my $id = $hash->{DEF};
|
||||||
my $chn = substr($id."00",6,2);
|
my $chn = substr($id."00",6,2);
|
||||||
|
Log 1,"General starting Update $name";
|
||||||
|
|
||||||
if ($id ne $K_actDetID){# if not action detector
|
if ($id ne $K_actDetID){# if not action detector
|
||||||
CUL_HM_ID2PeerList($name,"",1); # update peerList out of peerIDs
|
CUL_HM_ID2PeerList($name,"",1); # update peerList out of peerIDs
|
||||||
@ -282,10 +282,9 @@ sub CUL_HM_updateConfig($){
|
|||||||
no warnings 'numeric';
|
no warnings 'numeric';
|
||||||
my $autoRead = int(AttrVal($name,"autoReadReg",0))+0;
|
my $autoRead = int(AttrVal($name,"autoReadReg",0))+0;
|
||||||
use warnings 'numeric';
|
use warnings 'numeric';
|
||||||
push @getConfList,$name if (0 != $autoRead);
|
CUL_HM_queueAutoRead($name) if (0 != $autoRead);
|
||||||
}
|
}
|
||||||
$modules{CUL_HM}{helper}{updtCfgLst} = \@getConfList;
|
delete $modules{CUL_HM}{helper}{updtCfgLst};
|
||||||
CUL_HM_autoReadConfig("updateConfig");
|
|
||||||
}
|
}
|
||||||
sub CUL_HM_Define($$) {##############################
|
sub CUL_HM_Define($$) {##############################
|
||||||
my ($hash, $def) = @_;
|
my ($hash, $def) = @_;
|
||||||
@ -321,14 +320,8 @@ sub CUL_HM_Define($$) {##############################
|
|||||||
CUL_HM_ActGetCreateHash() if($HMid eq '000000');#startTimer
|
CUL_HM_ActGetCreateHash() if($HMid eq '000000');#startTimer
|
||||||
$hash->{DEF} = $HMid;
|
$hash->{DEF} = $HMid;
|
||||||
CUL_HM_Parse($hash, $a[3]) if(int(@a) == 4);
|
CUL_HM_Parse($hash, $a[3]) if(int(@a) == 4);
|
||||||
RemoveInternalTimer("updateConfig");
|
|
||||||
InternalTimer(gettimeofday()+5,"CUL_HM_updateConfig", "updateConfig", 0);
|
|
||||||
|
|
||||||
my @arr;
|
CUL_HM_queueUpdtCfg($name);
|
||||||
if(!$modules{CUL_HM}{helper}{updtCfgLst}){
|
|
||||||
$modules{CUL_HM}{helper}{updtCfgLst} = \@arr;
|
|
||||||
}
|
|
||||||
push(@{$modules{CUL_HM}{helper}{updtCfgLst}}, $name);
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
sub CUL_HM_Undef($$) {###############################
|
sub CUL_HM_Undef($$) {###############################
|
||||||
@ -427,15 +420,7 @@ sub CUL_HM_Attr(@) {#################################
|
|||||||
$updtReq = 1;
|
$updtReq = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($updtReq){
|
CUL_HM_queueUpdtCfg($name) if ($updtReq);
|
||||||
my @arr;
|
|
||||||
if(!$modules{CUL_HM}{helper}{updtCfgLst}){
|
|
||||||
$modules{CUL_HM}{helper}{updtCfgLst} = \@arr;
|
|
||||||
}
|
|
||||||
push(@{$modules{CUL_HM}{helper}{updtCfgLst}}, $name);
|
|
||||||
RemoveInternalTimer("updateConfig");
|
|
||||||
InternalTimer(gettimeofday()+5,"CUL_HM_updateConfig", "updateConfig", 0);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,7 +496,7 @@ sub CUL_HM_Parse($$) {##############################
|
|||||||
return $name; #return something to please dispatcher
|
return $name; #return something to please dispatcher
|
||||||
}
|
}
|
||||||
$shash->{lastMsg} = $msgX;
|
$shash->{lastMsg} = $msgX;
|
||||||
$iohash->{HM_CMDNR} = hex($mNo) if($dst eq $id);# updt message cnt to rec
|
# $iohash->{HM_CMDNR} = hex($mNo) if($dst eq $id);# updt message cnt to rec
|
||||||
delete $shash->{helper}{rpt};# new message, rm recent ack
|
delete $shash->{helper}{rpt};# new message, rm recent ack
|
||||||
my @ack; # ack and responses, might be repeated
|
my @ack; # ack and responses, might be repeated
|
||||||
|
|
||||||
@ -1582,13 +1567,32 @@ sub CUL_HM_parseCommon(@){#####################################################
|
|||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
sub CUL_HM_queueUpdtCfg($){
|
||||||
|
my $name = shift;
|
||||||
|
my @arr;
|
||||||
|
if ($modules{CUL_HM}{helper}{updtCfgLst}){
|
||||||
|
@arr = CUL_HM_noDup((@{$modules{CUL_HM}{helper}{updtCfgLst}}, $name));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
push @arr,$name;
|
||||||
|
}
|
||||||
|
$modules{CUL_HM}{helper}{updtCfgLst} = \@arr;
|
||||||
|
RemoveInternalTimer("updateConfig");
|
||||||
|
InternalTimer(gettimeofday()+5,"CUL_HM_updateConfig", "updateConfig", 0);
|
||||||
|
}
|
||||||
sub CUL_HM_queueAutoRead($){
|
sub CUL_HM_queueAutoRead($){
|
||||||
my $name = shift;
|
my $name = shift;
|
||||||
my @arr;
|
my @arr;
|
||||||
@arr = CUL_HM_noDup((@{$modules{CUL_HM}{helper}{updtCfgLst}}, $name));
|
if ($modules{CUL_HM}{helper}{autoRdCfgLst}){
|
||||||
$modules{CUL_HM}{helper}{updtCfgLst} =\@arr;
|
@arr = CUL_HM_noDup((@{$modules{CUL_HM}{helper}{autoRdCfgLst}}, $name));
|
||||||
RemoveInternalTimer("updateConfig");
|
}
|
||||||
InternalTimer(gettimeofday()+5,"CUL_HM_autoReadConfig", "updateConfig", 0);
|
else{
|
||||||
|
my @arr = ($name);
|
||||||
|
}
|
||||||
|
$modules{CUL_HM}{helper}{autoRdCfgLst} =\@arr;
|
||||||
|
$defs{$name}{autoRead} = "scheduled";
|
||||||
|
RemoveInternalTimer("autoRdCfg");
|
||||||
|
InternalTimer(gettimeofday()+5,"CUL_HM_autoReadConfig", "autoRdCfg", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#+++++++++++++++++ get command+++++++++++++++++++++++++++++++++++++++++++++++++
|
#+++++++++++++++++ get command+++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@ -2128,12 +2132,13 @@ sub CUL_HM_Set($@) {
|
|||||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'81'.$chn.
|
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'81'.$chn.
|
||||||
sprintf("%02X%02s%02X",$lvl*2,$rLocDly,$speed*2));
|
sprintf("%02X%02s%02X",$lvl*2,$rLocDly,$speed*2));
|
||||||
}
|
}
|
||||||
elsif($cmd eq "on") { #######################################################
|
elsif($cmd =~ m/^(on|off|toggle)/) { ########################################
|
||||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'02'.$chn.'C80000');
|
my $lvl = ($cmd eq 'on') ? 'C8':
|
||||||
$hash = $chnHash; # report to channel if defined
|
(($cmd eq 'off') ? '00':(CUL_HM_getChnLvl($name) != 0 ?"00":"C8"));
|
||||||
|
if($st eq "blindActuator") { # need to stop blind to protect relais
|
||||||
|
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'03'.$chn)
|
||||||
}
|
}
|
||||||
elsif($cmd eq "off") { ######################################################
|
CUL_HM_PushCmdStack($hash,"++$flag"."11$id$dst"."02$chn$lvl".'0000');
|
||||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'02'.$chn.'000000');
|
|
||||||
$hash = $chnHash; # report to channel if defined
|
$hash = $chnHash; # report to channel if defined
|
||||||
}
|
}
|
||||||
elsif($cmd =~ m/^(on-for-timer|on-till)$/) { ################################
|
elsif($cmd =~ m/^(on-for-timer|on-till)$/) { ################################
|
||||||
@ -2147,15 +2152,11 @@ sub CUL_HM_Set($@) {
|
|||||||
$eSec += 3600*24 if ($ltSec > $eSec); # go for the next day
|
$eSec += 3600*24 if ($ltSec > $eSec); # go for the next day
|
||||||
$duration = $eSec - $ltSec;
|
$duration = $eSec - $ltSec;
|
||||||
}
|
}
|
||||||
return "please enter the duration in seconds" if (!defined $duration || $duration !~ m/^[+-]?\d+(\.\d+)?$/);
|
return "please enter the duration in seconds"
|
||||||
|
if (!defined $duration || $duration !~ m/^[+-]?\d+(\.\d+)?$/);
|
||||||
my $tval = CUL_HM_encodeTime16($duration);# onTime 0.0..85825945.6, 0=forever
|
my $tval = CUL_HM_encodeTime16($duration);# onTime 0.0..85825945.6, 0=forever
|
||||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'02'.$chn.'C80000'.$tval);
|
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'02'.$chn.'C80000'.$tval);
|
||||||
$hash = $chnHash; # report to channel if defined
|
$hash = $chnHash; # report to channel if defined
|
||||||
}
|
|
||||||
elsif($cmd eq "toggle") { ###################################################
|
|
||||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'02'.$chn.
|
|
||||||
(CUL_HM_getChnLvl($name) != 0 ?"000000":"C80000"));
|
|
||||||
$hash = $chnHash; # report to channel if defined
|
|
||||||
}
|
}
|
||||||
elsif($cmd eq "lock") { #####################################################
|
elsif($cmd eq "lock") { #####################################################
|
||||||
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'800100FF'); # LEVEL_SET
|
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'800100FF'); # LEVEL_SET
|
||||||
@ -2187,6 +2188,9 @@ sub CUL_HM_Set($@) {
|
|||||||
$tval = $a[3]?CUL_HM_encodeTime16($a[3]):"FFFF";# onTime 0.05..85825945.6, 0=forever
|
$tval = $a[3]?CUL_HM_encodeTime16($a[3]):"FFFF";# onTime 0.05..85825945.6, 0=forever
|
||||||
$rval = CUL_HM_encodeTime16((@a > 4)?$a[4]:2.5);# rampTime 0.0..85825945.6, 0=immediate
|
$rval = CUL_HM_encodeTime16((@a > 4)?$a[4]:2.5);# rampTime 0.0..85825945.6, 0=immediate
|
||||||
}
|
}
|
||||||
|
elsif($st eq "blindActuator") { # need to stop blind to protect relais
|
||||||
|
CUL_HM_PushCmdStack($hash,'++'.$flag.'11'.$id.$dst.'03'.$chn)
|
||||||
|
}
|
||||||
CUL_HM_PushCmdStack($hash,sprintf("++%s11%s%s02%s%02X%s%s",
|
CUL_HM_PushCmdStack($hash,sprintf("++%s11%s%s02%s%02X%s%s",
|
||||||
$flag,$id,$dst,$chn,$lvl*2,$rval,$tval));
|
$flag,$id,$dst,$chn,$lvl*2,$rval,$tval));
|
||||||
readingsSingleUpdate($hash,"level","set_".$lvl,1);
|
readingsSingleUpdate($hash,"level","set_".$lvl,1);
|
||||||
|
@ -456,7 +456,6 @@ sub HMinfo_SetFn($$) {#########################################################
|
|||||||
|
|
||||||
return HMinfo_SetFnDly(join(",",($childName,$name,$cmd,$opt,$optEmpty,$filter,@a)));
|
return HMinfo_SetFnDly(join(",",($childName,$name,$cmd,$opt,$optEmpty,$filter,@a)));
|
||||||
}
|
}
|
||||||
Log 1,"General duration:".(time() - $start);
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,6 +600,13 @@ sub HMinfo_status($){##########################################################
|
|||||||
@protNames = sort keys %all;
|
@protNames = sort keys %all;
|
||||||
$hash->{ERR__protoNames} = join",",@protNames if(@protNames);
|
$hash->{ERR__protoNames} = join",",@protNames if(@protNames);
|
||||||
|
|
||||||
|
if ($modules{CUL_HM}{helper}{autoRdCfgLst}){
|
||||||
|
$hash->{autoReadPend} = join ",",@{$modules{CUL_HM}{helper}{autoRdCfgLst}};
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
delete $hash->{autoReadPend};
|
||||||
|
}
|
||||||
|
|
||||||
# ------- what about rssi low readings ------
|
# ------- what about rssi low readings ------
|
||||||
foreach (grep {$rssiMin{$_} != 0}keys %rssiMin){
|
foreach (grep {$rssiMin{$_} != 0}keys %rssiMin){
|
||||||
if ($rssiMin{$_}> -60) {$rssiMinCnt{"59<"}++;}
|
if ($rssiMin{$_}> -60) {$rssiMinCnt{"59<"}++;}
|
||||||
@ -778,6 +784,8 @@ sub HMinfo_status($){##########################################################
|
|||||||
<br>
|
<br>
|
||||||
<a name="HMinfovariables"><b>Variables</b></a>
|
<a name="HMinfovariables"><b>Variables</b></a>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><b>autoReadPend:</b> list of entities which are queued to retrieve config and status.
|
||||||
|
This is typically scheduled thru autoReadReg</li>
|
||||||
<li><b>ERR___rssiCrit:</b> list of device names with RSSI reading n min level </li>
|
<li><b>ERR___rssiCrit:</b> list of device names with RSSI reading n min level </li>
|
||||||
<li><b>rssiMinLevel:</b> counts of rssi min readings per device, clustered in blocks</li>
|
<li><b>rssiMinLevel:</b> counts of rssi min readings per device, clustered in blocks</li>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user