"oneditprepare" manipulation of a subflow packed as a module?

Good evening,

I created a subflow and packed it into a module which is registered as described here (Packaging a Subflow as a module : Node-RED).

So far so good. This is working fine and the subflow is displayed as node and can be used.

But now I want to add some more functionality like autocompletion on a property input field of the subflow.
Is there any possibility?
In case of custom nodes you have the html part where you can add autocompletion in the oneditprepare part.
But in case of this subflow module the html part is fully auto generated as far as I see.

Anyway is there a possibility to add functionality to the oneditprepare function ?

Hi @CustomNode

No, that type of customisation isn't possible with subflow modules.

To add something like autocomplete on an input, the starting point would be look at how it could be added to the regular subflow properties - so it can be included when packaged as a module.

Thanks for fast answer.

Ok one more question (i am not sure if this is allowed to use the same thread but it leads to my origin problem here)

is it possible to do something like an "inheritance" in a custom node?

So my usecase is that i have the following construct:

"mqtt in" node ---> my custom node --> output

because i do not want to self implement the mqtt part on my own i use this combination very often, I created the subflow as module from origin post.

The best solution would be if my custom node can just inherit from the mqtt in node and extend the node.on function.

Is there a possibility to do that?

You don't need inheritance here, you need a message. That is the bread and butter of node-red.

The mqtt-in node subscribes to one or more mqtt topics and receives all updates on those topics which it sends as messages to its output port. Your packaged up sub-flow receives those messages, processes them and outputs its own msgs (if you want it to) which go to the next node.

Yeah it is clear that the messages are the bread and butter.

My intension is to reduce duplicated parts in my flows.
I have different flows which uses multi mqtt inputs and i want to avoid that i have always this mqtt in -> custom node combination which is then connected to the central logic of the flow.
This was the reason why i created the subflow with the first 2 nodes.

I am fine with that and can accept it that then no auto completion is possible :slight_smile:
Thanks for responses

Sorry, I don't seem to be understanding the logic.

You could build your MQTT-in into your sub-flow then you wouldn't need them.

Or you could simply define your sub-flow logic in a single place with a link-in node and send data to it from anywhere using link-out nodes?

What have I missed?

yes exactly this is what i do currently with setting the property as environment property.
But with this solution i can not add autocompletion on the environment property for the mqtt topic.

mqtt-in nodes can now be configured by an input msg.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.