mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
state bug fix
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@4363 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1d667437f1
commit
adc6798c16
@ -176,6 +176,14 @@ LaCrosse_Parse($$)
|
||||
if( $type == 0x00 ) {
|
||||
$channel = "" if( $channel == 1 );
|
||||
|
||||
if( my $resolution = AttrVal( $rname, "resolution", 0 ) ) {
|
||||
$temperature = int($temperature*10 / $resolution + 0.5) * $resolution / 10;
|
||||
$humidity = int($humidity / $resolution + 0.5) * $resolution;
|
||||
|
||||
$temperature = int($temperature*10 + 0.5) / 10;
|
||||
$humidity = int($humidity + 0.5) / 10;
|
||||
}
|
||||
|
||||
if( AttrVal( $rname, "doAverage", 0 ) ) {
|
||||
$humidity = ($rhash->{"previousH$channel"}*3+$humidity)/4;
|
||||
$temperature = ($rhash->{"previousT$channel"}*3+$temperature)/4;
|
||||
@ -187,13 +195,6 @@ LaCrosse_Parse($$)
|
||||
|
||||
readingsBeginUpdate($rhash);
|
||||
|
||||
my $temperature = $temperature;
|
||||
my $resolution = AttrVal( $rname, "resolution", 0 );
|
||||
if( $resolution ) {
|
||||
$temperature = int($temperature*10 / $resolution + 0.5) * $resolution / 10;
|
||||
$humidity = int($humidity / $resolution + 0.5) * $resolution;
|
||||
}
|
||||
|
||||
readingsBulkUpdate($rhash, "temperature$channel", $temperature);
|
||||
readingsBulkUpdate($rhash, "humidity$channel", $humidity) if( $humidity && $humidity <= 99 );
|
||||
|
||||
@ -207,7 +208,7 @@ LaCrosse_Parse($$)
|
||||
if( !$channel ) {
|
||||
my $state = "T: $temperature";
|
||||
$state .= " H: $humidity" if( $humidity && $humidity <= 99 );
|
||||
$state .= " D: $humidity" if( $dewpoint );
|
||||
$state .= " D: $dewpoint" if( $dewpoint );
|
||||
readingsBulkUpdate($rhash, "state", $state) if( Value($rname) ne $state );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user