2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

95_Alarm.pm: Neue Version mit einigen neuen Features

git-svn-id: https://svn.fhem.de/fhem/trunk@12612 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
pahenning 2016-11-21 09:28:51 +00:00
parent bc047fc1bf
commit a45f2e1bc4
2 changed files with 75 additions and 35 deletions

View File

@ -2,7 +2,7 @@
# #
# Alarm.pm # Alarm.pm
# #
# FHEM module for house alarm # FHEM module to set up a house alarm system with 8 different alarm levels
# #
# Prof. Dr. Peter A. Henning # Prof. Dr. Peter A. Henning
# #
@ -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.6"; my $alarmversion = "2.8";
######################################################################################### #########################################################################################
# #
@ -58,7 +58,7 @@ sub Alarm_Initialize ($) {
$hash->{GetFn} = "Alarm_Get"; $hash->{GetFn} = "Alarm_Get";
$hash->{UndefFn} = "Alarm_Undef"; $hash->{UndefFn} = "Alarm_Undef";
#$hash->{AttrFn} = "Alarm_Attr"; #$hash->{AttrFn} = "Alarm_Attr";
my $attst = "lockstate:lock,unlock statedisplay:simple,color,table,graphics,none armdelay armwait armact disarmact cancelact"; my $attst = "lockstate:lock,unlock statedisplay:simple,color,table,none armdelay armwait armact disarmact cancelact";
for( my $level=0;$level<$alarmno;$level++ ){ for( my $level=0;$level<$alarmno;$level++ ){
$attst .=" level".$level."start level".$level."end level".$level."msg level".$level."xec:0,1 level".$level."onact level".$level."offact "; $attst .=" level".$level."start level".$level."end level".$level."msg level".$level."xec:0,1 level".$level."onact level".$level."offact ";
} }
@ -154,8 +154,21 @@ sub Alarm_CreateEntry($) {
} }
} }
} }
#-- recover state from stored readings
for( my $level=0;$level<$alarmno;$level++ ){
my $val = $hash->{READINGS}{"level".$level}{VAL};
if( $val eq "disarmed" ){#
CommandAttr (undef,$name.' level'.$level.'xec disarmed');
}elsif( $val eq "armed" ){
CommandAttr (undef,$name.' level'.$level.'xec armed');
}else{
Log3 $hash,1,"[Alarm $level] has undefined save data, disarming";
CommandAttr (undef,$name.' level'.$level.'xec disarmed');
}
}
my $mga = Alarm_getstate($hash)." Keine Störung"; my $mga = Alarm_getstate($hash)." Keine Störung";
readingsSingleUpdate( $hash, "state", $mga, 1 ); readingsSingleUpdate( $hash, "state", $mga, 1 );
} }
######################################################################################### #########################################################################################
@ -228,10 +241,12 @@ sub Alarm_getstate($) {
my ($hash) = @_; my ($hash) = @_;
my $res = ''; my $res = '';
my $type = AttrVal($hash->{NAME},"statedisplay",0); my $type = AttrVal($hash->{NAME},"statedisplay",0);
my $val;
#-------------------------- #--------------------------
if( $type eq "simple" ){ if( $type eq "simple" ){
for( my $level=0;$level<$alarmno;$level++ ){ for( my $level=0;$level<$alarmno;$level++ ){
if( $hash->{READINGS}{"level".$level}{VAL} eq "off" ){ $val = $hash->{READINGS}{"level".$level}{VAL};
if( ($val eq "disarmed")||($val eq "armed") ){
$res.='O'; $res.='O';
}else{ }else{
$res.='X'; $res.='X';
@ -241,7 +256,8 @@ sub Alarm_getstate($) {
}elsif( $type eq "color" ){ }elsif( $type eq "color" ){
$res = '<span style="color:green">'; $res = '<span style="color:green">';
for( my $level=0;$level<$alarmno;$level++ ){ for( my $level=0;$level<$alarmno;$level++ ){
if( $hash->{READINGS}{"level".$level}{VAL} eq "off" ){ $val = $hash->{READINGS}{"level".$level}{VAL};
if( ($val eq "disarmed")||($val eq "armed") ){
$res.=' '.$level; $res.=' '.$level;
}else{ }else{
$res.=' <span style="width:1ex;color:red">'.$level.'</span>'; $res.=' <span style="width:1ex;color:red">'.$level.'</span>';
@ -252,7 +268,8 @@ sub Alarm_getstate($) {
}elsif( $type eq "table" ){ }elsif( $type eq "table" ){
$res = '<table><tr style="height:1ex">'; $res = '<table><tr style="height:1ex">';
for( my $level=0;$level<$alarmno;$level++ ){ for( my $level=0;$level<$alarmno;$level++ ){
if( $hash->{READINGS}{"level".$level}{VAL} eq "off" ){ $val = $hash->{READINGS}{"level".$level}{VAL};
if( ($val eq "disarmed")||($val eq "armed") ){
$res.='<td style="width:1ex;background-color:green"/>'; $res.='<td style="width:1ex;background-color:green"/>';
}else{ }else{
$res.='<td style="width:1ex;background-color:red"/>'; $res.='<td style="width:1ex;background-color:red"/>';
@ -295,7 +312,7 @@ sub Alarm_Exec($$$$$){
#-- raising the alarm #-- 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 "armed") ){
#-- check for time #-- check for time
my $start = AttrVal($name, "level".$level."start", 0); my $start = AttrVal($name, "level".$level."start", 0);
if( index($start, '{') != -1){ if( index($start, '{') != -1){
@ -325,7 +342,7 @@ sub Alarm_Exec($$$$$){
if( (($stp < $etp) && ($ntp <= $etp) && ($ntp >= $stp)) || (($stp > $etp) && (($ntp <= $etp) || ($ntp >= $stp))) ){ if( (($stp < $etp) && ($ntp <= $etp) && ($ntp >= $stp)) || (($stp > $etp) && (($ntp <= $etp) || ($ntp >= $stp))) ){
#-- raised by sensor (attribute values have been controlled in CreateNotifiers) #-- raised by sensor (attribute values have been controlled in CreateNotifiers)
@sta = split('\|', AttrVal($dev, "alarmSettings", 0)); @sta = split('\|', AttrVal($dev, "alarmSettings", ""));
if( $sta[2] ){ if( $sta[2] ){
$mga = $sta[2]." ".AttrVal($name, "level".$level."msg", 0); $mga = $sta[2]." ".AttrVal($name, "level".$level."msg", 0);
#-- replace some parts #-- replace some parts
@ -338,11 +355,17 @@ sub Alarm_Exec($$$$$){
#-- readings #-- readings
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; $msg = Alarm_getstate($hash)." ".$mga;
readingsSingleUpdate( $hash, "state", $mga, 1 ); readingsSingleUpdate( $hash, "state", $msg, 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);
$cmd =~ s/\$NAME/$dev/g;
$cmd =~ s/\$EVENT/$evt/g;
$cmd =~ s/\$SHORT/$mga/g;
for( my $i=1;$i<= int(@evtpart);$i++){
$cmd =~ s/\$EVTPART$i/$evtpart[$i-1]/g;
}
fhem($cmd); fhem($cmd);
Log3 $hash,3,$msg; Log3 $hash,3,$msg;
}else{ }else{
@ -359,7 +382,7 @@ sub Alarm_Exec($$$$$){
} }
}elsif( ($act eq "off")||($act eq "cancel") ){ }elsif( ($act eq "off")||($act eq "cancel") ){
#-- only if this level is active #-- only if this level is active
if( $xac ne "off"){ if( ($xac ne "armed")&&($xac ne "disarmed") ){
#-- deleting all running ats #-- deleting all running ats
$dly = sprintf("alarm%1ddly",$level); $dly = sprintf("alarm%1ddly",$level);
foreach my $d (sort keys %intAt ) { foreach my $d (sort keys %intAt ) {
@ -375,8 +398,8 @@ sub Alarm_Exec($$$$$){
$cmd = AttrVal($name, "cancelact", 0); $cmd = AttrVal($name, "cancelact", 0);
fhem($cmd) fhem($cmd)
if( $cmd ); if( $cmd );
#-- readings #-- readings - arm status does not change
readingsSingleUpdate( $hash, "level".$level,"off",0 ); readingsSingleUpdate( $hash, "level".$level,"armed",0 );
$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;
@ -418,7 +441,7 @@ sub Alarm_Arm($$$$$){
my $cmdact = AttrVal($name, "armact", 0); my $cmdact = AttrVal($name, "armact", 0);
if( ($xdl eq '')|($xdl eq '0:00')|($xdl eq '00:00') ){ if( ($xdl eq '')|($xdl eq '0:00')|($xdl eq '00:00') ){
CommandAttr(undef,$name.' level'.$level.'xec armed'); CommandAttr(undef,$name.' level'.$level.'xec armed');
$msg = "[Alarm $level] armed from device $dev with event $evt"; $msg = "[Alarm $level] armed from alarmSensor $dev with event $evt";
Log3 $hash,3,$msg; Log3 $hash,3,$msg;
} elsif( $xdl =~ /([0-9])?:([0-5][0-9])?/ ){ } elsif( $xdl =~ /([0-9])?:([0-5][0-9])?/ ){
CommandAttr(undef,$name.' level'.$level.'xec armwait'); CommandAttr(undef,$name.' level'.$level.'xec armwait');
@ -434,8 +457,9 @@ sub Alarm_Arm($$$$$){
} }
} }
#-- compose commands #-- compose commands
$cmd = sprintf("define alarm%1d.arm.dly at +00:%02d:%02d {fhem(\"attr %s level%1dxec armed\");;%s}",$level,$1,$2,$name,$level,$cmdactf); $cmd = sprintf("define alarm%1d.arm.dly at +00:%02d:%02d {fhem(\"setreading %s level%1d armed\");;fhem(\"attr %s level%1dxec armed\");;%s}",
$msg = "[Alarm $level] will be armed from device $dev with event $evt, delay $xdl"; $level,$1,$2,$name,$level,$name,$level,$cmdactf);
$msg = "[Alarm $level] will be armed from alarmSensor $dev with event $evt, delay $xdl";
#-- delete old delayed arm #-- delete old delayed arm
fhem('delete alarm'.$level.'.arm.dly' ) fhem('delete alarm'.$level.'.arm.dly' )
if( defined $defs{'alarm'.$level.'.arm.dly'}); if( defined $defs{'alarm'.$level.'.arm.dly'});
@ -455,8 +479,9 @@ sub Alarm_Arm($$$$$){
if( defined $defs{'alarm'.$level.'.arm.dly'}); if( defined $defs{'alarm'.$level.'.arm.dly'});
CommandAttr (undef,$name.' level'.$level.'xec disarmed'); CommandAttr (undef,$name.' level'.$level.'xec disarmed');
Alarm_Exec($name,$level,"program","disarm","cancel"); Alarm_Exec($name,$level,"program","disarm","cancel");
readingsSingleUpdate( $hash, "level".$level,"disarmed",0 );
#-- #--
$msg = "[Alarm $level] disarmed from device $dev with event $evt"; $msg = "[Alarm $level] disarmed from alarmSensor $dev with event $evt";
$cmd = AttrVal($name, "disarmact", 0); $cmd = AttrVal($name, "disarmact", 0);
fhem("define alarm".$level.".disarm.T at +00:00:03 ".$cmd) fhem("define alarm".$level.".disarm.T at +00:00:03 ".$cmd)
if( $cmd ); if( $cmd );
@ -557,19 +582,19 @@ sub Alarm_CreateNotifiers($){
if( AttrVal($d, "alarmDevice","") eq "Sensor" ) { if( AttrVal($d, "alarmDevice","") eq "Sensor" ) {
my @aval = split('\|',AttrVal($d, "alarmSettings","")); my @aval = split('\|',AttrVal($d, "alarmSettings",""));
if( int(@aval) != 4){ if( int(@aval) != 4){
# Log3 $hash, 1, "[Alarm $level] Settings incomplete for sensor $d"; Log3 $hash, 5, "[Alarm $level] Settings incomplete for alarmSensor $d";
next; next;
} }
if( index($aval[0],"alarm".$level) != -1){ if( index($aval[0],"alarm".$level) != -1){
if( $aval[3] eq "on" ){ if( $aval[3] eq "on" ){
$cmd .= '('.$aval[1].')|'; $cmd .= '('.$aval[1].')|';
# Log3 $hash,1,"[Alarm $level] Adding sensor $d to raise notifier"; Log3 $hash,5,"[Alarm $level] Adding alarmSensor $d to raise notifier";
}elsif( $aval[3] eq "arm" ){ }elsif( $aval[3] eq "arm" ){
$cmdarm .= '('.$aval[1].')|'; $cmdarm .= '('.$aval[1].')|';
#Log3 $hash,1,"[Alarm $level] Adding sensor $d to arm notifier"; Log3 $hash,5,"[Alarm $level] Adding alarmSensor $d to arm notifier";
}elsif( $aval[3] eq "disarm" ){ }elsif( $aval[3] eq "disarm" ){
$cmddisarm .= '('.$aval[1].')|'; $cmddisarm .= '('.$aval[1].')|';
# Log3 $hash,1,"[Alarm $level] Adding sensor $d to disarm notifier"; Log3 $hash,5,"[Alarm $level] Adding alarmSensor $d to disarm notifier";
} }
} }
} }
@ -595,12 +620,12 @@ sub Alarm_CreateNotifiers($){
if( AttrVal($d, "alarmDevice","") eq "Actor" ) { if( AttrVal($d, "alarmDevice","") eq "Actor" ) {
my @aval = split('\|',AttrVal($d, "alarmSettings","")); my @aval = split('\|',AttrVal($d, "alarmSettings",""));
if( int(@aval) != 4){ if( int(@aval) != 4){
Log3 $hash, 5, "[Alarm $level] Settings incomplete for actor $d"; Log3 $hash, 5, "[Alarm $level] Settings incomplete for alarmActor $d";
next; next;
} }
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" )||($aval[3] eq "00:00")){ if(( $aval[3] eq "0" )||($aval[3] eq "0:00")||($aval[3] eq "00:00")){
$cmd .= $aval[1].';'; $cmd .= $aval[1].';';
#-- activate with delay #-- activate with delay
} else { } else {
@ -705,17 +730,17 @@ sub Alarm_Html($)
$ret .= "<tr class=\"odd\"><td class=\"col1\" colspan=\"4\"><table id=\"armtable\" border=\"0\">\n"; $ret .= "<tr class=\"odd\"><td class=\"col1\" colspan=\"4\"><table id=\"armtable\" border=\"0\">\n";
$ret .= "<tr class==\"odd\"><td class=\"col1\" align=\"right\">Arm Button &#8608</td>"; $ret .= "<tr class==\"odd\"><td class=\"col1\" align=\"right\">Arm Button &#8608</td>";
$ret .= "<td class=\"col2\" align=\"right\"> Wait Action "; $ret .= "<td class=\"col2\" align=\"right\"> Wait Action ";
$ret .= sprintf("<input type=\"text\" id=\"armwait\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",AttrVal($name, "armwait","")); $ret .= sprintf("<input type=\"text\" id=\"armwait\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",(AttrVal($name, "armwait","") eq "1")?"":AttrVal($name, "armwait",""));
$ret .= "</td><td class=\"col3\" rowspan=\"2\"> &#8628 Delay <br> &#8626"; $ret .= "</td><td class=\"col3\" rowspan=\"2\"> &#8628 Delay <br> &#8626";
$ret .= sprintf("<input type=\"text\" id=\"armdelay\" size=\"4\" maxlength=\"5\" value=\"%s\"/>",AttrVal($name, "armdelay","")); $ret .= sprintf("<input type=\"text\" id=\"armdelay\" size=\"4\" maxlength=\"5\" value=\"%s\"/>",(AttrVal($name, "armdelay","0:00") eq "1")?"":AttrVal($name, "armdelay","0:00"));
$ret .= "</td></tr>\n"; $ret .= "</td></tr>\n";
$ret .= "<tr class==\"even\"><td class=\"col1\"></td><td class=\"col2\" align=\"right\">Arm Action "; $ret .= "<tr class==\"even\"><td class=\"col1\"></td><td class=\"col2\" align=\"right\">Arm Action ";
$ret .= sprintf("<input type=\"text\" id=\"armaction\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",AttrVal($name, "armact","")); $ret .= sprintf("<input type=\"text\" id=\"armaction\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",(AttrVal($name, "armact","") eq "1")?"":AttrVal($name, "armact",""));
$ret .= "</td></tr>\n"; $ret .= "</td></tr>\n";
$ret .="<tr class==\"odd\"><td class=\"col1\">Disarm Button &#8608</td><td class=\"col2\" align=\"right\">Disarm Action "; $ret .="<tr class==\"odd\"><td class=\"col1\">Disarm Button &#8608</td><td class=\"col2\" align=\"right\">Disarm Action ";
$ret .= sprintf("<input type=\"text\" id=\"disarmaction\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",AttrVal($name, "disarmact","")); $ret .= sprintf("<input type=\"text\" id=\"disarmaction\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",(AttrVal($name, "disarmact","") eq "1")?"":AttrVal($name, "disarmact",""));
$ret .= "</td><td></td></tr><tr class==\"odd\"><td class=\"col1\">Cancel Button &#8608</td><td class=\"col2\" align=\"right\"> Cancel Action "; $ret .= "</td><td></td></tr><tr class==\"odd\"><td class=\"col1\">Cancel Button &#8608</td><td class=\"col2\" align=\"right\"> Cancel Action ";
$ret .= sprintf("<input type=\"text\" id=\"cancelaction\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",AttrVal($name, "cancelact","")); $ret .= sprintf("<input type=\"text\" id=\"cancelaction\" size=\"50\" maxlength=\"512\" value=\"%s\"/>",(AttrVal($name, "cancelact","") eq "1")?"":AttrVal($name, "cancelact",""));
$ret .= "</td><td></td></tr></table></td></tr>"; $ret .= "</td><td></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>". $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\">Armed/Cancel</td></tr>\n"; "<td class=\"col4\">Armed/Cancel</td></tr>\n";
@ -752,7 +777,7 @@ sub Alarm_Html($)
if( AttrVal($d, "alarmDevice","") eq "Sensor" ) { if( AttrVal($d, "alarmDevice","") eq "Sensor" ) {
my @aval = split('\|',AttrVal($d, "alarmSettings","")); my @aval = split('\|',AttrVal($d, "alarmSettings",""));
if( int(@aval) != 4){ if( int(@aval) != 4){
@aval=("","","",""); Log3 $hash, 1, "[Alarm] Settings incomplete for alarmSensor $d";
} }
$row++; $row++;
$ret .= sprintf("<tr class=\"%s\" informId=\"$d\" name=\"sensor\">", ($row&1)?"odd":"even"); $ret .= sprintf("<tr class=\"%s\" informId=\"$d\" name=\"sensor\">", ($row&1)?"odd":"even");
@ -781,8 +806,9 @@ sub Alarm_Html($)
foreach my $d (sort keys %defs ) { foreach my $d (sort keys %defs ) {
next if(IsIgnored($d)); next if(IsIgnored($d));
if( AttrVal($d, "alarmDevice","") eq "Actor" ) { if( AttrVal($d, "alarmDevice","") eq "Actor" ) {
my @aval = split('\|',AttrVal($d, "alarmSettings","")); my @aval = split('\|',AttrVal($d, "alarmSettings","|||0:00"));
if( int(@aval) != 4){ if( int(@aval) != 4){
Log3 $hash, 1, "[Alarm] Settings incomplete for alarmActor $d";
@aval=("","","",""); @aval=("","","","");
} }
$row++; $row++;
@ -807,11 +833,13 @@ sub Alarm_Html($)
1; 1;
=pod =pod
=item helper
=item summary to set up a house alarm system with 8 different alarm levels
=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>
@ -863,12 +891,12 @@ sub Alarm_Html($)
simple,color,table,none</code></a> simple,color,table,none</code></a>
<br />defines how the state of all eight alarm levels is shown. Example for the case <br />defines how the state of all eight alarm levels is shown. Example for the case
when only alarm no. 2 is raised: <ul> 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" <li> color = <span style="color:green"> 0 1 <span style="width:1ex;color:red"
>2</span> 3 4 5 6 7</span></li> >2</span> 3 4 5 6 7</span></li>
<li> table (ATTENTION: TABLE MOMENTARILY REMOVED) <li> table = HTML mini table with green and red fields for alarms
</li> </li>
<li> none=no state display</li> <li> none = no state display</li>
</ul> </ul>
</li> </li>
<li><a name="alarm_armdelay"><code>attr &lt;name&gt; armdelay <i>mm:ss</i></code></a> <li><a name="alarm_armdelay"><code>attr &lt;name&gt; armdelay <i>mm:ss</i></code></a>

View File

@ -1,5 +1,7 @@
//######################################################################################## //########################################################################################
// alarm.js // alarm.js
// Version 2.8
// See 95_Alarm for licensing
//######################################################################################## //########################################################################################
//# Prof. Dr. Peter A. Henning //# Prof. Dr. Peter A. Henning
@ -42,6 +44,13 @@ function HashTable() {
return typeof(this.items[in_key]) != 'undefined'; return typeof(this.items[in_key]) != 'undefined';
} }
} }
function encodeParm(oldval) {
var newval;
newval=oldval.replace('+', '%2B');
newval=newval.replace('#', '%23');
return newval;
}
var ah = new HashTable('l0s','','l0e',''); var ah = new HashTable('l0s','','l0e','');
@ -53,6 +62,7 @@ function alarm_setAttribute(name, attr, val) {//set Alarm Attribute
if (location.substr(location.length-1,1) == '/') {location = location.substr(0,location.length-1);} if (location.substr(location.length-1,1) == '/') {location = location.substr(0,location.length-1);}
var url = document.location.protocol+"//"+document.location.host+location; var url = document.location.protocol+"//"+document.location.host+location;
attr = attr.replace('+', '%2B'); attr = attr.replace('+', '%2B');
val = val.replace('#', '%23');
FW_cmd(url+'?XHR=1&cmd.'+name+'=attr '+name+' '+attr+' '+val); FW_cmd(url+'?XHR=1&cmd.'+name+'=attr '+name+' '+attr+' '+val);
} }
@ -129,6 +139,7 @@ function alarm_set(name){
val += "|"+sarr[k].children[2].children[1].value; val += "|"+sarr[k].children[2].children[1].value;
val += "|"+sarr[k].children[3].children[0].options[sarr[k].children[3].children[0].selectedIndex].value; val += "|"+sarr[k].children[3].children[0].options[sarr[k].children[3].children[0].selectedIndex].value;
val = val.replace('+', '%2B'); val = val.replace('+', '%2B');
val = val.replace('#', '%23');
FW_cmd(url+'?XHR=1&cmd.'+nam+'=attr '+nam+' alarmSettings ' + val); FW_cmd(url+'?XHR=1&cmd.'+nam+'=attr '+nam+' alarmSettings ' + val);
} }
@ -147,6 +158,7 @@ function alarm_set(name){
val += "|"+aarr[k].children[2].children[1].value; val += "|"+aarr[k].children[2].children[1].value;
val += "|"+aarr[k].children[3].children[0].value; val += "|"+aarr[k].children[3].children[0].value;
val = val.replace('+', '%2B'); val = val.replace('+', '%2B');
val = val.replace('#', '%23');
FW_cmd(url+'?XHR=1&cmd.'+nam+'=attr '+nam+' alarmSettings ' + val); FW_cmd(url+'?XHR=1&cmd.'+nam+'=attr '+nam+' alarmSettings ' + val);
} }