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

Can't scan or connect to peripheral device without restarting Node-RED #49

Open contrabass22 opened 3 years ago

contrabass22 commented 3 years ago

Symptoms

  1. Checking "BLE Scanning" in a global Generic-BLE configuration node finds no devices after a long period of waiting. Unchecking, waiting a moment, and re-checking "BLE Scanning" exhibits the same behavior.
  2. Trying to connect to a peripheral device fails, and the nodes are in either the "error" or transition to the "missing" state.

Workaround Restart the Node-RED server. Subsequent attempts to scan or connect may succeed.

Details The following log occurred at the time of the failure:

[error] [GenericBLE:ERROR] Missing Bluetooth Object, Path:/org/bluez/hci0, Valid Paths:/org/bluez}, Error: Missing Bluetooth Object, Path:/org/bluez/hci0, Valid Paths:/org/bluez}
    at BluezBindings.init (/home/user/.node-red/node_modules/node-red-contrib-generic-ble/dist/noble/lib/bluez/noble/lib/bluez/bindings.js:182:19)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Note that this issue can be compounded with #40 where even after restarting Node-RED may require the workaround of unchecking and/or checking "BLE Scanning" in the global configuration node to fix the issue.

Steps to Reproduce This is an intermittent issue. There don't seem to be any unusual aspects of a flow to get this to occur. I've seen it happen on flows with different devices. All of them have an inject node to connect to a peripheral device. The GATT characteristics they read/write don't seem to affect the behavior.

Component Versions Platform: Linux armv7l (32-bit) Bluez: 5.54 Node.js: v10.16.3 Node-red-contrib-generic-ble: 4.0.3 Node RED: v1.2.9

Hardware Bluetooth adapter: TPLINK UB400 Peripheral Device: TI Sensor Tag CC2650STK