Please note that this is an EXPERIMENT. Not at all sure whether it would be worth publishing.
event-out nodes are an alternative take on the core
Whereas the link nodes link up via the source and destination node id, these nodes link up via the
This means that you can have a
event-in node to which you can send any messages as long as they have a
Then you add 1 or more instances of the
event-out node with a pre-defined topic. Those nodes then listen for that topic and output the msg.
Well, I find myself creating a very large number of identical MQTT listeners simply to listen for change events for specific topics. This seems unnecessary. I could create links of course but then would have to define all of the source and destination links manually and who wants to do that right?
So Instead, I can have a single MQTT listener connected to a single
event-in and as many matching event-out nodes as I like.
Just seems a lot neater that way don't you think? Or is that just me stressing over my OCD?
Anyway, it was also a good excuse to try out my new deconstructed layout for a node's .js file as well.
Let me know if you think this is worth publishing - or indeed, let me know if you think this is a bad idea
For now, you have to install from GitHub:
npm install TotallyInformation/node-red-contrib-events
Nearly forgot. I have used the Node-RED core event handler for this. However, I have prefixed all event names with
TotallyInfo-Contrib-Events: then followed by the msg.topic. So you can be sure that the event names are unique and cannot possibly clash with any internal Node-RED event names.