# Update text / gauge when load the page with latest value

**URL:** <https://discourse.nodered.org/t/update-text-gauge-when-load-the-page-with-latest-value/20925>\
**Category:** General\
**Created:** [27 January 2020 19:44 UTC](https://discourse.nodered.org/t/update-text-gauge-when-load-the-page-with-latest-value/20925 "2020-01-27T19:44:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucianv](https://avatars.discourse-cdn.com/v4/letter/l/cab0a1/32.png) [@lucianv](https://discourse.nodered.org/u/lucianv)\
**Post date:** [27 January 2020 19:44 UTC](https://discourse.nodered.org/t/update-text-gauge-when-load-the-page-with-latest-value/20925/1 "2020-01-27T19:44:54Z")

</div>

Hi,  
I have a simple flow which is an mqtt in node which is read by a gauge and also by a function that insert into db the temp value received on the mqtt topic. If I have the page opened and mqtt receive a temp then the gauge is updated (and of course function insert it to db as well), but the issue is when I open the web page on another device and there was no mqtt message, i get nothing in the gauge. How can I make that gauge to be updated with latest value when web page is loaded?

Thanks

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [27 January 2020 19:50 UTC](https://discourse.nodered.org/t/update-text-gauge-when-load-the-page-with-latest-value/20925/2 "2020-01-27T19:50:56Z")

</div>

ui\_control node does this trick for you. It fires message whenever dashboard connects to serverside. So you can then retrieve your last value (you'll have to store it somewhere of course) And then send it to gauge or text.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/0/80df2f2262f6b32e92664dc8206c06b256588a72.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 January 2020 19:51 UTC](https://discourse.nodered.org/t/update-text-gauge-when-load-the-page-with-latest-value/20925/3 "2020-01-27T19:51:53Z")

</div>

If there was at least one message then the gauge should show that. There should be no need to store it. If I do

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/0/707acbcfe26373ea8bbde8ac71c60830a86f216c.png)  
deploy - then click inject.... then open a browser pointing at dashboard - the gauge displays correctly.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [27 January 2020 20:04 UTC](https://discourse.nodered.org/t/update-text-gauge-when-load-the-page-with-latest-value/20925/4 "2020-01-27T20:04:30Z")

</div>

Technical talk -  
It may be that at the time the replayMessage is received, the elements can not be rendered yet (not yet in DOM). I don't remember I ever seen this problem with gauge node but with custom nodes experienced many times. May depend on device/memory/capability combination

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 March 2020 20:04 UTC](https://discourse.nodered.org/t/update-text-gauge-when-load-the-page-with-latest-value/20925/5 "2020-03-27T20:04:44Z")

</div>

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