GithubHelp home page GithubHelp logo

candy-line / node-red-contrib-generic-ble Goto Github PK

View Code? Open in Web Editor NEW
24.0 5.0 22.0 4.09 MB

A Node-RED node set for providing access to generic BLE peripheral GATT characteristics.

License: Apache License 2.0

JavaScript 76.98% HTML 23.02%
node-red ble gatt peripheral gatttool bluez bluez-dbus raspberry-pi-3

node-red-contrib-generic-ble's Introduction

node-red-contrib-generic-ble

GitHub release master Build Status

A Node-RED node set for providing access to generic BLE peripheral GATT characteristics.

As of v4.0.0, this node is optmized for Linux with BlueZ 5 D-Bus API (HCI socket is no longer used on Linux). The node should still work on macOS and Windows as nothing is modified for these platforms.

Supported operations are as follows:

  • Start BLE Scanning
  • Stop BLE Scanning
  • Restart BLE Scanning (Stop then start BLE Scanning again)
  • Connect to a peripheral device
  • Disonnect from a peripheral device
  • Read
  • Write
  • Write without Response
  • Notify (Subscribing the Notify events)

The node status modes are as follows:

  • missing the configured BLE peripheral device is missing. When the device is discovered, the state transitions to disconnected. The disconnected device may transiton to missing again when RSSI is invalidated (Linux only)
  • disconnected when the configured BLE peripheral device is found but not conncted
  • connecting when the configured BLE peripheral device is being connected
  • connected when the configured BLE peripheral device is connected
  • disconnecting when the configured BLE peripheral device is being disconnected
  • error when unexpected error occurs

Known issues for Linux BlueZ D-Bus API:

  • Unlike the older version, you must set the process owner's permission properly and manually. Non-root user's Node-RED process will fail to get this node working. Read Installation Note (Linux) below.
  • It seems the local name in advertisement packet isn't transferred to LocalName property in org.bluez.Device1 BlueZ D-Bus API. With the HCI socket implementaion, the local name was resolved. So the local name can be resolved on macOS and Windows.
  • Bluetooth: hci0: hardware error 0x03 error sometimes occurs (and logged in syslog). When it's observed, all devices are disconnected and cahches are gone. The node tries to power on the BLE adapter again.

How to use

How to configure a new BLE peripheral device

At first, drag either a Generic BLE in node or a Generic BLE out node to the workspace from the node palette and double-click the node. And you can find the following dialog. Here, click the pencil icon (1) to add a new BLE peripheral or edit the existing one.

ble out node

Then the new config node dialog appears as shown below.

The BLE Scanning shows whether or not BLE scanning is going on. In order to start BLE scanning, check it (2).

ble config node

As soon as you check it, Scan Result select box and Apply button appear. The scan results are automatically fufilled in the select box. The content will be refreshed every 10 seconds.

ble config node

Chosoe one of the listed devices and then click Apply to populate Local Name, MAC and UUID input text boxes. Clicking Apply button also triggers GATT characteristics discovery as well.

The following picure shows the Apply button clicking results. GATT Characteristics has a characteristic list of the selected device. When you see (not available) message in the box, check if the device is NOT sleeping (a sleeping device fails to respond to a connect request) and click Apply again.

GATT Characteristics must be populated as the node uses the list to verify if a given characteristic UUID is valid on performing Read, Write and Subscribe requests.

Click Add (3) to save the information when everything is OK.

ble config node

Now back to Generic BLE out node. Click Done (4) to finish the Generic BLE out node settings.

ble config node

You can also import an example flow from the menu icon() > Import > Examples > node-red-contrib-generic-ble > 01-read-write for learning more about this node.

How to translate gatttool command into flow

In this example, we show how to describe gatttool commands for characteristic value write and read with Generic BLE nodes.

NOTICE: As of BlueZ 5, gatttool is deprecated. gatttool will be removed in the future relesase.

Characteristics Value Write

The following simple command line just issues a characteristic write request to the handle 0x0027, which the BLE peripheral associates with the characteristic uuid f000aa02-0451-4000-b000-000000000000(uuids and handles can be listed by gatttool -b 88:99:00:00:FF:FF --characteristics command).

$ gatttool -b 88:99:00:00:FF:FF --char-write-req --handle=0x0027 --value=ca
Characteristic value was written successfully

In this tutorial, we translate the above command into Node-RED flow.

First of all, we use the following nodes.

  1. inject node to trigger a write request
  2. Generic BLE out node to perform the write request

gatttool

So the first step to create a flow is to place the above nodes on the workspace and connect them as shown above.

Next, open the inject dialog so that you can provide the write request parameters, the characteristic uuid and the value.

Important!) Unlike gatttool, Generic BLE nodes NEVER use handles. Always use uuids instead.

gatttool

In this dialog, choose JSON at Payload input item since Generic BLE out node accepts a JSON object as its input value. See Inputs in the node description shown in the info tab for detail.

gatttool

Click/tap ... to launch JSON value editor and populate the following JSON text.

{
    "f000aa0204514000b000000000000000": "ca"
}

The property f000aa0204514000b000000000000000 is a characteristic uuid. However, unlike gatttool, you must strip hyphens from the original uuid value. Generic BLE nodes doesn't accept gatttool style uuid format.

The value ca is a hex string to be written, which is identical to the above command line.

So you'll see the following image.

gatttool

Close the dialog by clicking Done button after entering the JSON text.

Configure Generic BLE out node for your BLE peripheral (This step is already introduced above so we don't describe here. See How to configure a new BLE peripheral).

Now you're ready to issue a characteristic write request to your BLE peripheral. Click Deploy and click inject node to issue a characteristic write request.

gatttool

Node-RED shows the notification message after your write request is performed successfully.

Here in this tutorial, we use inject node to create characteristic write request parameters. However, this isn't the only way to do so. You can use other nodes than inject node. All you need is to prepare a valid JSON object for Generic BLE out node and provide it to the node.

In order to retrieve the written value from your BLE peripheral, go to the next step.

Characteristics Value Read

The both commands perform characteristic value read commands and return the same result, the characteristic value of the uuid f000aa02-0451-4000-b000-000000000000.

$ gatttool -b 88:99:00:00:FF:FF --char-read -u f000aa02-0451-4000-b000-000000000000
handle: 0x0027 	 value: ca

$ gatttool -b 88:99:00:00:FF:FF --char-read --handle=0x0027
Characteristic value/descriptor: ca

In this tutorial, we translate the above commands into Node-RED flow.

We use the following nodes this time.

  1. inject node to trigger a read command
  2. Generic BLE in node to perform the read command
  3. debug node to show the read value

gatttool

Put the above nodes onto your workspace and add connectors like above.

Open inject node dialog and enter the characteristic uuid at Topic input box. Leave default values other than Topic since Generic BLE in sees only the topic value.

You can also leave Topic empty when you want to retrieve all characteristics values.

gatttool

Click Done after entering the uuid to close the dialog. You need to configure Generic BLE in node to use your BLE peripheral but we skip to mention here as the instruction is described above (See How to configure a new BLE peripheral for detail).

Click Deploy to function the flow.

gatttool

Let's read the characteristic value by clicking inject node pedal. The read result will be displayed on the debug tab.

BLE in and out nodes

See info tab for detail on the editor UI.

Example Flow

You can import the example flow on Node-RED UI.

Installation Note (Linux)

The Node-RED process owner must belong to bluetooth group in order to access BlueZ D-Bus API, otherwise this node doesn't work at all because of bluetoothd permission issue. For example, if you're going to run the process by pi user, run the following command.

sudo usermod -G bluetooth -a pi

Then reboot the OS so that the policy changes take effect.

sudo reboot

Node-RED users

Run the following commands:

cd ~/.node-red
npm install node-red-contrib-generic-ble

Then restart Node-RED process. Again, for Linux users, read the above chapter Installation Note (Linux) to get this node working.

CANDY RED users

Run the following commands:

cd $(npm -g root)/candy-red
sudo npm install --unsafe-perm node-red-contrib-generic-ble

Then restart candy-red service.

sudo systemctl restart candy-red

Appendix

How to build

# build
$ NODE_ENV=development npm run build
# package
$ NODE_ENV=development npm pack

node-red-contrib-generic-ble's People

Contributors

cbrandlehner avatar dbaba avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-red-contrib-generic-ble's Issues

Multiple notifications for the same characteristic

Hi,

I am using a Nano BLE Sense device to listen for sounds, and then infer what they are. If the sound is other than background noise it sends a Notify to the central.

There is only one characteristic and when I first set it up it was working fine with a single message being out put when the Notify was sent. However after reconnecting, and the resubscribing for notifications I found that two messages were being sent. I now have five messages being sent.

I'm guessing the subscriptions aren't being cleared down when reconnecting. I tried reconnecting without resubscribing but then I didn't receive any notifications.

Cannot find module @abandonware/noble/lib/resolve-bindings

Not working on macOS Catalina 10.15.5

17 Jun 15:30:56 - [info] Node-RED version: v1.0.6
17 Jun 15:30:56 - [info] Node.js  version: v12.12.0
17 Jun 15:30:56 - [info] Darwin 19.5.0 x64 LE
17 Jun 15:30:56 - [info] Loading palette nodes
17 Jun 15:30:57 - [warn] ------------------------------------------------------
17 Jun 15:30:57 - [warn] [node-red-contrib-generic-ble/generic-ble] Error: Cannot find module '../../node_modules/@abandonware/noble/lib/resolve-bindings'
Require stack:
- /Users/radionoise/.node-red/node_modules/node-red-contrib-generic-ble/dist/noble/index.js
- /Users/radionoise/.node-red/node_modules/node-red-contrib-generic-ble/dist/generic-ble.js
- /usr/local/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/local/lib/node_modules/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/local/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/local/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/local/lib/node_modules/node-red/lib/red.js
- /usr/local/lib/node_modules/node-red/red.js

Dongle not showing/no devices

I am trying to get this library to work but I'm having issues selecting the device. I bought a CSR dongle and can't get anything to show up in Node-Red.

image

image

I hope someone can help me! :)

Cannot drag "Generic ble X" node to flow

Dear all,

I installed the package and all respective nodes are appearing in the palette overview.
But I cannot drag one of the nodes to my flow. Any idea why this might be happening?

Best regards,

Matthias

Connecting Arduino nano 33 BLE

Hi,
I'm trying to connect Arduino nano 33 BLE board. When I use gatttool in command line everything works fine. But in node-red in Generic BLE node after Select from scan result it will return no GATT Characteristics. Only (not available) is in table. On Arduino side I'm using this code: https://github.com/arduino-libraries/ArduinoBLE/tree/master/examples/Peripheral/BatteryMonitor
Also when I try to read the value it returns me Nothing to read. Any suggestions what's wrong?

Thank you
scr

Scan result BLE devices

Hello everyone!
This is my first post in this forum and I don't know if the topic has already been covered in other posts.
I would like to use the node-red-contrib-generic-ble library for my application, in which I would like to read the data sent via a Bluetooth Low Energy device.
I installed through the manage palette and it seems to have been successful.
However when I go to the configuration window of the BLE peripherals I cannot use the scan result. It appears not to perform any scan operation.
Can anyone help me solve this problem?

generic-ble usage

Hi,

I have installed Generic BLE onto my Raspberry Pi - Node-RED and they appear as nodes. The installation seems to be fine.

I then tried to import the demo flow but I just get blank.

I wish to know how to configure the nodes so that I can send an instruction from the out node and receive it on the in node. I have the ip addess of my bluetooth controller using bluetoothctrl command. Can you provide instruction on how I can simply send and receive a 'hello world' using your excellant nodes?

cannot scan with node - Linux Ubuntu Odroid C2(arm64)

Hello!

I am running:
nodered 1.3.0-beta.1 on
Ubuntu (3.16.85) on
Odroid C2 with bluetooth-Module 2
woth: bluez 5.48

what I tried, Ive done sofar:

=======================
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
sudo usermod -G bluetooth -a myuser name
sudo setcap cap_net_raw+eip $(eval readlink -f which node)

Then reboot the OS so that the policy changes take effect.

sudo reboot

I have absolutely no change in ztthe behaviour of node.

The bluettoth of my devoice is wrking propperly. I am frequently scanning connecting paring devices over hcitool and bluetoothctl.

please help.

NR crash at GATT attributes search

Environment:
• RPi 4: Linux version 5.15.84-v8+ (dom@buildbot) (aarch64-linux-gnu-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023
• npm -version 9.3.1
• Linux 5.15.84-v8+ arm64 LE
• Node-RED version: v3.0.2
• Node.js version: v18.14.0
• bluez version 5.55
• stty -F /dev/ttyAMA0 -a : speed 3000000 baud; rows 0; columns 0; line = 15;

Node Error : BLE scanning found the Bluetooth (address field), but at GATT attributes scanning (GATT attributes table) it crashes NR. Bluetoothctl works fine, I can get all data (gattool is not available - probably already deprecated )

Log:

Starting as a systemd service.
7 Jun 23:07:52 - [info] Installing module: node-red-contrib-generic-ble, version: 4.0.3
7 Jun 23:08:36 - [info] Installed module: node-red-contrib-generic-ble
7 Jun 23:08:37 - [info] Added node types:
7 Jun 23:08:37 - [info] - node-red-contrib-generic-ble:Generic BLE in
7 Jun 23:08:37 - [info] - node-red-contrib-generic-ble:Generic BLE out
7 Jun 23:08:37 - [info] - node-red-contrib-generic-ble:Generic BLE
7 Jun 23:10:13 - [info] [GenericBLE] Start BLE scanning
7 Jun 23:11:07 - [error] /__bledev/4c74d4e26f23 err:DBusError: Software caused connection abort
=>DBusError: Software caused connection abort
at methodReturnHandlers. (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:339:27)
at handleMessage (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:98:11)
at EventEmitter. (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:147:9)
at EventEmitter.emit (node:events:513:28)
at /home/pi/.node-red/node_modules/dbus-next/lib/connection.js:112:14
at Socket. (/home/pi/.node-red/node_modules/dbus-next/lib/message.js:63:9)
at Socket.emit (node:events:513:28)
at emitReadable
(node:internal/streams/readable:590:12)
at processTicksAndRejections (node:internal/process/task_queues:81:21)
7 Jun 23:11:07 - [red] Uncaught Exception:
7 Jun 23:11:07 - [error] TypeError: this._discoveredPeripheralUUids.indexOf is not a function
at PeripheralRemovableNoble.onMiss (/home/pi/.node-red/node_modules/node-red-contrib-generic-ble/dist/noble/noble/index.js:61:72)
at BluezBindings.emit (node:events:513:28)
at BluezBindings.onDeviceMissed (/home/pi/.node-red/node_modules/node-red-contrib-generic-ble/dist/noble/lib/bluez/noble/lib/bluez/bindings.js:716:10)
at BluezBindings.onDevicesServicesCharacteristicsMissed (/home/pi/.node-red/node_modules/node-red-contrib-generic-ble/dist/noble/lib/bluez/noble/lib/bluez/bindings.js:710:12)
at ProxyInterface.emit (node:events:513:28)
at EventEmitter.$listeners. (/home/pi/.node-red/node_modules/dbus-next/lib/client/proxy-interface.js:108:17)
at EventEmitter.emit (node:events:513:28)
at handleMessage (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:118:23)
at EventEmitter. (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:147:9)
at EventEmitter.emit (node:events:513:28)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.

logic problem about device having short connection time

I mention I have a few knowledge about node.js

recently, I've been tested connecting BLE based devices with node-red, using node-red-contrib-generic-ble module.

but, there is a problem.

for example, I make up commuincation between device and node-red.

Only, the device has short connection time to save battery(ex. about a 50ms).

In this test environment, Generic BLE for Write module requests UUID write function, the function won't run.

I guess Generic BLE for Write module scan and search or inquire the device.

so, it needs more time for search or inquire.

While that process running, the device will be disonnected for saving energy, then, write function should have originally done doesn't run.

this is my only guess.

I use wireshark for Nordic BLE about this assumption and upload wireshark log(Log No.236~No.234

thank you for reading.
wireshark_log.zip

module fails to load after upgrade to 3.1.0

from the Node-red log:

May 20 10:34:23 rpi3 Node-RED[801]: 20 May 10:34:23 - [warn] [node-red-contrib-generic-ble/generic-ble] Error: Cannot find module '../../node_modules/@abandonware/noble/lib/noble'

addressType random for Philips Hue BLE

Using gatttool -t random I'm able to control my Philips bulb BLE. Is there an option in node-red-contrib-generic-ble to switch from addressType=public to random as described in noble?

characteristics are undefined when using Notify

I am using Generic BLE In node. I was able to succesfully set it up and connect to my BLE device.
When I am sending message

{
  "payload": {},
  "topic": "000015241212efde1523785feabcd123"
}

as an input, I successfully get something like

{ 
  payload: { 
    uuid: 'f078e37bd4fd',
    characteristics: { '000015241212efde1523785feabcd123': <Buffer 00> }
  },
  _msgid: 'bba3cde1.150fa' 
}

as an output.

Buth when input is

{
  "payload": {
    "notify": true,
    "period": 0
  },
  "topic": "000015241212efde1523785feabcd123"
}

I get output events every time relevant characteristic changes, but they look like this:

{
  payload: {
    uuid: 'f078e37bd4fd',
    characteristics: undefined
  },
  _msgid: '48901e10.8f95' 
}

I am running on Raspberry Pi 3 with recent Raspbian Buster:
5 Oct 13:07:38 - [info] Node-RED version: v1.0.1
5 Oct 13:07:38 - [info] Node.js version: v10.16.3
5 Oct 13:07:38 - [info] Linux 4.19.57-v7+ arm LE
5 Oct 13:07:39 - [info] Loading palette nodes
5 Oct 13:07:39 - [debug] Module: node-red-contrib-generic-ble 3.1.0

this._discoveredPeripheralUUids.indexOf is not a function

Once I have connected to a peripheral correctly, from time to time I get and error message and node-red stops

3 Jun 08:26:09 - [red] Uncaught Exception:
3 Jun 08:26:09 - [error] TypeError: this._discoveredPeripheralUUids.indexOf is not a function
at PeripheralRemovableNoble.onMiss (/data/node_modules/node-red-contrib-generic-ble/dist/noble/noble/index.js:61:72)
at BluezBindings.emit (node:events:513:28)
at BluezBindings.onDeviceMissed (/data/node_modules/node-red-contrib-generic-ble/dist/noble/lib/bluez/noble/lib/bluez/bindings.js:716:10)
at BluezBindings.onDevicesServicesCharacteristicsMissed (/data/node_modules/node-red-contrib-generic-ble/dist/noble/lib/bluez/noble/lib/bluez/bindings.js:710:12)
at ProxyInterface.emit (node:events:513:28)
at EventEmitter.$listeners. (/data/node_modules/dbus-next/lib/client/proxy-interface.js:108:17)
at EventEmitter.emit (node:events:513:28)
at handleMessage (/data/node_modules/dbus-next/lib/bus.js:118:23)
at EventEmitter. (/data/node_modules/dbus-next/lib/bus.js:147:9)
at EventEmitter.emit (node:events:513:28)

Running in RPI 3 with the latest versions of node-red and node-red-contrib-generic-ble

3 Jun 08:23:23 - [info] Node-RED version: v3.0.2
3 Jun 08:23:23 - [info] Node.js version: v16.20.0
3 Jun 08:23:23 - [info] Linux 5.10.103-v7+ arm LE

Anyone can help?

Thanks!

Unable to use more than one BLE node in one flow

Version: 2.0.2 installed from https://flows.nodered.org/node/node-red-contrib-generic-ble

When adding one "Generic BLE in" or "Generic BLE out" type node to a flow, we have successfully read respectively written two Bluetooth Smart devices' GATT characteristics (one device is always read, one always written to).
However, when combining both BLE in and BLE out nodes in one flow, it appears that only one of them is operational, i.e. only one is reading or writing characteristics as configured.

We believe, the problem is associated with the fact, that in the ~/.node-red/flows.json there is always only one entry of type "Generic BLE" present, although several "Generic BLE in" or "Generic BLE out" nodes are defined, which all reference the same "Generic BLE" type node in their "genericBle" attribute.

it only works right after "Deploy"

Hello. (sorry for mi english).
I am using your node to communicate with a xiaomi temperature and humidity sensor.
I have node-red over a raspberry pi 3 and I'm using the internal bluetooth of the raspberry.
The node only works when I do a "deploy", then the node stops "timeout". And it does not work until the next "deploy".
It works only when connecting for the first time after the "deploy".
Any ideas?
Thank you very much for your work.

Incoming notifications are not send to output

I have this flow with a debug node
grafik
However debug node stays empty, but when connecting with gatttool, I get every few seconds an incoming notification handle
grafik
Checkbox for notification events is checked

grafik

How to disconnect?

I have read and notify working.
But after doing a read, how do I get the node to disconnect from the ble device?

Add option to never disconnect intentionally

In some case it is necessary to keep a constant connection with a BLE device, which doesn't seems to be the case at the moment. As I understand this node will connect and then disconnect from a device constantly:

[...] the node connects/disconnects a BLE device periodically. I think I need to add an option for the node to keep BLE connection.

#4 (comment)

What I'm trying to do is to subscribe to Notify events when the button of an iTag (a very cheap Bluetooth tracker with a button) is pressed. The problem is that since this thing is a tracker, when it gets disconnected it beep furiously until the button is pressed. You can imagine all the noise it makes when used with this node and the constant connection disconnection.

I can't get value from characteristics

Hello!
Please, help me... I can't get value from characteristics for send to mqtt.
I want to send string type, but I have only object msg.payload.characteristics['000015241212efde1523785feabcd123']

Hue Bulb: Problem with sending a value to handle 0x0027

I am trying to turn my bluetooth Hue bulb on/off and change brightness using my Raspberry Pi 4B. The bulb is on, and I have successfully connected to it using bluez. When I try to run 'char-write-req 0x0027 01' to turn it on, I get this message:

GLib-WARNING **: 22:53:34.807: Invalid file descriptor

I can see that the connection is successful, but whenever I try to write a value to it, I just get this message and it disconnects. Running bluetoothctl 5.50. I have seen the patch conversation here: https://www.spinics.net/lists/linux-bluetooth/msg67617.html. But I am not sure it applies and I also wouldn't even know how to apply it. Can someone please help me!

BLE IN node keeps on unpairing and deleting BLE devices - help needed!

Hello!

I am working on Bluez 5.53 on Kernel 5.13 Ubuntu 18.04

since months I am trying to get this package reliably working now, but I cannot overcome the issue that

the BLE in node

aggressively keeps on unpairing and even removing fomerly absolutely correctly paired devices.
(btmon):


@ MGMT Command: Stop Discovery (0x0024) plen 1 {0x0001} [hci0] 97.862810
Address type: 0x07
BR/EDR
LE Public
LE Random
< HCI Command: Inquiry Cancel (0x01|0x0002) plen 0 #259 [hci0] 97.862918

HCI Event: Command Complete (0x0e) plen 4 #260 [hci0] 97.866692
Inquiry Cancel (0x01|0x0002) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 #261 [hci0] 97.866760
Scanning: Disabled (0x00)
Filter duplicates: Disabled (0x00)
HCI Event: Command Complete (0x0e) plen 4 #262 [hci0] 97.887693
LE Set Scan Enable (0x08|0x000c) ncmd 1
Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 4 {0x0001} [hci0] 97.887811
Stop Discovery (0x0024) plen 1
Status: Success (0x00)
Address type: 0x07
BR/EDR
LE Public
LE Random
@ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0] 97.887833
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Disabled (0x00)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0002} [hci0] 97.887833
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Disabled (0x00)
@ MGMT Command: Remove Device (0x0034) plen 7 {0x0001} [hci0] 97.916065
BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80)
@ MGMT Event: Device Removed (0x001b) plen 7 {0x0002} [hci0] 97.916174
BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80)
@ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 97.916184
Remove Device (0x0034) plen 7
Status: Success (0x00)
BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80)
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1 #263 [hci0] 97.916229
Scan enable: No Scans (0x00)
@ MGMT Command: Unpair Device (0x001b) plen 8 {0x0001} [hci0] 97.916435
LE Address: C0:E4:80:CA:A3:F0 (Static)
Disconnect: Enabled (0x01)
@ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 97.916455
Unpair Device (0x001b) plen 7
Status: Success (0x00)
LE Address: C0:E4:80:CA:A3:F0 (Static)
@ MGMT Event: Device Unpaired (0x0016) plen 7 {0x0002} [hci0] 97.916460
LE Address: C0:E4:80:CA:A3:F0 (Static)
HCI Event: Command Complete (0x0e) plen 4 #264 [hci0] 97.917702
Write Scan Enable (0x03|0x001a) ncmd 1
Status: Success (0x00)


However this dramatically results in deleted

var/lib/bluetooth/"adapter"/"peripheral-device"/info - file (which holds all the pairing key information)!

Exactly the same happens when you try to connect to a paired device via your BLE IN node and the connection becomes rejected or breaks whatr happens ofcours every once in a while:
(btmon)


@ MGMT Event: Device Connected (0x000b) plen 36 {0x0001} [hci0] 65.298536
LE Address: C0:E4:80:CA:A3:F0 (Static)
Flags: 0x00000000
Data length: 23
Flags: 0x02
LE General Discoverable Mode
16-bit Service UUIDs (partial): 1 entry
GoPro, Inc. (0xfea6)
Company: GoPro, Inc. (754)
Data: 0103133f00f0a3ca80e4c00f
@ MGMT Event: Device Connected (0x000b) plen 36 {0x0002} [hci0] 65.298536
LE Address: C0:E4:80:CA:A3:F0 (Static)
Flags: 0x00000000
Data length: 23
Flags: 0x02
LE General Discoverable Mode
16-bit Service UUIDs (partial): 1 entry
GoPro, Inc. (0xfea6)
Company: GoPro, Inc. (754)
Data: 0103133f00f0a3ca80e4c00f
< HCI Command: LE Read Remote Use.. (0x08|0x0016) plen 2 #237 [hci0] 65.298733
Handle: 70

HCI Event: Command Status (0x0f) plen 4 #238 [hci0] 65.302521
LE Read Remote Used Features (0x08|0x0016) ncmd 0
Status: Success (0x00)
@ MGMT Command: Start Service Disc.. (0x003a) plen 4 {0x0001} [hci0] 65.499034
Address type: 0x07
BR/EDR
LE Public
LE Random
RSSI: invalid (0x7f)
UUIDs: 0
HCI Event: Disconnect Complete (0x05) plen 4 #239 [hci0] 65.594510
Status: Success (0x00)
Handle: 70
Reason: Connection Failed to be Established (0x3e)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 65.594557
LE Address: C0:E4:80:CA:A3:F0 (Static)
Reason: Unspecified (0x00)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0002} [hci0] 65.594557
LE Address: C0:E4:80:CA:A3:F0 (Static)
Reason: Unspecified (0x00)
HCI Event: LE Meta Event (0x3e) plen 12 #240 [hci0] 65.596521
LE Read Remote Used Features (0x04)
Status: Unknown Connection Identifier (0x02)
Handle: 70
Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
HCI Event: Command Status (0x0f) plen 4 #241 [hci0] 65.597513
NOP (0x00|0x0000) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Random Addr.. (0x08|0x0005) plen 6 #242 [hci0] 65.643039
Address: 15:F4:3C:8F:A5:0A (Non-Resolvable)
HCI Event: Command Complete (0x0e) plen 4 #243 [hci0] 65.644538
LE Set Random Address (0x08|0x0005) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Parame.. (0x08|0x000b) plen 7 #244 [hci0] 65.644689
Type: Active (0x01)
Interval: 22.500 msec (0x0024)
Window: 11.250 msec (0x0012)
Own address type: Random (0x01)
Filter policy: Accept all advertisement (0x00)
HCI Event: Command Complete (0x0e) plen 4 #245 [hci0] 65.646525
LE Set Scan Parameters (0x08|0x000b) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 #246 [hci0] 65.646657
Scanning: Enabled (0x01)
Filter duplicates: Enabled (0x01)
HCI Event: Command Complete (0x0e) plen 4 #247 [hci0] 65.648526
LE Set Scan Enable (0x08|0x000c) ncmd 1
Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 4 {0x0001} [hci0] 65.648675
Start Service Discovery (0x003a) plen 1
Status: Success (0x00)
Address type: 0x07
BR/EDR
LE Public
LE Random
@ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0] 65.648694
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Enabled (0x01)
@ MGMT Event: Discovering (0x0013) plen 2 {0x0002} [hci0] 65.648694
Address type: 0x07
BR/EDR
LE Public
LE Random
Discovery: Enabled (0x01)
@ MGMT Command: Remove Device (0x0034) plen 7 {0x0001} [hci0] 65.648872
BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80)
@ MGMT Event: Device Removed (0x001b) plen 7 {0x0002} [hci0] 65.648908
BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80)
@ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 65.648916
Remove Device (0x0034) plen 7
Status: Success (0x00)
BR/EDR Address: C0:E4:80:CA:A3:F0 (OUI C0-E4-80)
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1 #248 [hci0] 65.648955
Scan enable: No Scans (0x00)
@ MGMT Command: Unpair Device (0x001b) plen 8 {0x0001} [hci0] 65.649017
LE Address: C0:E4:80:CA:A3:F0 (Static)
Disconnect: Enabled (0x01)
@ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 65.649031
Unpair Device (0x001b) plen 7
Status: Success (0x00)
LE Address: C0:E4:80:CA:A3:F0 (Static)
@ MGMT Event: Device Unpaired (0x0016) plen 7 {0x0002} [hci0] 65.649034
LE Address: C0:E4:80:CA:A3:F0 (Static)
HCI Event: Command Complete (0x0e) plen 4 #249 [hci0] 65.653515
Write Scan Enable (0x03|0x001a) ncmd 1
Status: Success (0x00)


Therefore one has to redo the whole pairing process over and over again.
This is untolerable and there's no workaround for this.

Unfortunately there isnt any output on this node available, what makes it even "more fun".

how ever we need help on this pleaseeather way with an bug fix or main.conf or /sys/kernel/debug/bluetooth/hci0 - settings please.
availaible are:
6lowpan force_sc_support random_address
adv_channel_map force_static_address rpa_timeout
auto_accept_delay hci_revision sc_only_mode
blacklist hci_version sniff_max_interval
conn_info_max_age identity sniff_min_interval
conn_info_min_age identity_resolving_keys ssp_debug_mode
conn_max_interval idle_timeout static_address
conn_min_interval inquiry_cache uuids
dev_class le_auto_conn voice_setting
discov_interleaved_timeout link_keys white_list
dut_mode long_term_keys white_list_size
features manufacturer

I appreciate your help.

with kind regards

habakuk

No BLE devices show up on scan

Hi,

I am running node-red on macOS (Monterey 12.1). I am new to node-red and simply want to read BLE sensor data from a peripheral (TI LPSTK-CC1352R) on my macbook.

I am using the node-red-contrib-generic-ble 4.0.3, it installs fine (Screenshot below), I follow the instructions for configuring the 'Generic BLE Out' node.

Here's the issue. On enabling 'BLE Scanning' nothing shows up ! My terminal window does say '[info] [GenericBLE] Start BLE scanning' (Screenshot below) but no peripheral device comes up in the 'Scan Result' drop-down menu. The BLE sensor node is working. I verified by finding it on the Bluetooth app (LightBlue) so sensor is transmitting.

Could someone kindly point how to solve this issue ? Thanks.

I have checked that both the Terminal and Web Browser have the permission to use Bluetooth in the security and privacy setting of the laptop.

Screen Shot 2022-04-19 at 6 40 15 PM

Screen Shot 2022-04-19 at 6 41 17 PM

run on docker

hi, plz help how use this node in "docker nodered/node-red:latest-minimal"

23 Jan 20:57:05 - [error] [GenericBLE:ERROR] The name org.bluez was not provided by any .service files, DBusError: The name org.bluez was not provided by any .service files,
    at _methodReturnHandlers.(anonymous function) (/data/node_modules/dbus-next/lib/bus.js:339:27),
    at handleMessage (/data/node_modules/dbus-next/lib/bus.js:98:11),
    at EventEmitter.MessageBus.conn.on (/data/node_modules/dbus-next/lib/bus.js:147:9),
    at EventEmitter.emit (events.js:198:13),
    at /data/node_modules/dbus-next/lib/connection.js:112:14,
    at Socket.<anonymous> (/data/node_modules/dbus-next/lib/message.js:63:9),
    at Socket.emit (events.js:198:13),
    at emitReadable_ (_stream_readable.js:555:12),
    at process._tickCallback (internal/process/next_tick.js:63:19),

node-red run from user 'node-red' in Alpine Linux

TI sensor tag doesn't work

Nice project! I love it! But if I use your example flow with the TI sensortag, I get the following output.

16.11.2017, 09:25:21
msg : string[59]
"[GenericBLE] <247189cc6684> Characteristic(2a19) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa0104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa2104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa4104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa8104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa7104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[59]
"[GenericBLE] <247189cc6684> Characteristic(ffe1) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000ccc104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000ffc104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000ffc204514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000ffc404514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[59]
"[GenericBLE] <247189cc6684> Characteristic(2a19) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa0104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa2104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa4104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa8104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000aa7104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[59]
"[GenericBLE] <247189cc6684> Characteristic(ffe1) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000ccc104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000ffc104514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000ffc204514000b000000000000000) is missing"
16.11.2017, 09:25:21
msg : string[87]
"[GenericBLE] <247189cc6684> Characteristic(f000ffc404514000b000000000000000) is missing"

I find the tag in the Generic BLE input and I get all GATT Characteristics. All custom type looks like this:

<Unnamed> (f000aa8104514000b000000000000000)ReadNotify
(Custom Type)

But I think it is okay.

Under the Generic BLE Input the state switches every 3 - 5 seconds from connected to disconnected and again to connected.

I have "Selected from scan result" used to add the sensortag.

The tag works fine with the node-red-node-sensortag package, but I need custom functionalities, where I need your package.

Thank you.

BLE Scanning gets automatically enabled

If you change something on the BLE node, BLE scanning gets automatically enabled/checked
grafik
However this behaviour is undesired, because you can't connect when Node shows "missing". If you disable "BLE Scanning" than you can connect immediately.

Feature suggestion: Automatically reconnect

Hi,

I am using a Nano BLE Sense device to listen for sounds, and then infer what they are. If the sound is other than background noise it sends a Notify to the central.

This all works fine, but the Nano device is prone to the occasional disconnection due to it's weak radio. Unfortunately this means I need to connect again, and this is currently done with an Inject. I guess I could monitor the status and send a connect message if it disconnects but I prefer it if the "config" node could reconnect automatically if a check box is checked.

Also if subscribed for events it would need to resubscribe.

polling time

Hi, this is an interesting project. I'm trying to use it to harvest information from some BLE sensors that I've strewn about my work area. Their intent is to be low powered (i.e., sleeping most of the time) and only wakeup to provide sensor data when needed.

For example, I have a sensor that sleeps at about 0.37mA but when it takes in a connection it'll jump up to about 4mA to provide data. Once the central disconnects, it'll reset back down to its 0.37mA low power state.

This node however seems to connect quite frequently and on its own. Is there any way to tune this so it happens when triggered via another node like a timer/manual/etc...

Add a setting to specify HCI index

Just ran into this error. Seems it tried to connect using hci0 but it is unavailable.

26 May 21:52:41 - [error] [GenericBLE:ERROR] Missing Bluetooth Object, Path:/org/bluez/hci0, Valid Paths:/org/bluez,/org/bluez/hci1,/org/bluez/hci1/dev_10_9E_3A_99_43_F1,/org/bluez/hci2,/org/bluez/hci2/dev_10_9E_3A_99_43_F1}, Error: Missing Bluetooth Object, Path:/org/bluez/hci0, Valid Paths:/org/bluez,/org/bluez/hci1,/org/bluez/hci1/dev_10_9E_3A_99_43_F1,/org/bluez/hci2,/org/bluez/hci2/dev_10_9E_3A_99_43_F1}
    at BluezBindings.init (/usr/share/hassio/homeassistant/nodered/node_modules/node-red-contrib-generic-ble/dist/noble/lib/bluez/noble/lib/bluez/bindings.js:182:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Undefined status

I would like to get status info of the "Generic BLE in" node using "node-red: status". But status node sends "msg.payload : undefined" for any status change of the "Generic BLE in" node.

Any idea how to solve it?

I am a new user of node red, i need help

i am working on a project that need to control a device via ble uart. i am using generic ble nodes on node red. my flow is as follows: timestamp -> function where i send the buffer as msg.payload -> generic-ble -> debug. but i can't get the result that i want. whatever the value i push in, i get the same result from the debug

[{"id":"1334d53f.256103","type":"tab","label":"Flow 6","disabled":false,"info":""},{"id":"ec714ea4.4f7c28","type":"Generic BLE in","z":"1334d53f.256103","name":"","genericBle":"2fe4f5d3.a4aada","useString":false,"notification":true,"x":430,"y":170,"wires":[["4b1539cf.c597f8"]]},{"id":"4b1539cf.c597f8","type":"debug","z":"1334d53f.256103","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":660,"y":140,"wires":[]},{"id":"4d95dc7f.19ae74","type":"inject","z":"1334d53f.256103","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":70,"wires":[["dfebc0f9.d4f0a8"]]},{"id":"dfebc0f9.d4f0a8","type":"function","z":"1334d53f.256103","name":"send Hex","func":"var data = new Buffer([0x006, 0x004, 0x80, 0x000, 0x001, 0x83]);\nmsg.payload = data.toString('hex');\n\nreturn msg;","outputs":1,"noerr":0,"x":170,"y":230,"wires":[["ec714ea4.4f7c28"]]},{"id":"2fe4f5d3.a4aada","type":"Generic BLE","z":"","localName":"TRY--Nordic_UART","address":"f1:d2:aa:f1:a0:25","uuid":"f1d2aaf1a025","muteNotifyEvents":true,"operationTimeout":"","characteristics":[]}]

Add option for random GAP address

Is it possible to add the option to set random GAP address?

In testing I found out that a device that is not connectable in Generic BLE has the same issue in Gattool. In Gattool I can fix this by using the random GAP address option. So, I thought that this random GAP Address option might also fix my issue in this node.

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

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

Connect to device sending its MAC address

Hello, is there a way to connect to a BLE device (input or output) sending its MAC address in input, instead of associate the device statically to the node?

Thanks

Unable to pull GATT Characteristics

Hi,

I'm using your BLE node to try and connect to a i-Syst BluePyro module (uses Nordic nRF52832). BTW your node has been the most clearly developed node, along with the tutorial. Bar none above the rest of the nodes in Node-Red and I've pretty much tried them all.
Everything works fine up until pulling GATT Char. Scan sees the module, pulls the MAC etc.
It dies and then generates the below error.
If I use bluetoothctl, I'm able to see the services just fine, so I'm not sure where the problem is.

/__bledev/cbabcc493ee2 err:Error: Missing Peripheral Device
=>Error: Missing Peripheral Device
at Peripheral.a (/home/pi/.node-red/node_modules/node-red-contrib-generic-ble/dist/generic-ble.js:217:31)
at Object.onceWrapper (events.js:420:28)
at Peripheral.emit (events.js:314:20)
at PeripheralRemovableNoble.Noble.onDisconnect (/home/pi/.node-red/node_modules/@abandonware/noble/lib/noble.js:245:16)
at BluezBindings.emit (events.js:314:20)
at ProxyInterface. (/home/pi/.node-red/node_modules/node-red-contrib-generic-ble/dist/noble/lib/bluez/noble/lib/bluez/bindings.js:623:18)
at ProxyInterface.emit (events.js:314:20)
at EventEmitter.$listeners. (/home/pi/.node-red/node_modules/dbus-next/lib/client/proxy-interface.js:108:17)
at EventEmitter.emit (events.js:314:20)
at handleMessage (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:118:23)
at EventEmitter. (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:147:...

Cannot write

Hello,
when I try to send this message, nothing happens, but when I send char-write-req 0x0012 0064 using terminal gatttol, it works. To setup Generic BLE node I used Select from scan result option.

msg.payload:

{
    "0x0012": "0064"
}

Is msg format wrong? Or it's something else?

Note:

  • device I try to write from: Raspberry Pi 3B
  • device I try to write to: Vogel's Motion Mount (motorized TV wall mount)

Thank you.

Connection status from generic-ble node

Hello,

I have an Arduino Nicla Sense ME (BLE) as are connected to node-red-contrib-generic-ble.
When connected all the sensor data values collected from the bluetooth low energy node then going further through MQTT node to an HTML webpage.

I'm wondering is there possibility to get the connection status from the contrib-generic-ble node over MQTT to see the status when the device is connected/disconnected/missing/error on the HTML webpage?

blestatus

Best Regards.
Nylund

Cannot write with Generic BLE Out

Hello!

I am on ubuntu 18.04 with BLUEZ 5.53.
I am using your nodes node-red-contrib-generic-ble V 4.0.3
After fiddling around with the BLE settings for quite a while I finally got the scan working and have alle the UUID-characteristics listed in Generic BLE in /out nodes.

However I went through your help file a thousand times being absolutely sure that my json syntax of my Inject node is correct, but I CANNOT wrigte to my device although it's BLE nodes are propperly connected.

my gatttool command would be:

gatttool -t random -b F7:EE:ED:71:56:E2 --char-write-req -a 0x2f -n 03010101 (this is starting the shutter of a camera)

so my msg.payload JSON is:

{ "b5f90074aa8d11e390460002a5d5c51b": "03010101" }

No reaction of camera.
Although I am absolutely positive that this is the correct writable UUID, I tried all available UUIDSadvertised by the peripheral device.

Is the Syntax correct?
Is the length of the value an issue?
Which protocoll are you using in the background: bluetoothctl's write? (I assume)

However, I do have troube to run an acquire-write command on the shell: Permission denied!

just ion case this is an issue.

please help.

cannot receive notification from Bluetooth device

When we try to get the notification we receive the following error. When using the same command in the NRF command it gives the data correctly.

(node:4511) UnhandledPromiseRejectionWarning: DBusError: Operation failed with ATT error: 0xff
at methodReturnHandlers.(anonymous function) (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:339:27)
at handleMessage (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:98:11)
at EventEmitter.MessageBus.conn.on (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:147:9)
at EventEmitter.emit (events.js:198:13)
at /home/pi/.node-red/node_modules/dbus-next/lib/connection.js:112:14
at Socket. (/home/pi/.node-red/node_modules/dbus-next/lib/message.js:63:9)
at Socket.emit (events.js:198:13)
at emitReadable
(_stream_readable.js:555:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:4511) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:4511) UnhandledPromiseRejectionWarning: DBusError: No notify session started
at methodReturnHandlers.(anonymous function) (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:339:27)
at handleMessage (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:98:11)
at EventEmitter.MessageBus.conn.on (/home/pi/.node-red/node_modules/dbus-next/lib/bus.js:147:9)
at EventEmitter.emit (events.js:198:13)
at /home/pi/.node-red/node_modules/dbus-next/lib/connection.js:112:14
at Socket. (/home/pi/.node-red/node_modules/dbus-next/lib/message.js:63:9)
at Socket.emit (events.js:198:13)
at emitReadable
(_stream_readable.js:555:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:4511) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5)

Does anyone have any suggestions?
Thank you

Neither tool works and nothing in hcitrace

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 -f which 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.