fix humidity bug

This commit is contained in:
Marko Oldenburg 2018-10-20 21:56:39 +02:00
parent 998eaa9fdb
commit 80db5b35f6

View File

@ -35,7 +35,7 @@ package main;
use strict; use strict;
use warnings; use warnings;
my $version = "2.4.0"; my $version = "2.4.2";
sub XiaomiBTLESens_Initialize($) { sub XiaomiBTLESens_Initialize($) {
@ -100,7 +100,7 @@ BEGIN {
modules modules
Log3 Log3
CommandAttr CommandAttr
attr # attr
AttrVal AttrVal
ReadingsVal ReadingsVal
IsDisabled IsDisabled
@ -886,14 +886,13 @@ sub ThermoHygroSensHandle0x10($$) {
my @numberOfHex = split( ' ', $notification ); my @numberOfHex = split( ' ', $notification );
$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, 16, 8 ) ); $readings{'humidity'} = pack( 'H*', substr( $notification, 18, 8 ) );
} }
else { else {
$readings{'humidity'} = pack( 'H*', substr( $notification, 18, 8 ) ); $readings{'humidity'} = pack( 'H*', substr( $notification, 16, 8 ) );
} }
$hash->{helper}{CallBattery} = 0; $hash->{helper}{CallBattery} = 0;