From 41f271169b178fcbc88b8e448a3bdb4520d06fb2 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Sat, 3 Dec 2016 20:03:00 +0100 Subject: [PATCH] =?UTF-8?q?=C3=9Cnterst=C3=BCzuung=20f=C3=BCr=20Firmware?= =?UTF-8?q?=202.7.0,=20Unterst=C3=BCtzung=20f=C3=BCr=20minus=20Temperature?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 74_XiaomiFlowerSens.pm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/74_XiaomiFlowerSens.pm b/74_XiaomiFlowerSens.pm index 424a593..7a9b4ef 100644 --- a/74_XiaomiFlowerSens.pm +++ b/74_XiaomiFlowerSens.pm @@ -35,7 +35,7 @@ use POSIX; use JSON; use Blocking; -my $version = "0.2.4"; +my $version = "0.2.6"; @@ -219,10 +219,10 @@ sub XiaomiFlowerSens($) { my $wfr; - if( ReadingsVal($name, "firmware", 0) eq "2.6.6" ) { - $wfr = 1; - } else { + if( ReadingsVal($name, "firmware", 0) eq "2.6.2" ) { $wfr = 0; + } else { + $wfr = 1; } BlockingKill($hash->{helper}{RUNNING_PID}) if(defined($hash->{helper}{RUNNING_PID})); @@ -287,9 +287,15 @@ sub XiaomiFlowerSens_gattCharRead($$$) { return (undef,undef,undef,undef) unless( defined($readData[0]) ); + my @data = split(" ",$readData[1]); - my $temp = hex("0x".$data[1].$data[0]); + my $temp; + if( $data[1] eq "ff" ) { + $temp = hex("0x".$data[1].$data[0]) - hex("0xffff"); + } else { + $temp = hex("0x".$data[1].$data[0]); + } my $lux = hex("0x".$data[4].$data[3]); my $moisture = hex("0x".$data[7]); my $fertility = hex("0x".$data[9].$data[8]);