From ea67f2fcca29e6e016488432245f2f93596a5415 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 2 Jan 2018 11:36:30 +0100 Subject: [PATCH] fix sshHost fetch with Errors --- 74_XiaomiFlowerSens.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/74_XiaomiFlowerSens.pm b/74_XiaomiFlowerSens.pm index 6596925..12b8c26 100644 --- a/74_XiaomiFlowerSens.pm +++ b/74_XiaomiFlowerSens.pm @@ -47,7 +47,7 @@ use JSON; use Blocking; -my $version = "1.2.5"; +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]) );