Why does ui-chart send an output on deploy?

If you have a ui-chart connected to a debug node (set to display the complete msg object) and do a deploy, the chart node generates a output message that only contains a message id.

Is this an expected action?

Example: add a ui-chart node and connect it to a debug node and deploy - you will get a debug message. Now move the debug node and deploy - again you will get a debug message.

[{"id":"f3a06472.243898","type":"debug","z":"669c4b6d.12eeec","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":650,"y":80,"wires":[]},{"id":"6523ad93.9650a4","type":"ui_chart","z":"669c4b6d.12eeec","name":"","group":"40bd93c3.99ddc4","order":1,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":510,"y":80,"wires":[["f3a06472.243898"]]},{"id":"40bd93c3.99ddc4","type":"ui_group","z":"","name":"G2a","tab":"4a34bda3.d0031c","order":2,"disp":false,"width":"28","collapse":false},{"id":"4a34bda3.d0031c","type":"ui_tab","z":"","name":"GRID","icon":"dashboard","disabled":false,"hidden":false}]

This came about while helping a user on this thread

thank you ,
that helps...

This second statement is true only if you do a full deploy, right ? Doing a deploy only for modified flows will not display the debug message.

Nope, it WILL output a message with 'Modified Flows' - if you look at the icon in the image you will see that the icon indicates modified flows.

Interesting. I am getting a different result. If I deploy as modified flow there will be no debug message. I am running:

Node-RED: 1.0.3
node-red-dashboard: 2.22.1
Windows 10

Do you have the debug node set to display the complete msg object?
NR 1.0.6
dashboard 2.22.1
macOS

I just installed nr 1.1.0-beta-3 and I no longer see the issue.

Yes, I copy/pasted the flow you posted. It has the debug set to full message.

well in NR 1.1.0-Beta-3 if I move the node the issue doesn't happen, ut if I edit the chart node and change the label and deploy I get the output message. Let me try with nr 1.0.3

So with NR 1.0.3 moving the node does not cause the issue, but changing the label will cause it.

(Since it is cool here this morning, I'm off to do some digging in the yard - expanding our strawberry patch.)

1 Like

With modified flows deploy, if you move the debug connected to the chart it will deploy the chart too. With modified nodes deploy it should not.

I think we have gone off track a bit here worrying about different sorts of deploy. The crux is that when the Chart node is started or restarted it sends out an empty message (apart from id) which messes up flows that use the output to save the chart contents. I don't know whether it has always done that as I don't use that feature, but I am sure it is not supposed to.

Right, but why is the chart generating a message? That is the question.

That is the question, exactly.

I use the output of the ui_chart to persist data since some time (more than one year as far as I can remember). In order to overcome the empty message I used the same strategy that the OP found: a switch node in the output of the ui_chart node.

@dceejay - Dave, should the chart out put a msg if there is nothing in the msg other that the msg.id?

And that is with nothing connected to the chart inputs, it still sends a message on startup/deploy.

Yes. When the dashboard (re)connects it tries to update the widgets to the latest state/set of data that it has for them - which on a clean deploy will be nothing - and then the chart outputs its current state - which is now nothing.

So when using the output to update saved data for re-injecting on startup is the recommended technique to use a Switch node to prevent that from clearing the data? Without the Switch node the result is that it clears the data before it has been injected.

depends if you want to clear it on deploy or not