diff --git a/fhem/CHANGED b/fhem/CHANGED index 3118e1b22..558f37a62 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 74_XiaomiFlowerSens: 0.6.3 fix blockingDone Routine - feature: 75_MSG: support for ReplaceSetMagic; msg command may now be used with texts containing [device:reading] to replace with found readings @@ -14,14 +15,14 @@ - bugfix: 10_EQ3BT: do not run parallel gatttool commands for same dev - feature: FB_CALLMONITOR: new set command "reopen" - feature: 66_ECMD: new attribute autoReopen - - update: 74_AMAD: Version 2.6.8 new feature sendSMS + - update: 74_AMAD: Version 2.6.8 new feature sendSMS - feature: 66_ECMD: new attribute autoReopen - - bugfix: 98_DOIFtools.pm: fixed bug from last change - - update: 98_DOIFtools.pm: some code rework - - update: 98_DOIFtools.pm: dynamic column width in report - - update: 98_DOIFtools.pm: add delete readings in other devices than DOIF - - update: 88_HMCCU.pm: version 3.9 - - update: 98_DOIFtools.pm: marking an eventline in DOIFs event monitor + - bugfix: 98_DOIFtools.pm: fixed bug from last change + - update: 98_DOIFtools.pm: some code rework + - update: 98_DOIFtools.pm: dynamic column width in report + - update: 98_DOIFtools.pm: add delete readings in other devices than DOIF + - update: 88_HMCCU.pm: version 3.9 + - update: 98_DOIFtools.pm: marking an eventline in DOIFs event monitor shows different representations of the event as operand for DOIF definitions - update: 73_NUKIBridge/74_NUKIDevice 0.6.0 Support for API v1.5 diff --git a/fhem/FHEM/74_XiaomiFlowerSens.pm b/fhem/FHEM/74_XiaomiFlowerSens.pm index 09b09098c..737dc0740 100644 --- a/fhem/FHEM/74_XiaomiFlowerSens.pm +++ b/fhem/FHEM/74_XiaomiFlowerSens.pm @@ -35,7 +35,7 @@ use POSIX; use JSON; use Blocking; -my $version = "0.6.0"; +my $version = "0.6.3"; @@ -63,15 +63,15 @@ sub XiaomiFlowerSens_Initialize($) { my ($hash) = @_; - $hash->{SetFn} = "XiaomiFlowerSens_Set"; - $hash->{DefFn} = "XiaomiFlowerSens_Define"; - $hash->{UndefFn} = "XiaomiFlowerSens_Undef"; - $hash->{AttrFn} = "XiaomiFlowerSens_Attr"; - $hash->{AttrList} = "interval ". - "disable:1 ". - "hciDevice:hci0,hci1,hci2 ". - "disabledForIntervals ". - $readingFnAttributes; + $hash->{SetFn} = "XiaomiFlowerSens_Set"; + $hash->{DefFn} = "XiaomiFlowerSens_Define"; + $hash->{UndefFn} = "XiaomiFlowerSens_Undef"; + $hash->{AttrFn} = "XiaomiFlowerSens_Attr"; + $hash->{AttrList} = "interval ". + "disable:1 ". + "hciDevice:hci0,hci1,hci2 ". + "disabledForIntervals ". + $readingFnAttributes; @@ -89,10 +89,10 @@ sub XiaomiFlowerSens_Define($$) { return "too few parameters: define XiaomiFlowerSens " if( @a != 3 ); - my $name = $a[0]; - my $mac = $a[2]; + my $name = $a[0]; + my $mac = $a[2]; - $hash->{BTMAC} = $mac; + $hash->{BTMAC} = $mac; $hash->{VERSION} = $version; $hash->{INTERVAL} = 300; @@ -125,6 +125,7 @@ sub XiaomiFlowerSens_Undef($$) { RemoveInternalTimer($hash); + BlockingKill($hash->{helper}{RUNNING_PID}) if(defined($hash->{helper}{RUNNING_PID})); delete($modules{XiaomiFlowerSens}{defptr}{$mac}); Log3 $name, 3, "Sub XiaomiFlowerSens_Undef ($name) - delete device $name"; @@ -134,9 +135,9 @@ sub XiaomiFlowerSens_Undef($$) { sub XiaomiFlowerSens_Attr(@) { my ( $cmd, $name, $attrName, $attrVal ) = @_; - my $hash = $defs{$name}; + my $hash = $defs{$name}; - my $orig = $attrVal; + my $orig = $attrVal; if( $attrName eq "disable" ) { @@ -227,8 +228,8 @@ sub XiaomiFlowerSens_stateRequestTimer($) { sub XiaomiFlowerSens_Set($$@) { - my ($hash, $name, @aa) = @_; - my ($cmd, $arg) = @aa; + my ($hash, $name, @aa) = @_; + my ($cmd, $arg) = @aa; my $action; if( $cmd eq 'statusRequest' ) { @@ -257,7 +258,6 @@ sub XiaomiFlowerSens_Run($) { $wfr = 1; } - BlockingKill($hash->{helper}{RUNNING_PID}) if(defined($hash->{helper}{RUNNING_PID})); my $response_encode = XiaomiFlowerSens_forRun_encodeJSON($mac,$wfr); @@ -287,7 +287,8 @@ sub XiaomiFlowerSens_BlockingRun($) { Log3 $name, 4, "Sub XiaomiFlowerSens_BlockingRun ($name) - Processing response data: $sensData"; - return "$name|$sensData" # if error in stdout the error will given to $lux variable + + return "$name|Unknown Error, look at verbose 5 output" # if error in stdout the error will given to $sensData variable unless( defined($batFwData) ); @@ -295,30 +296,30 @@ sub XiaomiFlowerSens_BlockingRun($) { #### processing sensor respons - my @dataSensor = split(" ",$sensData); + my @dataSensor = split(" ",$sensData); return "$name|charWrite faild" unless( $dataSensor[0] ne "aa" and $dataSensor[1] ne "bb" and $dataSensor[2] ne "cc" and $dataSensor[3] ne "dd" and $dataSensor[4] ne "ee" and $dataSensor[5] ne "ff"); my $temp; if( $dataSensor[1] eq "ff" ) { - $temp = hex("0x".$dataSensor[1].$dataSensor[0]) - hex("0xffff"); + $temp = hex("0x".$dataSensor[1].$dataSensor[0]) - hex("0xffff"); } else { - $temp = hex("0x".$dataSensor[1].$dataSensor[0]); + $temp = hex("0x".$dataSensor[1].$dataSensor[0]); } - my $lux = hex("0x".$dataSensor[4].$dataSensor[3]); - my $moisture = hex("0x".$dataSensor[7]); - my $fertility = hex("0x".$dataSensor[9].$dataSensor[8]); + my $lux = hex("0x".$dataSensor[4].$dataSensor[3]); + my $moisture = hex("0x".$dataSensor[7]); + my $fertility = hex("0x".$dataSensor[9].$dataSensor[8]); ### processing firmware and battery response - my @dataBatFw = split(" ",$batFwData); + my @dataBatFw = split(" ",$batFwData); - my $blevel = hex("0x".$dataBatFw[0]); - my $fw = ($dataBatFw[2]-30).".".($dataBatFw[4]-30).".".($dataBatFw[6]-30); + my $blevel = hex("0x".$dataBatFw[0]); + my $fw = ($dataBatFw[2]-30).".".($dataBatFw[4]-30).".".($dataBatFw[6]-30); @@ -359,8 +360,10 @@ sub XiaomiFlowerSens_callGatttool($@) { if($wfr == 1) { do { - $wresp = qx(gatttool -i $hci -b $mac --char-write-req -a 0x33 -n A01F) if($wfr == 1); + $wresp = qx(gatttool -i $hci -b $mac --char-write-req -a 0x33 -n A01F 2>&1 /dev/null) if($wfr == 1); $loop++; + Log3 $name, 4, "Sub XiaomiFlowerSens_callGatttool ($name) - call gatttool charWrite loop $loop"; + Log3 $name, 4, "Sub XiaomiFlowerSens_callGatttool ($name) - charWrite wresp: $wresp" if(defined($wresp)); } while( ($loop < 10) and (not defined($wresp)) ); } @@ -369,11 +372,12 @@ sub XiaomiFlowerSens_callGatttool($@) { do { @readSensData = split(": ",qx(gatttool -i $hci -b $mac --char-read -a 0x35 2>&1 /dev/null)); - Log3 $name, 4, "Sub XiaomiFlowerSens_callGatttool ($name) - call gatttool charRead loop $loop"; $loop++; + Log3 $name, 4, "Sub XiaomiFlowerSens_callGatttool ($name) - call gatttool charRead loop $loop"; } while( $loop < 10 and $readSensData[0] =~ /connect error/ ); + Log3 $name, 4, "Sub XiaomiFlowerSens_callGatttool ($name) - processing gatttool response. sensData[0]: $readSensData[0]"; Log3 $name, 4, "Sub XiaomiFlowerSens_callGatttool ($name) - processing gatttool response. sensData: $readSensData[1]"; return ($readSensData[1],undef) @@ -384,7 +388,7 @@ sub XiaomiFlowerSens_callGatttool($@) { do { - @readBatFwData = split(": ",qx(gatttool -i $hci -b $mac --char-read -a 0x38 2>&1 /dev/null)); + @readBatFwData = split(": ",qx(gatttool -i $hci -b $mac --char-read -a 0x38 2>&1 /dev/null)); Log3 $name, 4, "Sub XiaomiFlowerSens ($name) - call gatttool readBatFw loop $loop"; $loop++; @@ -432,9 +436,9 @@ sub XiaomiFlowerSens_forDone_encodeJSON($$$$$$) { sub XiaomiFlowerSens_BlockingDone($) { - my ($string) = @_; - my ($name,$response) = split("\\|",$string); - my $hash = $defs{$name}; + my ($string) = @_; + my ($name,$response) = split("\\|",$string); + my $hash = $defs{$name}; delete($hash->{helper}{RUNNING_PID}); @@ -455,6 +459,13 @@ sub XiaomiFlowerSens_BlockingDone($) { readingsEndUpdate($hash,1); return undef; + } elsif( $response eq "Unknown Error, look at verbose 5 output" ) { + + readingsBulkUpdate($hash,"lastGattError","$response"); + readingsBulkUpdate($hash,"state","unreachable"); + readingsEndUpdate($hash,1); + return undef; + } elsif( ref($response) eq "HASH" ) { readingsBulkUpdate($hash,"lastGattError","$response"); readingsBulkUpdate($hash,"state","unreachable"); @@ -482,8 +493,8 @@ sub XiaomiFlowerSens_BlockingDone($) { sub XiaomiFlowerSens_BlockingAborted($) { - my ($hash) = @_; - my $name = $hash->{NAME}; + my ($hash) = @_; + my $name = $hash->{NAME}; delete($hash->{helper}{RUNNING_PID}); readingsSingleUpdate($hash,"state","unreachable", 1);