Not understanding how/when Dashboard UI updated

What do you mean by refreshing the ui node. A ui node will display whatever data is has been sent. There is no need to refresh anything. Looking at the flow you posted in the first post the Time Growing node will show whatever was sent to it by the triggering of the inject node on startup. If it isn't showing anything then that means it was not sent anything by that initial inject, or it has been cleared by a later output. I notice you have two inputs to the function node, perhaps that is a clue. To check that, add a debug node connected to the output of the function node, give the debug node a name, and set it output to the console and restart node-red in a terminal and you will see what gets sent to the Time Growing node on startup.

[Edit] Alternatively, if you are picking up data from context in the function node then perhaps that data has not yet been initialised when you first run the function.

Dashboard widgets created at the moment you open/refresh the dashboard. Means that they die at the moment you close the page (or do refresh). No way the dead widget can talk with the server side. Widgets are always created from scratch. They have knowledge only about the configuration the user has been set up. No data, no values. (can have some kind of default value) Widgets are so to say "dummy". They don't care about your flow, they do respect agreed protocol of incoming messages. Like - if the msg.payload contains a number, I'll show it.

May be it is simpler to think about it like push messaging system where dashboard widgets can only react to the messages the server side sends.

There is one side effect which may seem a bit confusing. The dashboard has "replayMessage" system built in. Simplified explanation may be something like this: In case of dashboard page opened, the server side (re)sends last known message for each widget.

This way you can create simpler flows where you don't have take any care about existence or state of the dashboard in your flow logical part. You do your calculations and send calculated value to the dashboard widget and that's it.

Of course the world is not that simple and there is many cases where the replayMessage system is not enough and then there is ui_control node, firing messages when dashboard connects. Taking this as trigger, you can make decisions to run some flows to calculate again or retrieve some states from devices or what ever it takes to satisfy your needs and again send the results to the dashboard widgets to show.

That is exactly what I do and what I had suggested here

But for a ui text node that is not necessary, as the text node remembers what it is supposed to be displaying, as do all the basic dashboard nodes I believe. So for this sort of display it is not necessary to refresh, which is why I was attempting to simplify the problem for the OP.

1 Like

Mostly the ui_control node is needed when widget's configuration is changed on fly. Like if you change gauge's min and max values and maybe some other properties with control message. As widget can't remember those changes and then if you do page reload - the widget is created from scratch and the min and max values are taken from configuration defaults again. So the widget shows up with wrong state so to say.

In such cases you'll need to create smart enough flows wired to the ui_control node to determine current state and send correct control message to the widget.

1 Like

You are right. I understood the situation a little differently - I thought they wanted to calculate at the time the user connected to the ui or changed pages. Many ways to ski the cat I guess!

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