2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-25 22:09:21 +00:00

14_CUL_WS: pressure check by HomeAuto_User (Forum #80216)

git-svn-id: https://svn.fhem.de/fhem/trunk@15513 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-11-28 10:43:51 +00:00
parent d481b28f0d
commit d86afd5918

View File

@ -291,23 +291,32 @@ CUL_WS_Parse($$)
Log3 $name, 4, "CUL_WS $devtype $name: $val";
# Sanity checks
if($NotifyTemperature &&
$hash->{READINGS}{temperature} &&
$hash->{READINGS}{temperature}{VAL}) {
my $tval = $hash->{READINGS}{strangetemp} ?
$hash->{READINGS}{strangetemp}{VAL} :
$hash->{READINGS}{temperature}{VAL};
if($NotifyTemperature && ReadingsVal($name, "temperature", undef)) {
my $tval = ReadingsVal($name, "strangetemp",
ReadingsVal($name, "temperature", undef));
my $diff = ($NotifyTemperature - $tval)+0;
if($diff < -15.0 || $diff > 15.0) {
Log3 $name, 2,
"$name: Temp difference ($diff) too large: $val, skipping it";
$hash->{READINGS}{strangetemp}{VAL} = $NotifyTemperature;
$hash->{READINGS}{strangetemp}{TIME} = TimeNow();
readingsSingleUpdate($name, "strangetemp", $NotifyTemperature, 0);
return "";
}
}
delete $hash->{READINGS}{strangetemp} if($hash->{READINGS});
if($NotifyPressure && ReadingsVal($name, "pressure", undef)) {
my $tval = ReadingsVal($name, "strangepress",
ReadingsVal($name, "pressure", undef));
my $diff = ($NotifyPressure - $tval)+0;
if($diff < -10.0 || $diff > 10.0) {
Log3 $name, 2,
"$name: Pressure difference ($diff) too large: $val, skipping it";
readingsSingleUpdate($name, "strangepress", $NotifyPressure, 0);
return "";
}
}
delete $hash->{READINGS}{strangepress} if($hash->{READINGS});
if(defined($hum) && ($hum < 0 || $hum > 100)) {
Log3 $name, 1, "BOGUS: $name reading: $val, skipping it";
return "";