mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
Alarm.pm: Neue Version
git-svn-id: https://svn.fhem.de/fhem/trunk@7651 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
350a949839
commit
fcef72d497
@ -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.1";
|
||||
my $alarmversion = "2.3";
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
@ -166,28 +166,30 @@ sub Alarm_CreateEntry($) {
|
||||
sub Alarm_Set($@) {
|
||||
my ( $hash, $name, $cmd, @args ) = @_;
|
||||
|
||||
if ( ($cmd eq "cancel") || ($cmd eq "armed") || ($cmd eq "disarmed") ) {
|
||||
if ( $cmd =~ /^(cancel|arm|disarm)(ed)?$/ ) {
|
||||
return "[Alarm] Invalid argument to set $cmd, must be numeric"
|
||||
if ( $args[0] !~ /\d+/ );
|
||||
return "[Alarm] Invalid argument to set $cmd, must be 0 < arg < $alarmno"
|
||||
if ( ($args[0] >= $alarmno)||($args[0]<0) );
|
||||
if( $cmd eq "cancel" ){
|
||||
if( $cmd =~ /^cancel(ed)?$/ ){
|
||||
Alarm_Exec($name,$args[0],"web","button","cancel");
|
||||
}elsif ( $cmd eq "arm" ) {
|
||||
}elsif ( $cmd =~ /^arm(ed)?$/ ) {
|
||||
Alarm_Arm($name,$args[0],"web","button","arm");
|
||||
}else{
|
||||
}elsif ( $cmd =~ /^disarm(ed)?$/ ){
|
||||
Alarm_Arm($name,$args[0],"web","button","disarm");
|
||||
}else{
|
||||
return "[Alarm] Invalid argument set $cmd";
|
||||
}
|
||||
return;
|
||||
} elsif ( $cmd eq "lock" ) {
|
||||
} elsif ( $cmd =~ /^lock(ed)?$/ ) {
|
||||
readingsSingleUpdate( $hash, "lockstate", "locked", 0 );
|
||||
return;
|
||||
} elsif ( $cmd eq "unlock" ) {
|
||||
} elsif ( $cmd =~ /^unlock(ed)?$/ ) {
|
||||
readingsSingleUpdate( $hash, "lockstate", "unlocked", 0 );
|
||||
return;
|
||||
} else {
|
||||
my $str = join(",",(0..($alarmno-1)));
|
||||
return "[Alarm] Unknown argument " . $cmd . ", choose one of cancel:$str arm:$str disarm:$str lock:noArg unlock:noArg";
|
||||
return "[Alarm] Unknown argument " . $cmd . ", choose one of canceled:$str armed:$str disarmed:$str locked:noArg unlocked:noArg";
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,7 +663,7 @@ sub Alarm_Html($)
|
||||
$ret .= sprintf("<input type=\"text\" id=\"cancelaction\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",AttrVal($name, "cancelact",""));
|
||||
$ret .= "</td></tr></table></td></tr>";
|
||||
$ret .= "<tr class=\"odd\"><td class=\"col1\">Level</td><td class=\"col2\">Time [hh:mm]</td><td class=\"col3\">Message Part II</td>".
|
||||
"<td class=\"col4\">Arm/Cancel</td></tr>\n";
|
||||
"<td class=\"col4\">Armed/Cancel</td></tr>\n";
|
||||
for( my $k=0;$k<$alarmno;$k++ ){
|
||||
$row++;
|
||||
my $sval = AttrVal($name, "level".$k."start", 0);
|
||||
@ -765,19 +767,19 @@ sub Alarm_Html($)
|
||||
<h4>Set</h4>
|
||||
<ul>
|
||||
<li><a name="alarm_cancel">
|
||||
<code>set <name> cancel <level></code>
|
||||
<code>set <name> canceled <level></code>
|
||||
</a>
|
||||
<br/>cancels an alarm of level <level>, where <level> = 1..7
|
||||
</li>
|
||||
<li><a name="alarm_arm">
|
||||
<code>set <name> arm <level></code><br/>
|
||||
<code>set <name> disarm <level></code>
|
||||
<code>set <name> armed <level></code><br/>
|
||||
<code>set <name> disarmed <level></code>
|
||||
</a>
|
||||
<br/>sets the alarm of level <level> to armed (i.e., active) or disarmed (i.e., inactive), where <level> = 1..7
|
||||
</li>
|
||||
<li><a name="alarm_lock">
|
||||
<code>set <name> lock</code><br/>
|
||||
<code>set <name> unlock</code>
|
||||
<code>set <name> locked</code><br/>
|
||||
<code>set <name> unlocked</code>
|
||||
</a>
|
||||
<br/>sets the lockstate of the alarm module to <i>locked</i> (i.e., alarm setups may not be changed)
|
||||
resp. <i>unlocked</i> (i.e., alarm setups may be changed>)</li>
|
||||
|
Loading…
Reference in New Issue
Block a user