Hello everyone,
I'm asking this question here in the community, because people here know a lot about node-red, but also have a lot of experience with different hardware.
I need advice on a way to achieve what I have planned. Luckily there are so many options out there that I just don't know what will get me to the goal.
Ok now to the essentials.
I work mostly with Siemens CPU S7. So far I used node-red for visualization through the dashboard and small manipulation of values from the PLC. Additionally I collected information from other devices and passed it to the PLC. For this, nore-red has been wonderful and I am very satisfied how well, with the help of the community here in the forum, everything has worked out.
Currently I am learning flutter and dart for mobile app development. And I want to be able to control the PLC with the app I'm developing. The app should have user management so that multiple users can control and monitor the PLC with their own interface.
The thinking for this was to use node-red as the backend and receive input from the app and then send it on to the PLC. The same with the incoming values. The PLC sends the values via node-red to the app.
Which component do I need to realize this? What do I need for this?
My considerations are as follows:
- Creation of a rest API which is then accessed by the app and node-red?
- Communication to node-red via MQTT, using raspi as broker?
- Using node-red api, is that possible?
- http requests. not sure what tools i need for this.
Can someone maybe give me a quick guide on what communication path I can take and what tools I need for this?
Due to the fact that there are so many different things, it would be a waste for me to learn anything only to find out later that it is not suitable for my project.
- I will also recommend not just relying on Node-RED to deliver your API even if you decide to stick with it longer term rather than moving it onto GO or RUST for additional performance. As a REST API is "just" HTTP based, you can make full use of HTTP services such as a web server like NGINX or my current favourite, Caddy. I recommend this for several reasons. First being performance, while not likely to get as much of a gain as with more static assets, there is still a good chance that a web server fronting Node-RED will give you some gains with caching. Possibly also load balancing if you need to scale horizontally. Then there is security. Node-RED does of course support some basic (and not so basic in some cases) security directly but it is a complex and fast-moving platform that is not specifically designed for security. So the security part of me says that a front-end tool is a sensible precaution. You can offload HTTPS processing which will certainly give you performance gains (using a multi-threaded web server rather than a single threaded app). You can also offload authentication and authorisation as well. Leaving Node-RED to get on with doing what it does so well.