Alarm.pm: repaired Id Tag

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@10664 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
pahenning 2016-01-30 11:36:17 +00:00
parent ac831712f0
commit 2334ed5d36

View File

@ -6,7 +6,7 @@
# #
# Prof. Dr. Peter A. Henning # 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 $alarmhiddenroom = "AlarmRoom"; # hidden room
my $alarmpublicroom = "Alarm"; # public room my $alarmpublicroom = "Alarm"; # public room
my $alarmno = 8; my $alarmno = 8;
my $alarmversion = "2.5"; my $alarmversion = "2.6";
######################################################################################### #########################################################################################
# #
@ -83,7 +83,10 @@ sub Alarm_Define ($$) {
my $now = time(); my $now = time();
my $name = $hash->{NAME}; my $name = $hash->{NAME};
$hash->{VERSION} = $alarmversion; $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); RemoveInternalTimer($hash);
InternalTimer ($now + 5, 'Alarm_CreateEntry', $hash, 0); InternalTimer ($now + 5, 'Alarm_CreateEntry', $hash, 0);
@ -152,7 +155,7 @@ sub Alarm_CreateEntry($) {
} }
} }
my $mga = Alarm_getstate($hash)." Keine Störung"; 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 return
if ($dev eq 'global'); if ($dev eq 'global');
#-- raising the alarmy #-- raising the alarm
if( $act eq "on" ){ if( $act eq "on" ){
#-- only if this level is armed and not yet active #-- only if this level is armed and not yet active
if( ($xec eq "armed") && ($xac eq "off") ){ if( ($xec eq "armed") && ($xac eq "off") ){
@ -336,7 +339,7 @@ sub Alarm_Exec($$$$$){
readingsSingleUpdate( $hash, "level".$level,$dev,0 ); readingsSingleUpdate( $hash, "level".$level,$dev,0 );
readingsSingleUpdate( $hash, "short", $mga, 0); readingsSingleUpdate( $hash, "short", $mga, 0);
$mga = Alarm_getstate($hash)." ".$mga; $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"; $msg = "[Alarm $level] raised from device $dev with event $evt";
#-- calling actors AFTER state update #-- calling actors AFTER state update
$cmd = AttrVal($name, "level".$level."onact", 0); $cmd = AttrVal($name, "level".$level."onact", 0);
@ -377,7 +380,7 @@ sub Alarm_Exec($$$$$){
$mga = " Level $level canceled"; $mga = " Level $level canceled";
readingsSingleUpdate( $hash, "short", "", 0); readingsSingleUpdate( $hash, "short", "", 0);
$mga = Alarm_getstate($hash)." ".$mga; $mga = Alarm_getstate($hash)." ".$mga;
readingsSingleUpdate( $hash, "state", $mga, 0 ); readingsSingleUpdate( $hash, "state", $mga, 1 );
$msg = "[Alarm $level] canceled from device $dev"; $msg = "[Alarm $level] canceled from device $dev";
Log3 $hash,3,$msg; Log3 $hash,3,$msg;
} }
@ -597,7 +600,7 @@ sub Alarm_CreateNotifiers($){
} }
if( index($aval[0],"alarm".$level) != -1 ){ if( index($aval[0],"alarm".$level) != -1 ){
#-- activate without delay #-- activate without delay
if( $aval[3] eq "0" ){ if(( $aval[3] eq "0" )||($aval[3] eq "00:00")){
$cmd .= $aval[1].';'; $cmd .= $aval[1].';';
#-- activate with delay #-- activate with delay
} else { } else {
@ -671,7 +674,7 @@ sub Alarm_Html($)
my $id = $defs{$name}{NR}; 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"; my $lockstate = ($hash->{READINGS}{lockstate}{VAL}) ? $hash->{READINGS}{lockstate}{VAL} : "unlocked";
@ -806,35 +809,33 @@ sub Alarm_Html($)
=pod =pod
=begin html =begin html
<a name="Alarm"></a> <a name="Alarm"></a>
<h3>Alarm</h3> <h3>Alarm</h3>
<p> FHEM module to set up a House Alarm System with 8 different alarm levels</p> <p> FHEM module to set up a House Alarm System with 8 different alarm levels</p>
<a name="Alarmdefine"></a> <a name="Alarmdefine"></a>
<h4>Define</h4> <h4>Define</h4>
<p> <p>
<code>define &lt;name&gt; Alarm</code> <code>define &lt;name&gt; Alarm</code>
<br />Defines the Alarm system. <br />Defines the Alarm system. </p>
</p>
<a name="Alarmset"></a> <a name="Alarmset"></a>
<h4>Set</h4> <h4>Set</h4>
<ul> <ul>
<li><a name="alarm_cancel"> <li><a name="alarm_cancel">
<code>set &lt;name&gt; canceled &lt;level&gt;</code> <code>set &lt;name&gt; canceled &lt;level&gt;</code>
</a> </a>
<br/>cancels an alarm of level &lt;level&gt;, where &lt;level&gt; = 0..7 <br />cancels an alarm of level &lt;level&gt;, where &lt;level&gt; = 0..7 </li>
</li>
<li><a name="alarm_arm"> <li><a name="alarm_arm">
<code>set &lt;name&gt; armed &lt;level&gt;</code><br/> <code>set &lt;name&gt; armed &lt;level&gt;</code><br />
<code>set &lt;name&gt; disarmed &lt;level&gt;</code> <code>set &lt;name&gt; disarmed &lt;level&gt;</code>
</a> </a>
<br/>sets the alarm of level &lt;level&gt; to armed (i.e., active) or disarmed (i.e., inactive), where &lt;level&gt; = 0..7 <br />sets the alarm of level &lt;level&gt; to armed (i.e., active) or disarmed
</li> (i.e., inactive), where &lt;level&gt; = 0..7 </li>
<li><a name="alarm_lock"> <li><a name="alarm_lock">
<code>set &lt;name&gt; locked</code><br/> <code>set &lt;name&gt; locked</code><br />
<code>set &lt;name&gt; unlocked</code> <code>set &lt;name&gt; unlocked</code>
</a> </a>
<br/>sets the lockstate of the alarm module to <i>locked</i> (i.e., alarm setups may not be changed) <br />sets the lockstate of the alarm module to <i>locked</i> (i.e., alarm setups
resp. <i>unlocked</i> (i.e., alarm setups may be changed>)</li> may not be changed) resp. <i>unlocked</i> (i.e., alarm setups may be changed>)</li>
</ul> </ul>
<a name="Alarmget"></a> <a name="Alarmget"></a>
<h4>Get</h4> <h4>Get</h4>
@ -846,15 +847,27 @@ sub Alarm_Html($)
<a name="Alarmattr"></a> <a name="Alarmattr"></a>
<h4>Attributes</h4> <h4>Attributes</h4>
<ul> <ul>
<li><a name="alarm_lockstate"><code>attr &lt;name&gt; lockstate locked|unlocked</code></a> <li><a name="alarm_hiddenroom"><code>attr &lt;name&gt; hiddenroom
<br /><i>locked</i> means that alarm setups may not be changed, &lt;string&gt;</code></a>
<i>unlocked</i> means that alarm setups may be changed></li> <br />Room name for hidden alarm room (containing only the Alarm device), default:
<li><a name="alarm_statedisplay"><code>attr &lt;name&gt; statedisplay simple,color,table,none</code></a> AlarmRoom</li>
<br />defines how the state of all eight alarm levels is shown. Example for the case when only alarm no. 2 is raised: <li><a name="alarm_hiddenroom"><code>attr &lt;name&gt; hiddenroom
<ul> &lt;string&gt;</code></a>
<br />Room name for public alarm room (containing sensor/actor devices), default:
Alarm</li>
<li><a name="alarm_lockstate"><code>attr &lt;name&gt; lockstate
locked|unlocked</code></a>
<br /><i>locked</i> means that alarm setups may not be changed, <i>unlocked</i>
means that alarm setups may be changed></li>
<li><a name="alarm_statedisplay"><code>attr &lt;name&gt; statedisplay
simple,color,table,none</code></a>
<br />defines how the state of all eight alarm levels is shown. Example for the case
when only alarm no. 2 is raised: <ul>
<li> simple=OOXOOOOO</li> <li> simple=OOXOOOOO</li>
<li> color=<span style="color:green"> 0 1 <span style="width:1ex;color:red">2</span> 3 4 5 6 7</span></li> <li> color=<span style="color:green"> 0 1 <span style="width:1ex;color:red"
<li> table=<table><tr style="height:1ex"><td style="width:1ex;background-color:green"/><td style="width:1ex;background-color:green"/><td style="width:1ex;background-color:red"/><td style="width:1ex;background-color:green"/><td style="width:1ex;background-color:green"/><td style="width:1ex;background-color:green"/><td style="width:1ex;background-color:green"/><td style="width:1ex;background-color:green"/></tr></table> </li> >2</span> 3 4 5 6 7</span></li>
<li> table (ATTENTION: TABLE MOMENTARILY REMOVED)
</li>
<li> none=no state display</li> <li> none=no state display</li>
</ul> </ul>
</li> </li>
@ -868,10 +881,11 @@ sub Alarm_Html($)
<br />FHEM action to be carried out on the disarming of an alarm</li> <br />FHEM action to be carried out on the disarming of an alarm</li>
<li><a name="alarm_cancelact"><code>attr &lt;name&gt; cancelact <i>action</i></code></a> <li><a name="alarm_cancelact"><code>attr &lt;name&gt; cancelact <i>action</i></code></a>
<br />FHEM action to be carried out on the canceling of an alarm</li> <br />FHEM action to be carried out on the canceling of an alarm</li>
<li><a name="alarm_internals"/>For each of the 8 alarm levels, several attributes hold the alarm setup. <li><a name="alarm_internals"></a>For each of the 8 alarm levels, several attributes
They should not be changed by hand, but through the web interface to avoid confusion: hold the alarm setup. They should not be changed by hand, but through the web
<code>level&lt;level&gt;start, level&lt;level&gt;end, level&lt;level&gt;msg, level&lt;level&gt;xec, interface to avoid confusion: <code>level&lt;level&gt;start, level&lt;level&gt;end,
level&lt;level&gt;onact, level&lt;level&gt;offact</code></li> level&lt;level&gt;msg, level&lt;level&gt;xec, level&lt;level&gt;onact,
level&lt;level&gt;offact</code></li>
<li>Standard attributes <a href="#alias">alias</a>, <a href="#comment">comment</a>, <a <li>Standard attributes <a href="#alias">alias</a>, <a href="#comment">comment</a>, <a
href="#event-on-update-reading">event-on-update-reading</a>, <a href="#event-on-update-reading">event-on-update-reading</a>, <a
href="#event-on-change-reading">event-on-change-reading</a>, <a href="#room" href="#event-on-change-reading">event-on-change-reading</a>, <a href="#room"