Hello,
I’m just getting started with NCD sensors and Node-RED. My background is in programming, and after spending some time with Node-RED, I can see that it’s quite powerful and offers a lot of advantages.
That said, I’m curious whether Node-RED is always considered the recommended approach for sensor data collection.
In my case, I’m considering running a custom Node.js program as a daemon on the enterprise gateway (Debian-based). This program would handle data collection from the sensors, apply some custom logic, and then publish to an MQTT broker.
I’d love to hear your thoughts on this approach and the trade-offs between using Node-RED vs. a custom program for this kind of setup.
Running a Node.JS script on the gateway is certainly possible, however I am not sure what you would gain in doing this rather than simply using Node-Red. What you are describing is possible and quite easy to implement in Node-Red. You can use a function node to customize the output data and an MQTT out Node to publish the data to the broker in Node-Red. Can you explain more what you are trying to do in the Node.JS script?
We have an article here on publishing data to an MQTT Broker in Node-Red:
Thanks for your response.
I’m building a multi-tenant system and I am evaluating custom/daemon process because of the following reasons
a) Control over gateway. With Node-Red anyone that have access to the system can modify the flow. I could lock down node-red interface with credentials, but still I don’t know if I can track the changes that were made by anyone.
b) Ci/Cd. In my multi-tenant system, eventually the sensor fleet will grow. Instead of configuring sensors and node-red flows individually, I can push updates to the gateway via CiCd process.
c) Language choice. Rust over NodeJs for maximum performance.