CANDY-LINE / node-red-contrib-generic-ble

A Node-RED node set for providing access to generic BLE peripheral GATT characteristics.
Apache License 2.0
24 stars 22 forks source link

Neither tool works and nothing in hcitrace #31

Closed mypi-home closed 4 years ago

mypi-home commented 4 years ago

Hi there,

I have been unable to get these tools to work after many hours of trying.

I am able to use Gatttool interactive mode (non interactive mode doesnt work) and connect to my BLE device, read data and control it so I have validated the handles and UUIDs I am using.

My first issue like other have experienced is that Node did not have access to the bluetooth driver - I could not see anything listed under the scans just a stop sign. So I needed to execute this command and then I was able to see devices (you should probably add this to your instructions?):

sudo setcap cap_net_raw+eip $(eval readlink -fwhich node)

Now that I can see and setup devices from the scan list it still doesnt seem to be communicating with them. If I try to retrieve a specific property it just always says nothing to read.

28 Apr 12:20:17 - [warn] [Generic BLE in:371911e.c749aee] <02762c3b5257> Nothing to read

If I leave Topic blank it retrieves some information but this is not recognisable to me:

object
uuid: "02762c3bxx57"
characteristics: object
fe51: buffer[6]
0: 0x2
1: 0x76
2: 0x2c
3: 0x3b
4: 0x52
5: 0x57

In syslog I can see this happens just before:

Apr 28 12:19:39 raspberrypi Node-RED[2861]: 28 Apr 12:19:39 - [info] [GenericBLE] Start BLE scanning
Apr 28 12:19:39 raspberrypi Node-RED[2861]: 28 Apr 12:19:39 - [info] Started modified flows
Apr 28 12:20:16 raspberrypi kernel: [10100.101637] Bluetooth: hci0: unexpected event for opcode 0x2016
Apr 28 12:20:17 raspberrypi Node-RED[2861]: 28 Apr 12:20:17 - [warn] [Generic BLE in:371911e.c749aee] <02762c3b5257> Nothing to read

In hcitrace I see nothing at all after the initial scan when node starts.

If I try to use to GenericBLE out tool with this json it also does not do anything, no error messages, nothing in syslog or hcitrace.

{
    "0000fe5100001000800000805f9b34fb": "00ff00009a0d0164f2",
    "writeWithoutResponse": true
}

It also doesn't work without the: "writeWithoutResponse": true

I am using Bluez 5.50 on Raspberry Pi 3b+

[info] Node-RED version: v1.0.3
[info] Node.js  version: v10.15.2
[info] Linux 4.19.58-v7+ arm LE

Please can you help as I really want to get this working.

In your readme you advise using "Set GENERIC_BLE_TRACE=true on starting Node-RED" - can you advise how and where to actually do this as maybe I am doing it wrong. I just executed in command prompt.

Thanks Chris.

dbaba commented 4 years ago

It seems the node failed to find the given UUID of the characteristic to read. You can find all characteristics in the trace log when trace log is enabled. In order to enable it, you can run the following command:

 # Go to the node-red source code project root dir
$ cd /path/to/your/node-red

# prepend "GENERIC_BLE_TRACE=true" to "node" command
$ GENERIC_BLE_TRACE=true node red
dbaba commented 4 years ago

Re-open it when you have update.