# Dashboard Counter

**URL:** <https://discourse.nodered.org/t/dashboard-counter/17613>\
**Category:** Dashboard\
**Created:** [7 November 2019 02:24 UTC](https://discourse.nodered.org/t/dashboard-counter/17613 "2019-11-07T02:24:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![james\_scott74](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@james\_scott74](https://discourse.nodered.org/u/james_scott74)\
**Post date:** [7 November 2019 02:24 UTC](https://discourse.nodered.org/t/dashboard-counter/17613/1 "2019-11-07T02:24:39Z")

</div>

Hi,  
I'm new to node red but have found it fantastic in showing Temperature and Humidity readings with a DHT22 sensor and a raspberry pi 3B  
I have incorporated this in a 3.5" screen on an incubator and would really like to be able to run a counter on the dashboard so I know how many days remaining or have passed. Ideally with a reset button to initiate the timer/counter.  
Although I have seen an image of the dashboard with a basic counter I can't seem to see any code for it and am not proficient enough to do it myself.  
Does anybody have any example flows of this type of dashboard?  
Thanks

---

<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:** [7 November 2019 10:40 UTC](https://discourse.nodered.org/t/dashboard-counter/17613/2 "2019-11-07T10:40:01Z")

</div>

What I would do is start with an `inject` node - set to run once a day  
connect the `inject` node to a `counter` node  
connect the `counter` node to a `ui_text` node

Now you have your counter set up now to add the reset.  
add a `ui_button` node that will do the reset. But the `ui_button` node outputs sends msg.payload and if you look at the `counter` node, you will see you have to send msg.reset.

At this point I'll leave you to puzzle out how you could _change_ the msg coming from the `ui_button` node so that it contains msg.reset in addition to msg.payload.

Let me know how you are making out.

---

<div class="post-metadata">

**Author:** ![james\_scott74](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@james\_scott74](https://discourse.nodered.org/u/james_scott74)\
**Post date:** [7 November 2019 22:30 UTC](https://discourse.nodered.org/t/dashboard-counter/17613/3 "2019-11-07T22:30:48Z")

</div>

Thanks. I'll sit down and work on this on the weekend. I'll let you know how I go.

---

<div class="post-metadata">

**Author:** ![james\_scott74](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@james\_scott74](https://discourse.nodered.org/u/james_scott74)\
**Post date:** [11 November 2019 20:40 UTC](https://discourse.nodered.org/t/dashboard-counter/17613/4 "2019-11-11T20:40:46Z")

</div>

i found a flow with a counter that I was able to modify to do what I need. It isn't pretty but it counts SS:MM::HH::DD which is what I want.  
It turns out the graph side of things on a raspberry pi is great for a short term but i don't think my Pi can compute the data over a day without crashing. I'll remove the graph from the project and keep the counter, temp & humidity dashboard.  
I was using the dashboard to monitor temp and humidity rises and falls over a period of time but I now think I would be better off to have an email alert if the temp and humidity is too high or low.  
This will eliminate the need for the graph.

---

<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:** [11 November 2019 20:57 UTC](https://discourse.nodered.org/t/dashboard-counter/17613/5 "2019-11-11T20:57:36Z")

</div>

> [@james\_scott74](#):
>
> i don't think my Pi can compute the data over a day without crashing

How often are you adding points to the chart and over what time range is the chart set to display? Work out how many points that is on the chart, multiply that by the number of lines on the chart and that will tell you how many points the device has to shift across the chart each time you add a new point.  
Are you running the browser on the pi or on a separate PC? If it is on the Pi then almost certainly it is the browser hanging trying to do all that work. To improve matters send data to the chart less often. You can do that by putting it through a Delay node set to Rate Limit to 1 per minute (for example) and to Drop Intermediate Messages.

---

<div class="post-metadata">

**Author:** ![james\_scott74](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@james\_scott74](https://discourse.nodered.org/u/james_scott74)\
**Post date:** [11 November 2019 23:31 UTC](https://discourse.nodered.org/t/dashboard-counter/17613/6 "2019-11-11T23:31:59Z")

</div>

Thanks Colin (Genius!),  
You are correct in your train of thought. I have the chart reading data every second where really every 5 minutes would be sufficient. I am browsing the dashboard from the Pi which is mounted in my incubator door.  
I'll insert the delay node and am sure this will solve my issue.  
Thank you.
