fix humidity

This commit is contained in:
Marko Oldenburg 2018-10-25 08:58:50 +02:00
parent dfb3e9e1a3
commit e4016fae82

View File

@ -35,7 +35,7 @@ package main;
use strict; use strict;
use warnings; use warnings;
my $version = "2.4.3"; my $version = "2.4.4";
sub XiaomiBTLESens_Initialize($) { sub XiaomiBTLESens_Initialize($) {
@ -860,7 +860,7 @@ sub ThermoHygroSensHandle0x18($$) {
Log3 $name, 4, "XiaomiBTLESens ($name) - Thermo/Hygro Sens Handle0x18"; Log3 $name, 4, "XiaomiBTLESens ($name) - Thermo/Hygro Sens Handle0x18";
chomp($notification); chomp($notification);
$notification =~ s/ //g; $notification =~ s/\s+//g;
### neue Vereinheitlichung für Batteriereadings Forum #800017 ### neue Vereinheitlichung für Batteriereadings Forum #800017
$readings{'batteryPercent'} = hex( "0x" . $notification ); $readings{'batteryPercent'} = hex( "0x" . $notification );
@ -889,12 +889,12 @@ sub ThermoHygroSensHandle0x10($$) {
$notification =~ s/\s+//g; $notification =~ s/\s+//g;
$readings{'temperature'} = pack( 'H*', substr( $notification, 4, 8 ) ); $readings{'temperature'} = pack( 'H*', substr( $notification, 4, 8 ) );
if ( scalar(@numberOfHex) < 14 ) { # if ( scalar(@numberOfHex) < 14 ) {
$readings{'humidity'} = pack( 'H*', substr( $notification, 18, 8 ) ); $readings{'humidity'} = pack( 'H*', substr( $notification, 18, 8 ) );
} # }
else { # else {
$readings{'humidity'} = pack( 'H*', substr( $notification, 16, 8 ) ); # $readings{'humidity'} = pack( 'H*', substr( $notification, 16, 8 ) );
} # }
$hash->{helper}{CallBattery} = 0; $hash->{helper}{CallBattery} = 0;
return \%readings; return \%readings;