mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
95_Alarm.pm: Neue Version 4.02, Bugfix doppelte Ausführung beim Arm
git-svn-id: https://svn.fhem.de/fhem/trunk@15998 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e44757e48a
commit
fcd301d3e7
@ -43,7 +43,7 @@ my $alarmlinkname = "Alarms"; # link text
|
|||||||
my $alarmhiddenroom = "AlarmRoom"; # hidden room
|
my $alarmhiddenroom = "AlarmRoom"; # hidden room
|
||||||
my $alarmpublicroom = "Alarm"; # public room
|
my $alarmpublicroom = "Alarm"; # public room
|
||||||
my $alarmno = 8;
|
my $alarmno = 8;
|
||||||
my $alarmversion = "4.01";
|
my $alarmversion = "4.02";
|
||||||
|
|
||||||
my %alarm_transtable_EN = (
|
my %alarm_transtable_EN = (
|
||||||
"ok" => "OK",
|
"ok" => "OK",
|
||||||
@ -748,10 +748,10 @@ sub Alarm_Arm($$$$$){
|
|||||||
if( ($act eq "arm") && ( $xac ne "armed") ){
|
if( ($act eq "arm") && ( $xac ne "armed") ){
|
||||||
my $xdl = AttrVal($name, "armdelay", 0);
|
my $xdl = AttrVal($name, "armdelay", 0);
|
||||||
my $cmdwait = AttrVal($name, "armwait", 0);
|
my $cmdwait = AttrVal($name, "armwait", 0);
|
||||||
my $cmdact = AttrVal($name, "armact", 0);
|
|
||||||
|
|
||||||
#-- immediate arming
|
#-- immediate arming
|
||||||
if( ($xdl eq '')||($xdl eq '0:00')||($xdl eq '00:00')||($evt eq "delay") ){
|
if( ($xdl eq '')||($xdl eq '0:00')||($xdl eq '00:00')||($evt eq "delay") ){
|
||||||
|
my $cmdact = AttrVal($name, "armact", 0);
|
||||||
#-- update state display
|
#-- update state display
|
||||||
$hash->{DATA}{"armstate"}{"level".$level} = "armed";
|
$hash->{DATA}{"armstate"}{"level".$level} = "armed";
|
||||||
readingsSingleUpdate( $hash, "level".$level,"armed",1 );
|
readingsSingleUpdate( $hash, "level".$level,"armed",1 );
|
||||||
@ -778,20 +778,9 @@ sub Alarm_Arm($$$$$){
|
|||||||
readingsSingleUpdate( $hash, "state", Alarm_getstate($hash)." ".$hash->{READINGS}{"short"}{VAL}, 1 );
|
readingsSingleUpdate( $hash, "state", Alarm_getstate($hash)." ".$hash->{READINGS}{"short"}{VAL}, 1 );
|
||||||
#-- save new state
|
#-- save new state
|
||||||
Alarm_save($hash);
|
Alarm_save($hash);
|
||||||
#--transform commands from fhem to perl level
|
|
||||||
my @cmdactarr = split(/;/,$cmdact);
|
|
||||||
my $cmdactf;
|
|
||||||
if( int(@cmdactarr) == 1 ){
|
|
||||||
$cmdactf = "fhem(\"".$cmdact."\");;";
|
|
||||||
}else{
|
|
||||||
$cmdactf = '';
|
|
||||||
for(my $i=0;$i<int(@cmdactarr);$i++){
|
|
||||||
$cmdactf.="fhem(\"".$cmdactarr[$i]."\");;";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#-- compose commands TODO
|
#-- compose commands TODO
|
||||||
$cmd = sprintf("defmod alarm%1d.arm.dly at +00:%02d:%02d {Alarm_Arm(\"%s\",%1d,\"%s\",\"delay\",\"arm\");;%s}",
|
$cmd = sprintf("defmod alarm%1d.arm.dly at +00:%02d:%02d {Alarm_Arm(\"%s\",%1d,\"%s\",\"delay\",\"arm\")}",
|
||||||
$level,$1,$2,$name,$level,$dev,$cmdactf);
|
$level,$1,$2,$name,$level,$dev);
|
||||||
$msg = "[Alarm $level] will be armed from alarmSensor $dev with event $evt, delay $xdl";
|
$msg = "[Alarm $level] will be armed from alarmSensor $dev with event $evt, delay $xdl";
|
||||||
#-- define new delayed arm
|
#-- define new delayed arm
|
||||||
fhem($cmd);
|
fhem($cmd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user