Update text / gauge when load the page with latest value

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

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

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


deploy - then click inject.... then open a browser pointing at dashboard - the gauge displays correctly.

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

1 Like

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