Design advice needed - large dashboard with multiple MQTT topics

HI there;
I have a large Indoor Air quality dashboard (see below). From the picture I hope you can approximate the complexity of the flow associated with it. The issue is that I have many identical sensors in various locations. If I want to view a dashboard for each, with my current knowledge, it looks like I would need to copy the entirety of the flow potentially dozens of time. Each is different in only the topic that it listens to. You can imagine the maintenance issues of duplicating the code base, not to say the computing demand on the poor little NAS this runs on.

What I imagined was to have only one dashboard but with a pulldown that holds all the specific topics for each sensor of the type IAQ and upon selection reload the dashboard with the appropriate data. But I can's seem to figure out how to dynamically switch the topic of the MQTT listener.

The only two options I see are:
1 - have the MQTT listener listen for all topics under the root .../IAQ/# and dynamically filter. But that can be a lot of useless filtering. or
2 - Forget completely listening to the MQTT in real time and make this strictly a Database Driven dashboard, and that means querying the database often.

Are there any other way I do not know and which would you recommend?

If you have a known list of topics maintained in Node-RED, you could use a dynamic MQTT subscription to only get the ones you want?

That is absolutely brilliant. I did not know that. Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.