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


#1

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":[]}]

#2

I do not know how many times this has been said, but since you are new, you are excused:

"Publish your flow so people can give real help"


#3

Also what version of NR and nose.js ? (Look at the NR startup log)
What platform, OS and release?
Which ‘generic’ ble node?
What is the device you are trying to control?


#4

thank you for your quick reply.
Node-RED version: v0.19.4
node: v8.12.0
OS: Raspbian GNU/Linux 9.4
node-red-contrib-generic-ble(v-3.0.0)

the device i am trying to control here is a fan, the communication is done via UART, so i burned ble-uart driver on a nordic dongle (this is working fine). Now the problem is to send hex bytes through ble


#5

You missed the important request for you to post your flow. It is usually far easier to see what might be going from looking at your flow and seeing what you have done, than trying to guess.


#6

sorry for that. I've just updated my post.
Thanks for the reminder.


#7

Now re edit the post and put three back tics on a line before the flood and on the line after the float. That will prevent smart quotes from getting in preventing anyone from importing it


#8

Back tics not back slashes - the character that is like a single quote but goes the opposite direction


#9

sorry, my bad. I confused Backtics and back slashes


#10

OK so your function contains

var data = new Buffer([0x006, 0x004, 0x80, 0x000, 0x001, 0x83]);
msg.payload = data.toString('hex');

return msg;

So you are always sending the same message to your bluetooth node, so what is the debug message you are getting and what are you expecting to see?


#11

Thank you for your reply,
This is what i keep getting.

"{"uuid":"f1d2aaf1a025","characteristics":{"2a00":{"type":"Buffer","data":[84,82,89,45,45,78,111,114,100,105,99,95,85,65,82,84]},"2a01":{"type":"Buffer","data":[0,0]},"2a04":{"type":"Buffer","data":[16,0,60,0,0,0,144,1]},"2aa6":{"type":"Buffer","data":[1]}}}"

actually the buffer sent is to turn on the device, but i had no reaction.
when sent a register buffer, to send a request message, still got the same result.


#12

and as @zenofmud asked in post #3 what are you trying to control?


#13

the device i am trying to control here is a fan, the communication is done via UART, so i burned ble-uart driver on a nordic dongle (this is working fine). Now the problem is to send hex bytes through ble


#14

Have you used the gatttool as shown in the nodes read me, to make sure you can communicate with the device?


#15

they didn't say something about it. but talked about write/read buffer. which is actually what i am trying to achieve here.


#16

I'd read the README again, and try their suggested workflow. https://flows.nodered.org/node/node-red-contrib-generic-ble


#17

thank you for your suggestion, Unfortunately i have already tried it.
no good result.


#18

i have seen that it's also possible to use "node-red-contrib-noble" to set the communication, but i don't find the best way to implement it using "node-red-contrib-noble", i don't know if you guys can give me a good suggestion


#19

If you have tried using gatttool on the command line and it still doesn't work, then its not a problem specific to Node-RED. Have you got it working at all?

To allow us to help you you need to be specific as to what you have tried and what happened, comments such as "Unfortunately i have already tried it. no good result." don't allow us to understand what is going wrong and what to suggest.

Good luck getting it to work.


#20

What type of Pi do you have? it makes a difference since bluetooth didn't exist in the pi 2"s

Are there any messages in the log? I suggest you shutdown NR - then start it in a terminal using the 'node-red' command so you will see the log. Then run your flow and look at the log and see if there are any messages.