11_FHT.pm added new readings for warnings on battery, lowtemp, window and windowsensor

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@558 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
m_fischer
2010-01-21 23:50:38 +00:00
parent 34cac5c985
commit 32e38fd532
3 changed files with 72 additions and 9 deletions

View File

@@ -568,4 +568,5 @@
- feature: [pgm3] Skinable - change the colors. - feature: [pgm3] Skinable - change the colors.
- feature: [pgm3] Rooms possible for Webcam and Google-Weather - feature: [pgm3] Rooms possible for Webcam and Google-Weather
- bugfix: dummy/structure was listed twice in list and xmllist - bugfix: dummy/structure was listed twice in list and xmllist
- feature: 11_FHT.pm added new readings for warnings on battery, lowtemp,
window and windowsensor (M.Fischer)

View File

@@ -84,15 +84,19 @@ my %codes = (
my %cantset = ( my %cantset = (
"ack" => 1, "ack" => 1,
"ack2" => 1, "ack2" => 1,
"battery" => 1,
"can-xmit" => 1, "can-xmit" => 1,
"can-rcv" => 1, "can-rcv" => 1,
"start-xmit" => 1, "start-xmit" => 1,
"end-xmit" => 1, "end-xmit" => 1,
"lowtemp" => 1,
"measured-temp" => 1, "measured-temp" => 1,
"measured-high" => 1, "measured-high" => 1,
"measured-low" => 1, "measured-low" => 1,
"warnings" => 1, "warnings" => 1,
"window" => 1,
"windowsensor" => 1,
); );
@@ -370,6 +374,25 @@ FHT_Parse($$)
my $tn = TimeNow(); my $tn = TimeNow();
###########################
# Set default values for battery, lowtemp, window and windowsensor warnings.
my $warnBattery = "ok";
my $warnTempLow = "ok";
my $warnWindowSensor = "ok";
my $warnWindow = "closed";
$def->{READINGS}{'battery'}{TIME} = $tn;
$def->{READINGS}{'battery'}{VAL} = $warnBattery;
$def->{READINGS}{'lowtemp'}{TIME} = $tn;
$def->{READINGS}{'lowtemp'}{VAL} = $warnTempLow;
$def->{READINGS}{'window'}{TIME} = $tn;
$def->{READINGS}{'window'}{VAL} = $warnWindow;
$def->{READINGS}{'windowsensor'}{TIME} = $tn;
$def->{READINGS}{'windowsensor'}{VAL} = $warnWindowSensor;
########################### ###########################
# Reformat the values so they are readable. # Reformat the values so they are readable.
# The first four are confirmation messages, so they must be converted to # The first four are confirmation messages, so they must be converted to
@@ -430,10 +453,30 @@ FHT_Parse($$)
} elsif($cmd eq "warnings") { } elsif($cmd eq "warnings") {
my $nVal; my $nVal;
if($val & 1) { $nVal = "Battery low"; } if($val & 1) {
if($val & 2) { $nVal .= "; " if($nVal); $nVal .= "Temperature too low"; } $nVal = "Battery low";
if($val &32) { $nVal .= "; " if($nVal); $nVal .= "Window open"; } $warnBattery = "low";
if($val &16) { $nVal .= "; " if($nVal); $nVal .= "Fault on window sensor"; } $def->{READINGS}{'battery'}{TIME} = $tn;
$def->{READINGS}{'battery'}{VAL} = $warnBattery;
}
if($val & 2) {
$nVal .= "; " if($nVal); $nVal .= "Temperature too low";
$warnTempLow = "warn";
$def->{READINGS}{'lowtemp'}{TIME} = $tn;
$def->{READINGS}{'lowtemp'}{VAL} = $warnTempLow;
}
if($val &32) {
$nVal .= "; " if($nVal); $nVal .= "Window open";
$warnWindow = "open";
$def->{READINGS}{'window'}{TIME} = $tn;
$def->{READINGS}{'window'}{VAL} = $warnWindow;
}
if($val &16) {
$nVal .= "; " if($nVal); $nVal .= "Fault on window sensor";
$warnWindowSensor = "fault";
$def->{READINGS}{'windowsensor'}{TIME} = $tn;
$def->{READINGS}{'windowsensor'}{VAL} = $warnWindowSensor;
}
$val = $nVal? $nVal : "none"; $val = $nVal? $nVal : "none";
} }
@@ -449,6 +492,18 @@ FHT_Parse($$)
Log 4, "FHT $name $cmd: $val"; Log 4, "FHT $name $cmd: $val";
if ($cmd eq "warnings") {
$def->{CHANGED}[1] = "battery: $warnBattery";
Log 4, "FHT $name battery: $warnBattery";
$def->{CHANGED}[2] = "lowtemp: $warnTempLow";
Log 4, "FHT $name lowtemp: $warnTempLow";
$def->{CHANGED}[3] = "window: $warnWindow";
Log 4, "FHT $name window: $warnWindow";
$def->{CHANGED}[4] = "windowsensor: $warnWindowSensor";
Log 4, "FHT $name windowsensor: $warnWindowSensor";
}
################################ ################################
# Softbuffer: delete confirmed commands # Softbuffer: delete confirmed commands
if($confirm) { if($confirm) {

View File

@@ -1341,8 +1341,15 @@ A line ending with \ will be concatenated with the next one, so long lines
<ul> <ul>
<li>warnings can contain following strings: <li>warnings can contain following strings:
none, Battery low,Temperature too low, Window open, none, Battery low,Temperature too low, Window open,
Fault on window sensor Fault on window sensor.<br>
</li> In addition, the current warnings are reported separately:
<ul>
<li>battery: ok / low</li>
<li>lowtemp: ok / low</li>
<li>window: open / closed</li>
<li>windowsensor: ok / fault</li>
</ul>
</li>
<li>actuator (without a suffix) stands for all actuators. <li>actuator (without a suffix) stands for all actuators.
<li>actuator or actuator1..8 can take following values: <li>actuator or actuator1..8 can take following values:
<ul> <ul>
@@ -1362,9 +1369,9 @@ A line ending with \ will be concatenated with the next one, so long lines
<li>pair<br> <li>pair<br>
The the FHT80b sent a "you-belong-to-me" to this actuator. The the FHT80b sent a "you-belong-to-me" to this actuator.
</ul> </ul>
Note:
</ul> </ul>
<br> </li>
<br>
<li>The FHT is very economical (or lazy), it accepts one message from the <li>The FHT is very economical (or lazy), it accepts one message from the
FHZ1x00 every 115+x seconds, where x depends on the housecode. Don't FHZ1x00 every 115+x seconds, where x depends on the housecode. Don't