From 6d3abab701d92d419007f694199025f85187ce3a Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Tue, 2 Jan 2018 10:38:42 +0000 Subject: [PATCH] 74_XiaomiFlowerSens: fix Problems with sshHost Methode git-svn-id: https://svn.fhem.de/fhem/trunk@15750 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/74_XiaomiFlowerSens.pm | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 24a621bcd..addb77737 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. + - change: 74_XiaomiFlowerSens: fix Problems with sshHost Methode - change: 73_GardenaSmartBridge/74_GardenaSmartDevice: add NotifyFn Support change AttrFn Routine - feature: 93_DbRep: V7.2.0, new attributes "seqDoubletsVariance", diff --git a/fhem/FHEM/74_XiaomiFlowerSens.pm b/fhem/FHEM/74_XiaomiFlowerSens.pm index 321116d15..12b8c26d1 100644 --- a/fhem/FHEM/74_XiaomiFlowerSens.pm +++ b/fhem/FHEM/74_XiaomiFlowerSens.pm @@ -47,7 +47,7 @@ use JSON; use Blocking; -my $version = "1.2.4"; +my $version = "1.4.0"; my %CallBatteryFirmwareAge = ( '8h' => 28800, '16h' => 57600, '24h' => 86400, @@ -438,6 +438,7 @@ sub XiaomiFlowerSens_ExecGatttool_Run($) { $cmd .= "--char-write-req -a $handle -n $value" if($gattCmd eq 'write'); $cmd .= " 2>&1 /dev/null"; $cmd .= "'" if($sshHost ne 'none'); + $cmd = "ssh $sshHost 'gatttool -i $hci -b $mac --char-write-req -a 0x33 -n A01F && gatttool -i $hci -b $mac --char-read -a 0x35 2>&1 /dev/null'" if($sshHost ne 'none' and $gattCmd eq 'write'); $loop = 0; do { @@ -451,6 +452,9 @@ sub XiaomiFlowerSens_ExecGatttool_Run($) { Log3 $name, 4, "XiaomiFlowerSens ($name) - ExecGatttool_Run: gatttool result ".join(",", @gtResult); + $handle = '0x35' if($sshHost ne 'none' and $gattCmd eq 'write'); + $gattCmd = 'read' if($sshHost ne 'none' and $gattCmd eq 'write'); + $gtResult[1] = 'no data response' unless( defined($gtResult[1]) ); @@ -663,7 +667,10 @@ sub XiaomiFlowerSens_ProcessingErrors($$) { sub XiaomiFlowerSens_encodeJSON($) { my $gtResult = shift; - + + + chomp($gtResult); + my %response = ( 'gtResult' => $gtResult );