sanity checks for CUL_WS

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@696 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2010-08-14 11:42:46 +00:00
parent eb69137698
commit de44ab5068
5 changed files with 65 additions and 58 deletions

View File

@ -1,4 +1,4 @@
- =DATE= (4.10) - =DATE= (5.0)
- feature: KM271 - feature: KM271
- bugfix: 99_SUNRISE_EL endless loop bug - bugfix: 99_SUNRISE_EL endless loop bug
- feature: CUL: optional baudrate spec in definition - feature: CUL: optional baudrate spec in definition
@ -15,6 +15,12 @@
are connected, adjust matching rule are connected, adjust matching rule
- feature: Copy&Paste in SVG - feature: Copy&Paste in SVG
- feature: Debian/Ubuntu Package. Install-path changes to satisfy lintian - feature: Debian/Ubuntu Package. Install-path changes to satisfy lintian
- feature: Allnet 3076/4027/4000T
- feature: RFXCOMM Module for Oregon Weatherstations
- feature: Davis VantagePro2
- feature: ELV USB-WDE1
- feature: addvaltriggers CUL attribute for adding RSSI as a trigger
- feature: CUL_WS sanity check for large temp differences.
- 2010-03-13 (4.9) - 2010-03-13 (4.9)
- bugfix: changed the fhem prompt from FHZ> to fhem> - bugfix: changed the fhem prompt from FHZ> to fhem>

View File

@ -1,4 +1,4 @@
# $Id: 14_CUL_WS.pm,v 1.26 2010-01-26 23:31:17 mr_p Exp $ # $Id: 14_CUL_WS.pm,v 1.27 2010-08-14 11:42:46 rudolfkoenig Exp $
# #
############################################## ##############################################
package main; package main;
@ -279,60 +279,53 @@ CUL_WS_Parse($$)
} }
Log GetLogLevel($name,4), "CUL_WS $devtype $name: $val"; Log GetLogLevel($name,4), "CUL_WS $devtype $name: $val";
# Sanity checks
if($NotifyTemperature && $hash->{READINGS}{temperature}{VAL}) {
my $tval = $hash->{READINGS}{strangetemp} ?
$hash->{READINGS}{strangetemp}{VAL} :
$hash->{READINGS}{temperature}{VAL};
my $diff = ($NotifyTemperature - $tval)+0;
if($diff < -15.0 || $diff > 15.0) {
Log 2, "$name: Temp difference ($diff) too large: $val, skipping it";
$hash->{READINGS}{strangetemp}{VAL} = $NotifyTemperature;
$hash->{READINGS}{strangetemp}{TIME} = $tm;
return "";
}
}
delete $hash->{READINGS}{strangetemp} if($hash->{READINGS});
if(defined($hum) && $hum < 0) { if(defined($hum) && ($hum < 0 || $hum > 100)) {
Log 1, "BOGUS: $name reading: $val, skipping it"; Log 1, "BOGUS: $name reading: $val, skipping it";
return $name; return "";
} }
$hash->{STATE} = $val; # List overview $hash->{STATE} = $val; # List overview
$hash->{READINGS}{state}{TIME} = TimeNow(); # For list $hash->{READINGS}{state}{TIME} = $tm; # For list
$hash->{READINGS}{state}{VAL} = $val; $hash->{READINGS}{state}{VAL} = $val;
$hash->{CHANGED}[0] = $val; # For notify $hash->{CHANGED}[0] = $val; # For notify
my $i=1; my $i=1;
my $j; my $j;
my @Notifies=split(" ", $NotifyType); my @Notifies=split(" ", $NotifyType);
for($j=0; $j<int(@Notifies); $j++) {
if($Notifies[$j] eq "T") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyTemperature;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyTemperature;
} elsif($Notifies[$j] eq "H") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyHumidity;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyHumidity;
} elsif($Notifies[$j] eq "R") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyRain;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyRain;
} elsif($Notifies[$j] eq "W") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyWind;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyWind;
} elsif($Notifies[$j] eq "WD") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyWindDir;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyWindDir;
} elsif($Notifies[$j] eq "WS") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyWindSwing;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyWindSwing;
} elsif($Notifies[$j] eq "IR") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyIsRaining;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyIsRaining;
} elsif($Notifies[$j] eq "B") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyBrightness;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyBrightness;
} elsif($Notifies[$j] eq "P") {
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{TIME} = TimeNow();
$hash->{READINGS}{$NotifyMappings{$Notifies[$j]}}{VAL} = $NotifyPressure;
$hash->{CHANGED}[$i++] = $NotifyMappings{$Notifies[$j]} . ": " . $NotifyPressure;
}
}
for($j=0; $j<int(@Notifies); $j++) {
my $val = "";
if($Notifies[$j] eq "T") { $val = $NotifyTemperature;
} elsif($Notifies[$j] eq "H") { $val = $NotifyHumidity;
} elsif($Notifies[$j] eq "R") { $val = $NotifyRain;
} elsif($Notifies[$j] eq "W") { $val = $NotifyWind;
} elsif($Notifies[$j] eq "WD") { $val = $NotifyWindDir;
} elsif($Notifies[$j] eq "WS") { $val = $NotifyWindSwing;
} elsif($Notifies[$j] eq "IR") { $val = $NotifyIsRaining;
} elsif($Notifies[$j] eq "B") { $val = $NotifyBrightness;
} elsif($Notifies[$j] eq "P") { $val = $NotifyPressure;
}
my $nm = $NotifyMappings{$Notifies[$j]};
$hash->{READINGS}{$nm}{TIME} = $tm;
$hash->{READINGS}{$nm}{VAL} = $val;
$hash->{CHANGED}[$i++] = "$nm: $val";
}
$hash->{READINGS}{DEVTYPE}{VAL}=$devtype; $hash->{READINGS}{DEVTYPE}{VAL}=$devtype;
$hash->{READINGS}{DEVTYPE}{TIME}=$tm; $hash->{READINGS}{DEVTYPE}{TIME}=$tm;

3
TODO
View File

@ -1,6 +1,5 @@
FHEM: FHEM:
- CUL_WS safety check - fix autocreate rename anomaly (rename filelog only)
- document autocreate rename anomaly (rename filelog only)
- implement PID - implement PID
- implement wiki decisions - implement wiki decisions
- autodetect physical hardware - autodetect physical hardware

View File

@ -108,6 +108,9 @@
rename</a> to rename the automatically created device, e.g. type in the rename</a> to rename the automatically created device, e.g. type in the
input field of the web frontend:<pre> input field of the web frontend:<pre>
rename FHT_1234 fht.kitchen</pre> rename FHT_1234 fht.kitchen</pre>
<b>NOTE</b>: you have to rename the device itself, the attached FileLog
and weblink will be renamed automatically. The other way round (renaming
the FileLog or weblink) does not work correctly right now.
</ul> </ul>

View File

@ -62,7 +62,10 @@
<ul> <ul>
Current Version: (as of =DATE=): Current Version: (as of =DATE=):
<a href="http://www.koeniglich.de/fhem/fhem-=VERS=.tar.gz"> <a href="http://www.koeniglich.de/fhem/fhem-=VERS=.tar.gz">
http://www.koeniglich.de/fhem/fhem-=VERS=.tar.gz</a> fhem-=VERS=.tar.gz</a>
or
<a href="http://www.koeniglich.de/fhem/fhem-=VERS=.deb">
fhem-=VERS=.deb</a>
<br> <br>
See the <a href="CHANGED">CHANGED</a> file for current changes. See the <a href="CHANGED">CHANGED</a> file for current changes.
<br><br> <br><br>
@ -130,44 +133,47 @@
href="http://www.busware.de">www.busware.de</a>) access to the href="http://www.busware.de">www.busware.de</a>) access to the
following protocols: FS20 (all devices), EM (EM1000EM, EM1000GZ and following protocols: FS20 (all devices), EM (EM1000EM, EM1000GZ and
EM1000WZ), FHT80b, HMS, S300 (KS300, S300TH, KS555, S555TH, etc)</li> EM1000WZ), FHT80b, HMS, S300 (KS300, S300TH, KS555, S555TH, etc)</li>
<br>
<li>Via an attached FHZ1000 or FHZ1300 access to the following protocols: <li>Via an attached FHZ1000 or FHZ1300 access to the following protocols:
FS20 (all devices), FHT80b, HMS, KS300. <b>Note:</b> The FHZ1350 WLAN FS20 (all devices), FHT80b, HMS, KS300. <b>Note:</b> The FHZ1350 WLAN
works with fhem if you replace the standard (avisario) WLAN module with works with fhem if you replace the standard (avisario) WLAN module with
one that won't encrypt the data.</li> one that won't encrypt the data.</li>
<br>
<li>reading and sending X10 events via the CM11 module (with access <li>reading and sending X10 events via the CM11 module (with access
to a X10 computer interface)</li> to a X10 computer interface)</li>
<br>
<li>S300 devices via an attached WS300</li> <li>S300 devices via an attached WS300</li>
<br>
<li>EM1010PC and attached EM1000WZ, EM1000EM or EM1000GZ</li> <li>EM1010PC and attached EM1000WZ, EM1000EM or EM1000GZ</li>
<br>
<li>reading attached SCIVT devices</li> <li>reading attached SCIVT devices</li>
<br>
<li>reading attached M232 devices</li> <li>reading attached M232 devices</li>
<br>
<li>reading attached WS2000/WS25000 devices, also via raw network <li>reading attached WS2000/WS25000 devices, also via raw network
converters (xport)</li> converters (xport)</li>
<br>
<li>extract sensor data from IPWE networked weather data receiver</li> <li>extract sensor data from IPWE networked weather data receiver</li>
<br>
<li>Via an attached <a <li>Via an attached <a
href="http://owfs.org/index.php?page=usb-ds9490r">DS9490R</a> or <a href="http://owfs.org/index.php?page=usb-ds9490r">DS9490R</a> or <a
href="http://owfs.org/index.php?page=com-ds9097-passive">DS9097</a> href="http://owfs.org/index.php?page=com-ds9097-passive">DS9097</a>
access to the following sensors: DS18S20, DS1820, DS18B20</li> access to the following Dallas 1-wire sensors: DS18S20, DS1820,
<br> DS18B20</li>
<li>Via an attached KM271 access to the Buderus Logamatic 2107</li> <li>Via an attached KM271 access to the Buderus Logamatic 2107</li>
<li>Allnet devices: Allnet 3076, Temperatures sensors and Allnet 4027
relay box connected to an Allnet 4000</li>
<li>Davis VantagePro2 weatherstation</li>
<li>RFXCOM RF receivers/transmitters e.g for different Oregon Scientific
weather sensors. Tested: BTHR918N, THGR810, THR128, THWR288A,
WTGR800.</li>
<li>Via the ELV USB-WDE1 access to the S300/S555 family of sensors.</li>
</ul> </ul>
<a name="Documentation"></a> <a name="Documentation"></a>