# Single dashboard for multiple PI through MQTT

**URL:** <https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248>\
**Category:** Dashboard\
**Created:** [2 February 2021 16:13 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248 "2021-02-02T16:13:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![HZB](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@HZB](https://discourse.nodered.org/u/HZB)\
**Post date:** [2 February 2021 16:13 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/1 "2021-02-02T16:13:45Z")

</div>

Hi Everyone,

I am newbie & just learning Node Red. So i need help!  
I need to get status of 23 different machines by using 4 different buttons and need to show all this information in a single dashboard. My idea is to use 23 different PI on a same network and send data using MQTT and run Node Red on my PC to make a Master Dashboard. Is it a right way? any other suggestion.

And i need help in establishing MQTT broker in my PC.

Thanks!

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [2 February 2021 16:20 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/2 "2021-02-02T16:20:27Z")

</div>

You need to speak with Andrew @Trying_to_learn, he has built such a system.

---

<div class="post-metadata">

**Author:** ![HZB](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@HZB](https://discourse.nodered.org/u/HZB)\
**Post date:** [2 February 2021 16:22 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/3 "2021-02-02T16:22:47Z")

</div>

@Trying_to_learn Hi Andrew please take a look. Thanks.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 February 2021 16:45 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/4 "2021-02-02T16:45:11Z")

</div>

The concept of using MQTT on the PC with a master dashboard to display the information from all the machines is a good plan I think. Though you might like to consider the idea of a separate server to run node red and the broker on, and connect to that with your PC (or any other PC or device on the network). Otherwise if your PC is not available the dashboard will not be. Also if you are logging data then that can be done in the server.  
I suggest using Mosquitto as the broker on the server/PC. If it is running Ubuntu then to set the broker up is just  
`sudo apt install mosquitto`  
and the default config may well be exactly what you want. If you are using Windows then I imagine it is similarly easy but I can't help with that.

When it comes to how to organise the MQTT topics then think carefully about that in advance. You may well want, for example, the top level topic to be something like a machine id so you can switch between machines in the dashboard just by subscribing to `id1/some/topic` or `id2/some/topic`. Doing that you could have one dashboard page for the details of a machine and use a dropdown or something similar to select the machine you want and use that to route the data from the appropriate MQTT In node to the dashboard. Then the dashboard itself will work for any machine.

---

<div class="post-metadata">

**Author:** ![HZB](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@HZB](https://discourse.nodered.org/u/HZB)\
**Post date:** [2 February 2021 18:47 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/5 "2021-02-02T18:47:38Z")

</div>

thanks,  
what are the pros and cons of using IBM Cloud for Master Dashboard, rather than a designated PC running 24/7?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [2 February 2021 19:58 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/6 "2021-02-02T19:58:52Z")

</div>

> [@HZB](#):
>
> what are the pros and cons of using IBM Cloud for Master Dashboard

Because a cloud server will have redundancy, with almost guaranteed uptime, whilst a local PC may have increased downtime - power cuts, updates, faults, etc.

It depends how important that the resilience of your master dashboard is to you, and how risk averse that you are.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 February 2021 20:38 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/7 "2021-02-02T20:38:26Z")

</div>

A con is that if the internet connection goes down then you have no dashboard.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [3 February 2021 01:31 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/8 "2021-02-03T01:31:31Z")

</div>

Yeah, I've got a similar thing going.

(Not to show off, but this is a screen shot of my equivalent to what you want to do.)

 ![Screenshot from 2021-02-03 12-29-34](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/47bb98700181c5242f3dbc175777eb2eed1b16c7.png)

But you really need to take it in steps.

First off determine EXACTLY what you want the machines to do.  
What information they send, etc.

Then: how it is displayed.

How are errors handled.

How are machines locking up handled.

Reboots, etc.

And even maybe updates, and backups.

I say all this because it is a _mine field_ of things. I have had a lot of learning to do with things that at first weren't considered but as time went on, they became needed and that was painful.

Also, learn a lot about **sub-flows**.  
They will save you a lot of grief in so many ways.

Rather than messing around with 23 sets of code for the 23 machines (on the one) and having to sit there for hours rolling out an update to all the other 22...... Use subflows.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 February 2021 11:38 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/9 "2021-02-03T11:38:36Z")

</div>

@HZB Another idea you might like to consider is to have local mosquitto brokers on each of the Pis (which is very easy to setup) and use MQTT Bridging to automatically synchronise selected topics with your central broker. Then you could have both a Cloud broker and one on the PC (both bridged from the Pis) and can run exactly the same dashboard connected to the PC broker or the cloud one.

Also you could run a subset of the dashboard in each of the Pis so you could have a local display at each machine which is only reliant on the Pi and not the remote brokers at all.

---

<div class="post-metadata">

**Author:** ![HZB](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@HZB](https://discourse.nodered.org/u/HZB)\
**Post date:** [3 February 2021 13:17 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/10 "2021-02-03T13:17:17Z")

</div>

@Colin  
Can you recommend me any example to learn how to use MQTT. I am really noob in this matter. Just started Node Red and it's fun and good. Thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 February 2021 13:40 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/11 "2021-02-03T13:40:33Z")

</div>

> [@HZB](#):
>
> Can you recommend me any example to learn how to use MQTT

The best introduction I have found is [MQTT Essentials - All Core Concepts Explained](https://www.hivemq.com/mqtt-essentials/). You can work through it online, or I see there is now a e-book available.

---

<div class="post-metadata">

**Author:** ![HZB](https://avatars.discourse-cdn.com/v4/letter/h/77aa72/32.png) [@HZB](https://discourse.nodered.org/u/HZB)\
**Post date:** [4 February 2021 13:45 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/12 "2021-02-04T13:45:05Z")

</div>

@Trying_to_learn  
Thanks

Can you tell me which node did you used for this part? ![vghjb](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8ff3ff25948a8430a0ee950470d802f6e5c52fa2.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [4 February 2021 17:51 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/13 "2021-02-04T17:51:21Z")

</div>

@HZB - please don’t open a thread AND post the same question in another thread, it just wasted people’s time.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [4 February 2021 20:06 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/14 "2021-02-04T20:06:54Z")

</div>

That is a lot of `button` nodes.

The `button` is set so it shows the icon and colour of the message it receives.

Each _icon_ (button) represents a machine and there are different colours and icons depending on the machine's state.

That may be a bit ahead of what you want to do just now.

This is because you need to work out which conditions you want to detect and how they will be shown.

For instance:  
`msg1 = {payload: '<font color = "red" i class="fa fa-exclamation-circle fa-2x"></i></font>'};`

Is shown if a serious condition happens.  
This is also shown until the button is pressed and then it goes back to .... _normal_.  
(That's a whole other story)

But I hope that helps you in some way.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [4 February 2021 20:29 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/15 "2021-02-04T20:29:52Z")

</div>

To keep things here and not in the other thread, this is how I have the `button` node set:

```auto
[{"id":"de1cd0.47fce33","type":"ui_button","z":"c636aa5a.cc34","name":"83","group":"1f5fe937.c354c7","order":2,"width":"2","height":"1","passthru":false,"label":"<font size =\"4\">83</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{msg.payload}}","tooltip":"","color":"","bgcolor":"#333333","icon":"","payload":"HEALTH_ACK","payloadType":"str","topic":"","x":1390,"y":1190,"wires":[["176f7b4f.d7fb5d","be5e454f.a21318"]]},{"id":"1f5fe937.c354c7","type":"ui_group","name":"Cat-5","tab":"1c792414.600e94","order":3,"disp":true,"width":"10","collapse":false},{"id":"1c792414.600e94","type":"ui_tab","name":"Telemetry","icon":"track_changes","order":2,"disabled":false,"hidden":false}]

```

You will have to edit the `name` field to more suit your set up.

I did/was/am thinking that the name is actually set by the computer, but as I run fixed IP addresses, it wouldn't serve much purpose.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [4 February 2021 20:37 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/16 "2021-02-04T20:37:11Z")

</div>

This is what you are getting into for displaying multiple device status on a machine.

The bigger picture

 ![Screenshot from 2021-02-05 07-31-35](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/5/655836cb0d469a2b66942bbeba8fb939631471b3.png)

Where sub-flows become handy.

 ![Screenshot from 2021-02-05 07-32-03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f1388970b27aa7d7bf7ab5ee6a911521a974193c.png)

What they were before sub-flows.

 ![Screenshot from 2021-02-05 07-32-11](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/caf773a92f34cb814aa618380cc58bcf63d3db24.png)

And even then: before the sub-flow it was painful, and the big `function` node in the middle was hard to maintain. As any update had to be rolled out _n_ times for each device.

Now with the sub-flow, it only needs to be done once.

There are some problems with this, but not anywhere near as bad as the problems doing it this way fixes.

# Update:

Just to show you some of the stuff which happens on the dashboard.

All _normal_:

![Screenshot from 2021-02-05 10-35-20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/726fcef9037a51bd8360c67dc704833aa41cb745.png)

Machine booting:

![Screenshot from 2021-02-05 10-35-43](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/1/3164751f1715f689f946cf55890d566d4341fcd2.png)

Booted:

![Screenshot from 2021-02-05 10-36-33](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/d/1dd3491d7b4b6114305855c752c6f6468bc56258.png)

(Yeah, ok, the colour scheme may need tweaking.)

Ack the boot (Click on the button):

![Screenshot from 2021-02-05 10-36-46](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/3/63ae233c001fe2324c08a073e6eccf78f8612360.png)

And at last, All good:

![Screenshot from 2021-02-05 10-37-03](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/737231f0cec33f2628a5295276e12d7c1f5c8907.png)

This is a lot of stuff going on and I am not saying you have to do this.

I just got involved in showing status of machine etc and really got hooked on it.

There is/are also health messages and if the machine locks up on boot - or more precisely: NR doesn't start up in a given time.

But just to show you things that if you don't consider now, can really bite you hard in the future when you try to apply them into the scheme.

---

<div class="post-metadata">

**Author:** ![russ57](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@russ57](https://discourse.nodered.org/u/russ57)\
**Post date:** [10 February 2021 12:22 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/17 "2021-02-10T12:22:07Z")

</div>

You mentioned a pi for each machine. If all you have connected on each is 4 buttons, the pi may be overkill. I'd look into an esp8266 of some type, or an esp32. Much cheaper, smaller, lower power., and wifi. Or if you need higher reliability from comms, an arduino of some type with ethernet.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 February 2021 22:11 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/18 "2021-02-10T22:11:25Z")

</div>

Yes @russ57 but you also need to understand that I can only work with what I have.

And know only what I know.

At the time I didn't have an `esp32` (or similar). And they don't have dashboards/web GUIs.

It works with all 10 Raspies on, but that isn't that often. ☹  
The load is low - though it does spike every now and then.

---

<div class="post-metadata">

**Author:** ![russ57](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@russ57](https://discourse.nodered.org/u/russ57)\
**Post date:** [11 February 2021 00:56 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/19 "2021-02-11T00:56:09Z")

</div>

No issues whatsoever with using what you have. From a long term reliability view, and cost for 23 pi and power supplies and cases, it could be worth investigating. You haven't said what the machines are, or the requirements for reliability, and perhaps the hardware cost is insignificant compared to other factors. But development on the esp platform is pretty simple.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [11 February 2021 06:30 UTC](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248/20 "2021-02-11T06:30:19Z")

</div>

> [@russ57](#):
>
> But development on the esp platform is pretty simple.

Plus, there are some ready-to-go firmwares like ESPeasy, so you don't even have to write a single line of C code. If you're just doing "simple" stuff, like reading sensors (one wire, I2C, ...), inputs from switches or control some relays, these are more than sufficient. Wifi and MQTT included. Those devices boot nearly instantly after power up, and consume only a fraction of the power. And you don't have to worry about power outages that could damage your filesystems.

I abandoned the RPi for these kinds of tasks a long time ago, much less maintenance work. Think of all the OS updates/upgrades you'd have to do for 23 RPis... 🤯

[Next page](https://discourse.nodered.org/t/single-dashboard-for-multiple-pi-through-mqtt/40248.md?page=2)
