How to add a hourly, daily and weekly time stamp to this flow?

Hey everyone, I'm trying to add a hourly, daily and a weekly timestamp to my power monitor so I can add a graphic in the UI. How can i solve this? my code that I now use is:

[
    {
        "id": "42d1b955dcf41c8b",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "eb7d301a114495cb",
        "type": "change",
        "z": "42d1b955dcf41c8b",
        "name": "Dal",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "as.dsmr.electricity_consumed",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "dagelijksdal",
                "pt": "global",
                "to": "0",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "vorigdal",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 210,
        "y": 60,
        "wires": [
            [
                "dd89a7b0c12d6946"
            ]
        ]
    },
    {
        "id": "dd89a7b0c12d6946",
        "type": "function",
        "z": "42d1b955dcf41c8b",
        "name": "Total usage",
        "func": "msg.payload = \"Total usage today is \"+msg.payload\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 60,
        "wires": [
            []
        ]
    },
    {
        "id": "14eee259c6d1e3c2",
        "type": "change",
        "z": "42d1b955dcf41c8b",
        "name": "Normaal",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "dagelijksnormaal",
                "tot": "global"
            },
            {
                "t": "set",
                "p": "dagelijksnormaal",
                "pt": "global",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 220,
        "y": 100,
        "wires": [
            [
                "362215c5d4155d3a"
            ]
        ]
    },
    {
        "id": "362215c5d4155d3a",
        "type": "function",
        "z": "42d1b955dcf41c8b",
        "name": "Total usage",
        "func": "msg.payload = \"Total usage today is \"+msg.payload\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 430,
        "y": 100,
        "wires": [
            []
        ]
    },
    {
        "id": "4b8fcc8e2e545b7d",
        "type": "link in",
        "z": "42d1b955dcf41c8b",
        "name": "link in 3",
        "links": [
            "6ad14b5ee275592c"
        ],
        "x": 65,
        "y": 60,
        "wires": [
            [
                "eb7d301a114495cb",
                "14eee259c6d1e3c2",
                "1bd5ab265895cafd",
                "204e69745d1a563b",
                "3ddfc05ba7ca9f1f"
            ]
        ]
    },
    {
        "id": "93c4bc7656fcddca",
        "type": "ui_gauge",
        "z": "42d1b955dcf41c8b",
        "name": "Stroom nu",
        "group": "88cbb72.df21948",
        "order": 1,
        "width": "3",
        "height": "3",
        "gtype": "donut",
        "title": "Stroom nu",
        "label": "W",
        "format": "{{value}}",
        "min": 0,
        "max": "6000",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "diff": false,
        "className": "",
        "x": 430,
        "y": 160,
        "wires": []
    },
    {
        "id": "58be79da62830da6",
        "type": "ui_chart",
        "z": "42d1b955dcf41c8b",
        "name": "VerbruikGrafiek",
        "group": "88cbb72.df21948",
        "order": 2,
        "width": 0,
        "height": 0,
        "label": "",
        "chartType": "line",
        "legend": "false",
        "xformat": "dd HH:mm",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "",
        "ymax": "",
        "removeOlder": "1",
        "removeOlderPoints": "10000",
        "removeOlderUnit": "604800",
        "cutout": 0,
        "useOneColor": false,
        "useUTC": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "outputs": 1,
        "useDifferentColor": false,
        "className": "",
        "x": 440,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "1bd5ab265895cafd",
        "type": "change",
        "z": "42d1b955dcf41c8b",
        "name": "Convert",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.dsmr.electricity.currently_consumed",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 220,
        "y": 180,
        "wires": [
            [
                "93c4bc7656fcddca",
                "58be79da62830da6"
            ]
        ]
    },
    {
        "id": "204e69745d1a563b",
        "type": "change",
        "z": "42d1b955dcf41c8b",
        "name": "Convert",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.dsmr.electricity.consumed_tariff_1",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 220,
        "y": 260,
        "wires": [
            [
                "b41ec5b756013521"
            ]
        ]
    },
    {
        "id": "b41ec5b756013521",
        "type": "function",
        "z": "42d1b955dcf41c8b",
        "name": "KWh naar Euro",
        "func": "kwhprijs = 0.39 //39 cent\ncalc = parseFloat(msg.payload * kwhprijs).toFixed(2);\nvar msg1 = { payload: calc };\nreturn [msg1];",
        "outputs": 1,
        "noerr": 4,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 440,
        "y": 260,
        "wires": [
            [
                "4b0fa182e261d70e"
            ]
        ]
    },
    {
        "id": "4b0fa182e261d70e",
        "type": "ui_text",
        "z": "42d1b955dcf41c8b",
        "group": "88cbb72.df21948",
        "order": 3,
        "width": "6",
        "height": "1",
        "name": "Dal tarief",
        "label": "Dal tarief totaal",
        "format": "{{msg.payload}} Euro",
        "layout": "row-spread",
        "className": "",
        "x": 640,
        "y": 260,
        "wires": []
    },
    {
        "id": "3ddfc05ba7ca9f1f",
        "type": "change",
        "z": "42d1b955dcf41c8b",
        "name": "Convert",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.dsmr.electricity.produced_tariff_2",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 220,
        "y": 340,
        "wires": [
            [
                "1e1abf082b0bc28c"
            ]
        ]
    },
    {
        "id": "1e1abf082b0bc28c",
        "type": "function",
        "z": "42d1b955dcf41c8b",
        "name": "KWh naar Euro",
        "func": "kwhprijs = 0.39 //39 cent\ncalc = parseFloat(msg.payload * kwhprijs).toFixed(2);\nvar msg1 = {payload:calc};\nreturn [msg1];",
        "outputs": 1,
        "noerr": 4,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 440,
        "y": 340,
        "wires": [
            [
                "90915c3029c62b00"
            ]
        ]
    },
    {
        "id": "90915c3029c62b00",
        "type": "ui_text",
        "z": "42d1b955dcf41c8b",
        "group": "88cbb72.df21948",
        "order": 4,
        "width": "6",
        "height": "1",
        "name": "Normaal tarief",
        "label": "Normaal tarief totaal",
        "format": "{{msg.payload}} Euro",
        "layout": "row-spread",
        "className": "",
        "x": 660,
        "y": 340,
        "wires": []
    },
    {
        "id": "9d441194cf5b4af9",
        "type": "debug",
        "z": "42d1b955dcf41c8b",
        "name": "debug 3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 140,
        "wires": []
    },
    {
        "id": "88cbb72.df21948",
        "type": "ui_group",
        "name": "Elektra",
        "tab": "bfc64ecd.f4499",
        "order": 8,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "bfc64ecd.f4499",
        "type": "ui_tab",
        "name": "Energie",
        "icon": "dashboard",
        "order": 1
    }
]

Moved to Dashboard

@marky Welcome to the forum!

Your flow has a couple errors in the two 'KWh near Euro' function nodes The first two lines of both should start with a 'let'

The flow also has a link-in node where the msg's would be coming into this flow, how ever no one else but you knows what the data would be like. It would be helpful if you attached a debug node to the link-in node and then copy and past the data to a result. That way people could reproduce your floe.

What do you mean you want an hourly, daily and weekly timestamp, can you provide an example of what you mean? Do you just want to display them on the dashboard? It is unclear (to me) what you want.

  • What version of NR and node-js are you running (you can get this from the startup log)
  • What device are you running it on and what OS?

thank you, for your answer. I couldn't figure it out with the KWH naar Euro. with the other thing its already fixed because of someone else. thank you for taking the time to look at it.

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