0
votes

i am trying to create a new node in node-red and i am trying to make it to load the configuration once it`s added to the flow and deployed as this configuration is fixed and shared with some input and output nodes, when i check examples ( like mqtt node ) most of them wait until the use click on ADD button

1
You are going to have to explain in a lot more detail what you are trying to do as it's not clear from what you've put in the question so far. It is probably worth giving some actual examples. Please edit the question. - hardillb

1 Answers

0
votes

So it sounds like your new node will have a config node associated with it, correct? If so, then when you drag/drop the new node into the editor, that config node will also be created (although it's not visible in the flow).

With the example you mentioned (e.g. MQTT In), the newly dropped node will show an orange triangle decorator, because the config node needs to be fully configured before it can be deployed. The reason this occurs is that the config node is invalid, due to some required fields that have no values yet.

So, when you define your .js/.html files for your new node, just make sure that all the fields on your config node are marked as required, and have default values. This should allow you to drop a new node onto the editor, and deploy the flow without having to manually edit the configuration. In fact, your new node does not even have to have a pulldown showing the config node, or allowing it to be changed -- it could just be a read-only text field.