I'm looking at Node-RED to build an IoT dashboard type of website. I want to figure out if Node-RED is the right tool for the job as early as possible.
We have IoT devices with GPS and some digital I/O monitoring some machines. The IoT devices wake up every 15 minutes and publish a status update to an MQTT broker.
We want to display the location of the devices as pins on a map. This is possible with
worldmap in and
worldmap nodes. However, I need to prevent the pins from being dragged. The pins should show where the units are. Users can't just move them around.
Furthermore, what tools exist for user account info and user privilege structure? We need to implement admin users, who can add user accounts and assign machines to them. That user would then only see a filtered subset of all machines on the map.
Is this possible in Node-RED without writing a lot of custom nodes? If not, it wouldn't make sense to use Node-RED for this. Then a full-blown web framework is maybe a better option. What are your thoughts on this? I'd really appreciate the opinion of more seasoned Node-RED users.
I'm currently struggling with the same issue. The standard dashboard can't handle multiple users, and neither has a privilege structure.
There are some workarounds (like having a main instance to handle everything and a separate instance for each type of user, for instance), but I haven't seen good, straightforward approaches to it.
Node-red dashboard is not multi user.
The world map node uses leaflet under the hood.
You could create a simple (web) endpoint with the http-in/out nodes and handle the authentication there.
Thanks for the response!
The standard dashboard can't handle multiple users
Does this mean it can only serve one client at a time? If so, this is a non-starter.
No, dashboard can be served to many users BUT certain actions will affect all users.
dashboard is not the only UI possible. You can ...
- DIY a full web server using HTTP-in, HTTP-response nodes
- DIY a full web server using
httpStatic setting to host a directory of HTML/CSS/JS
- DIY a full web server using node-red-contrib-uibuilder
- This one takes care of a lot of the boilerplate helping you get a fulll SPA / web site running in VUE/[whatever-framework-you-wish]
- others - there are a few multi user dashboards but i have not used any (others might point you in the right direction)
The endpoints you setup using http-in & http-response can server many clients at once - but you need to be mindful of how node-red (and nodejs) works to be able to understand when and when not to set/retrieve any shared context.
One thing to point out is that you can do the authentication part using an external tool such as a reverse proxy and I generally recommend that anyway.
However, that doesn't get around the fact that Dashboard can't easily take such things into account.
uibuilder, on the other hand has a number of custom middleware features that let you make use of external authentication schemes. The trade-off being that you need to write some front-end code (html/js) for your Dashboard rather than Dashboard holding your hand. The amount of code can be drastically reduced by using a decent framework such as Vue or Svelte since there are many existing custom components you can use. I've even demonstrated some html web components recently that work nicely with uibuilder. Custom components appear in your html as a simple tag very similar to standard html tags. But they can do all sorts of complex things behind the scenes if needed.
You can do the same with http-in/-out nodes but then you have to do a lot of things manually that uibuilder does for you such as creating websocket comms connections between node-red and your front-end, serving up front-end libraries, dealing with clients connecting and disconnecting and much more.