Fill editor values from node function

Hi, I am building a node with bluetooth connectivity. And this all works fine.

But to connect to the bluetooth device you need to enter a bluetooth address, and also first find out what that address is. This can be quite difficult.

So instead I want to have a dropdown in the node config editor to select the bluetooth address populated from a bluetooth scan. I know how to do a scan in the node, however I cannot find how to get that dynamic information in the node config editor. Or run functions in the node.
I know how to manipulate the config editor HTML with jquery and the "oneditprepare" call. But not how to connect to the node or interacting with it.

Ps. I need to run the BT scan in the node, as running it in the editor HTML/script would mean it would scan from the browser instead of running from the device that node-red runs on.

Hi. The usual example we give is the node-red-node-serialport which has a button to fetch the list of available ports from the host.

Thank you. So I got a bit confused by the RED.nodes.node(this) entries. But I suppose that is just a config reference, not a node reference?

So in the serialports I also found this, so if I implement that, I could do I a request from the config editor and than get the needed values.

RED.httpAdmin.get("/serialports"....

Am I looking in the right direction ?

Yes. You need to choose your own endpoint name to call on the server so as not to conflict, but yes the get calls the backend. Then at the backend you can do your scan and return the values you want.

Awesome, thanks.

Result can be found here; node-red-contrib-soma-smartblinds2 (node) - Node-RED
See GitHub for implementation;
GitHub - dionmes/node-red-contrib-soma-smartblinds2: Node-Red node for Soma smartblinds 2. Supported Bluetooth needed.