mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 13:26:02 +00:00
36_LaCrosseGateway.pm, 36_LaCrosse.pm: prepared for IAQ and pressure decimals
git-svn-id: https://svn.fhem.de/fhem/trunk@15263 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
adb1743e25
commit
09edc21778
@ -168,7 +168,7 @@ sub LaCrosse_Parse($$) {
|
|||||||
my ($hash, $msg) = @_;
|
my ($hash, $msg) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
my( @bytes, $addr, $typeNumber, $typeName, $battery_new, $battery_low, $error, $type, $channel, $temperature, $humidity, $windDirection, $windSpeed, $windGust, $rain, $pressure );
|
my( @bytes, $addr, $typeNumber, $typeName, $battery_new, $battery_low, $error, $type, $channel, $temperature, $humidity, $windDirection, $windSpeed, $windGust, $rain, $pressure, $iaq );
|
||||||
$temperature = 0xFFFF;
|
$temperature = 0xFFFF;
|
||||||
$humidity = 0xFF;
|
$humidity = 0xFF;
|
||||||
$windDirection = 0xFFFF;
|
$windDirection = 0xFFFF;
|
||||||
@ -176,6 +176,7 @@ sub LaCrosse_Parse($$) {
|
|||||||
$windGust = 0xFFFF;
|
$windGust = 0xFFFF;
|
||||||
$rain = 0xFFFF;
|
$rain = 0xFFFF;
|
||||||
$pressure = 0xFFFF;
|
$pressure = 0xFFFF;
|
||||||
|
$iaq = 0xFFFF;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if( $msg =~ m/^OK 9/ ) {
|
if( $msg =~ m/^OK 9/ ) {
|
||||||
@ -313,6 +314,11 @@ sub LaCrosse_Parse($$) {
|
|||||||
|
|
||||||
if(@bytes > 15 && $bytes[14] != 0xFF) {
|
if(@bytes > 15 && $bytes[14] != 0xFF) {
|
||||||
$pressure = $bytes[14] * 256 + $bytes[15];
|
$pressure = $bytes[14] * 256 + $bytes[15];
|
||||||
|
$pressure /= 10.0 if $pressure > 5000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(@bytes > 17 && $bytes[16] != 0xFF) {
|
||||||
|
$iaq = $bytes[16] * 256 + $bytes[17];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -531,6 +537,10 @@ sub LaCrosse_Parse($$) {
|
|||||||
readingsBulkUpdate($rhash, "pressure", $pressure );
|
readingsBulkUpdate($rhash, "pressure", $pressure );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($typeNumber > 0 && $iaq != 0xFFFF) {
|
||||||
|
readingsBulkUpdate($rhash, "iaq", $iaq );
|
||||||
|
}
|
||||||
|
|
||||||
readingsEndUpdate($rhash,1);
|
readingsEndUpdate($rhash,1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -522,6 +522,7 @@ sub LaCrosseGateway_DeleteOwnSensorsReadings($) {
|
|||||||
delete $hash->{READINGS}{"temperature"};
|
delete $hash->{READINGS}{"temperature"};
|
||||||
delete $hash->{READINGS}{"humidity"};
|
delete $hash->{READINGS}{"humidity"};
|
||||||
delete $hash->{READINGS}{"pressure"};
|
delete $hash->{READINGS}{"pressure"};
|
||||||
|
delete $hash->{READINGS}{"iaq"};
|
||||||
}
|
}
|
||||||
|
|
||||||
#=======================================================================================
|
#=======================================================================================
|
||||||
@ -536,6 +537,7 @@ sub LaCrosseGateway_HandleOwnSensors($$) {
|
|||||||
my $temperature = undef;
|
my $temperature = undef;
|
||||||
my $humidity = undef;
|
my $humidity = undef;
|
||||||
my $pressure = undef;
|
my $pressure = undef;
|
||||||
|
my $iaq = undef;
|
||||||
|
|
||||||
if($bytes[2] != 0xFF) {
|
if($bytes[2] != 0xFF) {
|
||||||
$temperature = ($bytes[2]*256 + $bytes[3] - 1000)/10;
|
$temperature = ($bytes[2]*256 + $bytes[3] - 1000)/10;
|
||||||
@ -549,9 +551,15 @@ sub LaCrosseGateway_HandleOwnSensors($$) {
|
|||||||
|
|
||||||
if(@bytes > 15 && $bytes[14] != 0xFF) {
|
if(@bytes > 15 && $bytes[14] != 0xFF) {
|
||||||
$pressure = $bytes[14] * 256 + $bytes[15];
|
$pressure = $bytes[14] * 256 + $bytes[15];
|
||||||
|
$pressure /= 10.0 if $pressure > 5000;
|
||||||
readingsBulkUpdate($hash, "pressure", $pressure);
|
readingsBulkUpdate($hash, "pressure", $pressure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(@bytes > 17 && $bytes[16] != 0xFF) {
|
||||||
|
$iaq = $bytes[16] * 256 + $bytes[17];
|
||||||
|
readingsBulkUpdate($hash, "iaq", $iaq);
|
||||||
|
}
|
||||||
|
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
|
|
||||||
delete $hash->{READINGS}{"temperature"} if !$temperature;
|
delete $hash->{READINGS}{"temperature"} if !$temperature;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user