Display data on a chart with a specific time interval

Good afternoon,

I'd like to display MQTT data on a UI chart (float and boolean values). The data are sent every 30s thanks to a simple timestamp.

The problem is that on the charts for boolean values, I noticed that the values are displayed every seconds, not every 30s like float values. As a result, it tremendously slows down the system. Yet I saw that boolean values are sent at the same time, throughout a debug node. So I don't understand why there is a difference on the processing of this particular type of value.

How can I set a timestamp in order to be sure that boolean values are displayed every 30s, like float values ? I saw that it is possible to set a timestamp for x-axis, but it only changes the scale and the step. That's not what I want.

Thank you.

Which dashboard are we discussing?

How exactly are the floats and booleans sent to this chart?

I would surmise that the booleans are being sent every second, as it would seem strange that the chart is adding an extra 29 readings.

Maybe supply example input in inject nodes and a export of a simple flow that shows the issue.

It is the chart node (ui_chart).

Each data is separated into a msg, for example msg.payload = "On_Off=0" and msg.Value = false.
Then, through change nodes and other nodes (I use some subflows), I succeed to put the value into a msg.payload, in order to display it on the chart. It is exactly the same process for floating values. Unfortunately, boolean values are displayed every second...

You can see the difference of the number of points on the following picture :


It is "1" when it's TRUE and "0.5" when the value is neither 0 nor 1 (it is a proof that the graph put values every seconds).

Is it more clear ?

Here is a flow which briefly shows the issue :

[
    {
        "id": "a4acf5dc1a1609b1",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "63a42e24cf2e32f0",
        "type": "inject",
        "z": "a4acf5dc1a1609b1",
        "name": "Fake BOOL data from MQTT",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "10",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 370,
        "y": 420,
        "wires": [
            [
                "5741547470c9b752"
            ]
        ]
    },
    {
        "id": "91d819c35268a0cc",
        "type": "inject",
        "z": "a4acf5dc1a1609b1",
        "name": "Fake FLOAT data from MQTT",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "10",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "53",
        "payloadType": "num",
        "x": 370,
        "y": 380,
        "wires": [
            [
                "71faf1e86e5c4643"
            ]
        ]
    },
    {
        "id": "5741547470c9b752",
        "type": "ui_chart",
        "z": "a4acf5dc1a1609b1",
        "name": "",
        "group": "ecfba9d6f29c06b2",
        "order": 0,
        "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": "60",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 790,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "71faf1e86e5c4643",
        "type": "ui_chart",
        "z": "a4acf5dc1a1609b1",
        "name": "",
        "group": "ecfba9d6f29c06b2",
        "order": 0,
        "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": "60",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 790,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "65485558cfe68631",
        "type": "comment",
        "z": "a4acf5dc1a1609b1",
        "name": "All data are sent every 30s",
        "info": "",
        "x": 330,
        "y": 340,
        "wires": []
    },
    {
        "id": "a3bcd5ee3101268d",
        "type": "comment",
        "z": "a4acf5dc1a1609b1",
        "name": "On my real flow, bool data are sent every 1s",
        "info": "",
        "x": 1030,
        "y": 420,
        "wires": []
    },
    {
        "id": "ecfba9d6f29c06b2",
        "type": "ui_group",
        "name": "Default",
        "tab": "54e197d8.7f7fe8",
        "order": 1,
        "disp": true,
        "width": "16",
        "collapse": false,
        "className": ""
    },
    {
        "id": "54e197d8.7f7fe8",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

That flow draws two charts for me, each with just one point on the line every 10 seconds.

I suspect something in your subflow sends extra messages to the "boolean" chart

Can you use a debug node to show what is being fed to the "boolean" chart?
image

I asked which dashboard not what node. I have figured it is node-red-dashboard by looking at your flow.

It is still not clear, as the flow you post shows no signs of the behaviour you show in your image. Can you post a flow that shows the behaviour. You need to have the injects that simulate the mqtt in nodes and the flow that then creates the output shown in the image you have posted.

From what I see there is something you have not shown that is sending extra messages.

Unfortunatley I can't succeed to reproduce the behaviour of my real architecture only with inject nodes. When I try it, the charts display data normally, the way I wanted (one sample every 30s for both).

However, in my real architecture, every 30s :

  • floating values --> 1 sample

  • boolean values --> 30 samples

The best way I found to explain my issue is to see the picture below. It shows well the issue.

Please tell me if you want additionnal informations.

So if you replace your mqtt-in with inject nodes, the problem goes away.

  1. Is everything else in your two flow versions identical?
  2. Have you verified that mqtt-in messages do actually arrive at the expected frequency?

You have actually explained the problem very clearly, no need to reiterate it. :grinning:
Better to try and fully answer questions. We understand what's happening, and are trying to think of possible causes.

I have a list of variables I want to retrieve (float and bool together), they all are linked to the same injection node, which is used as a looper. Mqtt nodes are associated for each variable, but they are not linked to the rest of my architecture. In fact they are "isolated", linked to nothing :

I start to think that maybe because of this reason, the system chooses by default to inject data every seconds in the process. It would ignore my looper at the beginning.

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