From f5ec87487d6ea3531b43b7b678aa398ea4cc8f22 Mon Sep 17 00:00:00 2001
From: pahenning
Date: Sat, 30 Jan 2016 11:36:17 +0000
Subject: [PATCH] Alarm.pm: repaired Id Tag
git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@10664 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/95_Alarm.pm | 82 +++++++++++++++++++++++++------------------
1 file changed, 48 insertions(+), 34 deletions(-)
diff --git a/fhem/FHEM/95_Alarm.pm b/fhem/FHEM/95_Alarm.pm
index 19875c625..3ef9c0431 100644
--- a/fhem/FHEM/95_Alarm.pm
+++ b/fhem/FHEM/95_Alarm.pm
@@ -6,7 +6,7 @@
#
# Prof. Dr. Peter A. Henning
#
-# $Id: 95_Alarm.pm 2014-08 - pahenning $
+# $Id$
#
########################################################################################
#
@@ -40,7 +40,7 @@ my $alarmname = "Alarms"; # link text
my $alarmhiddenroom = "AlarmRoom"; # hidden room
my $alarmpublicroom = "Alarm"; # public room
my $alarmno = 8;
-my $alarmversion = "2.5";
+my $alarmversion = "2.6";
#########################################################################################
#
@@ -83,7 +83,10 @@ sub Alarm_Define ($$) {
my $now = time();
my $name = $hash->{NAME};
$hash->{VERSION} = $alarmversion;
- readingsSingleUpdate( $hash, "state", "Initialized", 0 );
+ readingsSingleUpdate( $hash, "state", "Initialized", 1 );
+
+ $alarmhiddenroom = defined($attr{$name}{"hiddenroom"}) ? $attr{$name}{"hiddenroom"} : $alarmhiddenroom;
+ $alarmpublicroom = defined($attr{$name}{"publicroom"}) ? $attr{$name}{"publicroom"} : $alarmpublicroom;
RemoveInternalTimer($hash);
InternalTimer ($now + 5, 'Alarm_CreateEntry', $hash, 0);
@@ -152,7 +155,7 @@ sub Alarm_CreateEntry($) {
}
}
my $mga = Alarm_getstate($hash)." Keine Störung";
- readingsSingleUpdate( $hash, "state", $mga, 0 );
+ readingsSingleUpdate( $hash, "state", $mga, 1 );
}
#########################################################################################
@@ -289,7 +292,7 @@ sub Alarm_Exec($$$$$){
return
if ($dev eq 'global');
- #-- raising the alarmy
+ #-- raising the alarm
if( $act eq "on" ){
#-- only if this level is armed and not yet active
if( ($xec eq "armed") && ($xac eq "off") ){
@@ -336,7 +339,7 @@ sub Alarm_Exec($$$$$){
readingsSingleUpdate( $hash, "level".$level,$dev,0 );
readingsSingleUpdate( $hash, "short", $mga, 0);
$mga = Alarm_getstate($hash)." ".$mga;
- readingsSingleUpdate( $hash, "state", $mga, 0 );
+ readingsSingleUpdate( $hash, "state", $mga, 1 );
$msg = "[Alarm $level] raised from device $dev with event $evt";
#-- calling actors AFTER state update
$cmd = AttrVal($name, "level".$level."onact", 0);
@@ -377,7 +380,7 @@ sub Alarm_Exec($$$$$){
$mga = " Level $level canceled";
readingsSingleUpdate( $hash, "short", "", 0);
$mga = Alarm_getstate($hash)." ".$mga;
- readingsSingleUpdate( $hash, "state", $mga, 0 );
+ readingsSingleUpdate( $hash, "state", $mga, 1 );
$msg = "[Alarm $level] canceled from device $dev";
Log3 $hash,3,$msg;
}
@@ -597,7 +600,7 @@ sub Alarm_CreateNotifiers($){
}
if( index($aval[0],"alarm".$level) != -1 ){
#-- activate without delay
- if( $aval[3] eq "0" ){
+ if(( $aval[3] eq "0" )||($aval[3] eq "00:00")){
$cmd .= $aval[1].';';
#-- activate with delay
} else {
@@ -671,7 +674,7 @@ sub Alarm_Html($)
my $id = $defs{$name}{NR};
#--
- readingsSingleUpdate( $hash, "state", Alarm_getstate($hash)." ".$hash->{READINGS}{"short"}{VAL}, 0 );
+ readingsSingleUpdate( $hash, "state", Alarm_getstate($hash)." ".$hash->{READINGS}{"short"}{VAL}, 1 );
#--
my $lockstate = ($hash->{READINGS}{lockstate}{VAL}) ? $hash->{READINGS}{lockstate}{VAL} : "unlocked";
@@ -806,35 +809,33 @@ sub Alarm_Html($)
=pod
=begin html
-
+
Alarm
FHEM module to set up a House Alarm System with 8 different alarm levels
Define
- define <name> Alarm
-
Defines the Alarm system.
-
+ define <name> Alarm
+
Defines the Alarm system.
Set
-
set <name> canceled <level>
-
cancels an alarm of level <level>, where <level> = 0..7
-
+
cancels an alarm of level <level>, where <level> = 0..7
-
-
set <name> armed <level>
+ set <name> armed <level>
set <name> disarmed <level>
-
sets the alarm of level <level> to armed (i.e., active) or disarmed (i.e., inactive), where <level> = 0..7
-
+
sets the alarm of level <level> to armed (i.e., active) or disarmed
+ (i.e., inactive), where <level> = 0..7
-
-
set <name> locked
+ set <name> locked
set <name> unlocked
-
sets the lockstate of the alarm module to locked (i.e., alarm setups may not be changed)
- resp. unlocked (i.e., alarm setups may be changed>)
+
sets the lockstate of the alarm module to locked (i.e., alarm setups
+ may not be changed) resp. unlocked (i.e., alarm setups may be changed>)
Get
@@ -846,18 +847,30 @@ sub Alarm_Html($)
Attributes
- attr <name> lockstate locked|unlocked
-
locked means that alarm setups may not be changed,
- unlocked means that alarm setups may be changed>
- attr <name> statedisplay simple,color,table,none
-
defines how the state of all eight alarm levels is shown. Example for the case when only alarm no. 2 is raised:
-
attr <name> armdelay mm:ss
time until the arming of an alarm becomes operative (0:00 - 9:59 allowed)
attr <name> armwait action
@@ -868,10 +881,11 @@ sub Alarm_Html($)
FHEM action to be carried out on the disarming of an alarm
attr <name> cancelact action
FHEM action to be carried out on the canceling of an alarm
- - For each of the 8 alarm levels, several attributes hold the alarm setup.
- They should not be changed by hand, but through the web interface to avoid confusion:
-
level<level>start, level<level>end, level<level>msg, level<level>xec,
- level<level>onact, level<level>offact
+ - For each of the 8 alarm levels, several attributes
+ hold the alarm setup. They should not be changed by hand, but through the web
+ interface to avoid confusion:
level<level>start, level<level>end,
+ level<level>msg, level<level>xec, level<level>onact,
+ level<level>offact
- Standard attributes alias, comment, event-on-update-reading, event-on-change-reading,