change gatttresult then --list
This commit is contained in:
parent
0796690559
commit
5953b7e288
@ -47,7 +47,7 @@ use JSON;
|
|||||||
use Blocking;
|
use Blocking;
|
||||||
|
|
||||||
|
|
||||||
my $version = "2.0.6debug5";
|
my $version = "2.0.6debug7";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -409,14 +409,14 @@ sub XiaomiBTLESens_CreateParamGatttool($@) {
|
|||||||
Log3 $name, 4, "XiaomiBTLESens ($name) - Run CreateParamGatttool with mod: $mod";
|
Log3 $name, 4, "XiaomiBTLESens ($name) - Run CreateParamGatttool with mod: $mod";
|
||||||
|
|
||||||
if( $mod eq 'read' ) {
|
if( $mod eq 'read' ) {
|
||||||
$hash->{helper}{RUNNING_PID} = BlockingCall("XiaomiBTLESens_ExecGatttool_Run", $name."|".$mac."|".$mod."|".$handle, "XiaomiBTLESens_ExecGatttool_Done", 90, "XiaomiBTLESens_ExecGatttool_Aborted", $hash) unless( exists($hash->{helper}{RUNNING_PID}) );
|
$hash->{helper}{RUNNING_PID} = BlockingCall("XiaomiBTLESens_ExecGatttool_Run", $name."|".$mac."|".$mod."|".$handle, "XiaomiBTLESens_ExecGatttool_Done", 60, "XiaomiBTLESens_ExecGatttool_Aborted", $hash) unless( exists($hash->{helper}{RUNNING_PID}) );
|
||||||
|
|
||||||
readingsSingleUpdate($hash,"state","read sensor data",1);
|
readingsSingleUpdate($hash,"state","read sensor data",1);
|
||||||
|
|
||||||
Log3 $name, 5, "XiaomiBTLESens ($name) - Read XiaomiBTLESens_ExecGatttool_Run $name|$mac|$mod|$handle";
|
Log3 $name, 5, "XiaomiBTLESens ($name) - Read XiaomiBTLESens_ExecGatttool_Run $name|$mac|$mod|$handle";
|
||||||
|
|
||||||
} elsif( $mod eq 'write' ) {
|
} elsif( $mod eq 'write' ) {
|
||||||
$hash->{helper}{RUNNING_PID} = BlockingCall("XiaomiBTLESens_ExecGatttool_Run", $name."|".$mac."|".$mod."|".$handle."|".$value, "XiaomiBTLESens_ExecGatttool_Done", 90, "XiaomiBTLESens_ExecGatttool_Aborted", $hash) unless( exists($hash->{helper}{RUNNING_PID}) );
|
$hash->{helper}{RUNNING_PID} = BlockingCall("XiaomiBTLESens_ExecGatttool_Run", $name."|".$mac."|".$mod."|".$handle."|".$value, "XiaomiBTLESens_ExecGatttool_Done", 60, "XiaomiBTLESens_ExecGatttool_Aborted", $hash) unless( exists($hash->{helper}{RUNNING_PID}) );
|
||||||
|
|
||||||
readingsSingleUpdate($hash,"state","write sensor data",1);
|
readingsSingleUpdate($hash,"state","write sensor data",1);
|
||||||
|
|
||||||
@ -467,14 +467,15 @@ sub XiaomiBTLESens_ExecGatttool_Run($) {
|
|||||||
$cmd .= "--char-write-req -a $handle -n $value" if($gattCmd eq 'write');
|
$cmd .= "--char-write-req -a $handle -n $value" if($gattCmd eq 'write');
|
||||||
$cmd .= " 2>&1 /dev/null";
|
$cmd .= " 2>&1 /dev/null";
|
||||||
$cmd .= "'" if($sshHost ne 'none');
|
$cmd .= "'" if($sshHost ne 'none');
|
||||||
$cmd = "ssh $sshHost 'timeout 15 gatttool -i $hci -b $mac --char-write-req -a $handle -n $value --listen 2>&1 /dev/null'" if( AttrVal($name,"model","none") eq 'thermoHygroSens' and $gattCmd eq 'write' and $handle eq '0x10');
|
$cmd = "ssh $sshHost 'timeout 5 gatttool -i $hci -b $mac --char-write-req -a $handle -n $value --listen 2>&1 /dev/null'" if( AttrVal($name,"model","none") eq 'thermoHygroSens' and $gattCmd eq 'write' and $handle eq '0x10');
|
||||||
$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' and AttrVal($name,"model","none") eq 'flowerSens');
|
$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' and AttrVal($name,"model","none") eq 'flowerSens');
|
||||||
|
|
||||||
$loop = 0;
|
$loop = 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
Log3 $name, 5, "XiaomiBTLESens ($name) - ExecGatttool_Run: call gatttool with command $cmd and loop $loop";
|
Log3 $name, 5, "XiaomiBTLESens ($name) - ExecGatttool_Run: call gatttool with command $cmd and loop $loop";
|
||||||
@gtResult = split(": ",qx($cmd));
|
@gtResult = split(": ",qx($cmd)) unless( AttrVal($name,"model","none") eq 'thermoHygroSens' and $gattCmd eq 'write' and $handle eq '0x10');
|
||||||
|
@gtResult = split(",",qx($cmd)) if( AttrVal($name,"model","none") eq 'thermoHygroSens' and $gattCmd eq 'write' and $handle eq '0x10');
|
||||||
Log3 $name, 5, "XiaomiBTLESens ($name) - ExecGatttool_Run: gatttool loop result ".join(",", @gtResult);
|
Log3 $name, 5, "XiaomiBTLESens ($name) - ExecGatttool_Run: gatttool loop result ".join(",", @gtResult);
|
||||||
$loop++;
|
$loop++;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user