Node-RED Node

I did some digging on the log files. This might be the cause for my problems:

(node:293) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 scanStop listeners added. Use emitter.setMaxListeners() to increase limit

Any idea why the scanStop is piling up the listeners?

Hi!

I copypasted this to Node-Red, but it seems that I can’t get any MQTT messages. I did setcaps command and everyting seems OK.

pi@raspberrypi:~ $ sudo systemctl status nodered.service
● nodered.service - Node-RED graphical event wiring tool
   Loaded: loaded (/lib/systemd/system/nodered.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-01-18 09:56:24 GMT; 3min 0s ago
     Docs: http://nodered.org/docs/hardware/raspberrypi.html
 Main PID: 314 (node-red)
   CGroup: /system.slice/nodered.service
           └─314 node-red

Jan 18 09:56:39 raspberrypi Node-RED[314]: your credentials.
Jan 18 09:56:39 raspberrypi Node-RED[314]: You should set your own key using the 'credentialSecret' option in
Jan 18 09:56:39 raspberrypi Node-RED[314]: your settings file. Node-RED will then re-encrypt your credentials
Jan 18 09:56:39 raspberrypi Node-RED[314]: file using your chosen key the next time you deploy a change.
Jan 18 09:56:39 raspberrypi Node-RED[314]: ---------------------------------------------------------------------
Jan 18 09:56:39 raspberrypi Node-RED[314]: 18 Jan 09:56:39 - [info] Starting flows
Jan 18 09:56:39 raspberrypi Node-RED[314]: 18 Jan 09:56:39 - [warn] [scan ble:2905abd3.fa5084] Unable to start BLE scan. Adapter state: unknown
Jan 18 09:56:39 raspberrypi Node-RED[314]: 18 Jan 09:56:39 - [info] Started flows
Jan 18 09:56:39 raspberrypi Node-RED[314]: 18 Jan 09:56:39 - [info] [scan ble:2905abd3.fa5084] Scanning for BLEs started. UUIDs:  - Duplicates allowed: false
Jan 18 09:56:40 raspberrypi Node-RED[314]: 18 Jan 09:56:40 - [info] [mqtt-broker:bcb91c28.92549] Connected to broker: mqtt://192.168.1.112:1883
pi@raspberrypi:~ $ hcitool dev
Devices:
        hci0    B8:27:EB:30:32:59
pi@raspberrypi:~ $

How to check what’s wrong?

On a quick glance the issue might be
Jan 18 09:56:39 raspberrypi Node-RED[314]: 18 Jan 09:56:39 - [info] [scan ble:2905abd3.fa5084] Scanning for BLEs started. UUIDs: - Duplicates allowed: false

You should allow duplicates, otherwise you’ll receive one transmission per mac address

I was able to get it to work.

What I have to do is:
pi@raspberrypi:~ $ sudo hciconfig hci0 down
pi@raspberrypi:~ $ sudo hciconfig hci0 up

Then stop flow in Node-RED and re-deploy. Why is that? And can I automate these commands somehow?

You get fed-up with the constantly struggle with hci0 restarts. One of the reason i gave up and now only use gateways (with watchdog ) and mqtt back to node red

I can’t get * scan ble node working at node red!?

There are some issues with Noble on NodeJS 10, you could try using NodeJS 8 with NVM

Sain toimimaan mutta nyt ruuvitag node asennus epäonnistuu, kun annan tämän
npm link node-red-contrib-ruuvitag
tulee tällainen
12 verbose cwd /home/pi/node-red
13 verbose Linux 4.14.79-v7+
14 verbose argv “/home/pi/.nvm/versions/node/v8.15.0/bin/node” “/home/pi/.nvm/ve rsions/node/v8.15.0/bin/npm” “link” “node-red-contrib-ruuvitag”
15 verbose node v8.15.0
16 verbose npm v6.4.1
17 error code E404
18 error 404 Not Found: node-red-contrib-ruuvitag@latest

It’s been a while since I took a view at the Ruuvi’s node, and the installation could be simplified by adding the node to npm repository (as far as I know).

I can’t promise any specific date, but I’ll take a look at the node at some point in near future to see if it could be made simpler to use

Hi Otso,
I have purchased 3 RuuviTags to connect them to my home automation. I don’t get the Noble node working. So that I can use them in Node-red, the heart of my Project. You wrote that there are problems with NodeJS10. Is there a prospect of a solution? Otherwise I would better return the RuuviTags.
Thanks for your answer, Rob

Hello,

I use NVM to run NodeJS8

Hy all,

just struggeling to get node-red-contrib-noble on Raspian Stretch lite. Current version of nodeJs (11.xx) seems to cause some trouble with the Bluetooth-hci-stack.

After installing the full raspian installation things went smoothly. It contains nodeJS 8.xx, which makes no trouble.

Just in case somebody has the same issues…

Best regards,
Eckehard

Following code can be used in a nodeRed function node to convert raw data directly:

var data={};
var buf = msg.advertisement.manufacturerData;
data.payload={};
data.payload.batt = buf.readUInt16BE(14)/1000.0+" V";
data.payload.temp = buf.readInt8(4)+buf.readUInt8(5)/100.0;
data.payload.hum = buf.readInt8(3)/2.0;
data.payload.accX = buf.readInt16BE(8)/1000.0;
data.payload.accY = buf.readInt16BE(10)/1000.0;
data.payload.accZ = buf.readInt16BE(12)/1000.0;
data.payload.press = buf.readUInt16BE(6)+50000+" Pa";
return data;

1 Like

Hi @etatto, I realize this is a really old post but could you explain why you do the start/stop nodes with the delay?

Hello Chuck and welcome, it just so that the Bluetooth are not constantly scanning. In this case its used for temperature reading, it do not change that fast. For constant reading of acceleration you would have to change that part.

PT