36_Level.pm: added sensor type 1 (for hydrostatic)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19749 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
HCS 2019-06-30 17:16:51 +00:00
parent 35c9fef6fb
commit b31a25e402

View File

@ -152,13 +152,21 @@ Level_Parse($$)
push(@list, $rname);
$rhash->{Level_lastRcv} = TimeNow();
$rhash->{SensorType} = $type;
readingsBeginUpdate($rhash);
my $litresPerCm = AttrVal( $rname, "litersPerCm", 1);
my $distanceToBottom = AttrVal( $rname, "distanceToBottom", 100);
my $level = $distanceToBottom - $distance;
my $level = -273;
if($type eq 1) {
$level = $distance;
}
else {
$level = $distanceToBottom - $distance;
}
my $litres = 0;
my $formula = AttrVal( $rname, "formula", undef);
@ -178,7 +186,9 @@ Level_Parse($$)
$litres = int($litres);
readingsBulkUpdate($rhash, "distance", $distance);
if($type ne 1) {
readingsBulkUpdate($rhash, "distance", $distance);
}
readingsBulkUpdate($rhash, "level", $level);
readingsBulkUpdate($rhash, "liters", $litres);
readingsBulkUpdate($rhash, "temperature", $temperature);