I have been playing around with node-red for some time and created some flows to automate some stuff in our home.
As a next step I want to try my hand ad creating a module.
What I would like to do is create a module that provides a node that does the following:
Listens to MDNS (analog to the discovery node) and:
Create configuration nodes based on what it discovers.
Background: I have a few switches that announce their IP, MAC and name via mdns. I need the MAC as that is the basis for the events they publish in the mqtt server. But I want to have configuration nodes for each of those that use the name and store the mac and IP. And I would like these to be generated automatically..
Technically this is doable. Once you've created a node, you may create config nodes as well...
Logically I'm yet not convinced this is necessary:
When you deploy, NR claims any config node that is not in use and asks you to clean / delete these nodes. Thus there's (almost) no value in creating them upfront...
You can (or perhaps even: you should) of course collect the MDNS info and then offer this data via a property page to the user configuring you custom node. Once the user selected his preference, you may instantiate a config node that hold this data. For the user of your custom node, this whole process is almost transparent - thus it makes not (much) difference.