FLOW: display remaining PV forecast for the day

Attached is a flow for a PV widget that shows the remaining PV forecast for the day, as well as the yield today/yesterday.

[
    {
        "id": "faf92e80713cf54c",
        "type": "vrm-api",
        "z": "9170653ac436c1aa",
        "vrm": "9ff0559f26b37445",
        "name": "",
        "api_type": "installations",
        "idUser": "",
        "users": "",
        "idSite": "11111",
        "installations": "stats",
        "attribute": "solar_yield_forecast",
        "stats_interval": "days",
        "show_instance": false,
        "stats_start": "0",
        "stats_end": "eod",
        "use_utc": false,
        "widgets": "",
        "instance": "",
        "vrm_id": "",
        "country": "",
        "b_max": "",
        "tb_max": "",
        "fb_max": "",
        "tg_max": "",
        "fg_max": "",
        "b_cycle_cost": "",
        "buy_price_formula": "",
        "sell_price_formula": "",
        "feed_in_possible": "",
        "feed_in_control_on": "",
        "store_in_global_context": false,
        "verbose": false,
        "x": 340,
        "y": 440,
        "wires": [
            [
                "c6e2afcf3a79a44a"
            ]
        ]
    },
    {
        "id": "6afa84914ed00ffc",
        "type": "debug",
        "z": "9170653ac436c1aa",
        "name": "PV forecast",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 440,
        "wires": []
    },
    {
        "id": "190dbb9176befb0c",
        "type": "inject",
        "z": "9170653ac436c1aa",
        "name": "Run function",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "*/1 5-19 * * *",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 380,
        "wires": [
            [
                "faf92e80713cf54c",
                "baca024c9e4e2456"
            ]
        ]
    },
    {
        "id": "c6e2afcf3a79a44a",
        "type": "function",
        "z": "9170653ac436c1aa",
        "name": "Remaining PV",
        "func": "var pv = msg.payload.totals.solar_yield_forecast/1000;\nvar result = pv.toFixed(1);\nmsg.payload = result;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 460,
        "y": 380,
        "wires": [
            [
                "6afa84914ed00ffc",
                "e3faabc1ef0bd2e5",
                "595b4d89c4509364"
            ]
        ]
    },
    {
        "id": "e3faabc1ef0bd2e5",
        "type": "ui-gauge",
        "z": "9170653ac436c1aa",
        "name": "PV remaining",
        "group": "544125946ced033e",
        "order": 3,
        "width": "4",
        "height": "3",
        "gtype": "gauge-half",
        "gstyle": "rounded",
        "title": "PV remaining",
        "units": "kWh",
        "icon": "",
        "prefix": "",
        "suffix": "",
        "segments": [
            {
                "from": "0",
                "color": "#ff2600"
            },
            {
                "from": "5",
                "color": "#ffc800"
            },
            {
                "from": "10",
                "color": "#0061ff"
            },
            {
                "from": "15",
                "color": "#00f900"
            }
        ],
        "min": 0,
        "max": "40",
        "sizeThickness": 16,
        "sizeGap": 4,
        "sizeKeyThickness": 8,
        "styleRounded": true,
        "styleGlow": false,
        "className": "",
        "x": 670,
        "y": 480,
        "wires": []
    },
    {
        "id": "bed817a14be0bcd0",
        "type": "ui-text",
        "z": "9170653ac436c1aa",
        "group": "544125946ced033e",
        "order": 4,
        "width": 0,
        "height": 0,
        "name": "Yield Today",
        "label": "Yield today (kWh)",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#717171",
        "className": "",
        "x": 670,
        "y": 560,
        "wires": []
    },
    {
        "id": "baca024c9e4e2456",
        "type": "vrm-api",
        "z": "9170653ac436c1aa",
        "vrm": "9ff0559f26b37445",
        "name": "",
        "api_type": "installations",
        "idUser": "",
        "users": "",
        "idSite": "11111",
        "installations": "stats",
        "attribute": "solar_yield",
        "stats_interval": "hours",
        "show_instance": false,
        "stats_start": "bod",
        "stats_end": "0",
        "use_utc": false,
        "widgets": "",
        "instance": "",
        "vrm_id": "",
        "country": "",
        "b_max": "",
        "tb_max": "",
        "fb_max": "",
        "tg_max": "",
        "fg_max": "",
        "b_cycle_cost": "",
        "buy_price_formula": "",
        "sell_price_formula": "",
        "feed_in_possible": "",
        "feed_in_control_on": "",
        "store_in_global_context": false,
        "verbose": false,
        "x": 290,
        "y": 520,
        "wires": [
            [
                "2fe639195e7ac221"
            ]
        ]
    },
    {
        "id": "2fe639195e7ac221",
        "type": "function",
        "z": "9170653ac436c1aa",
        "name": "Today PV",
        "func": "var pv = msg.payload.totals.solar_yield/1000;\nvar result = pv.toFixed(1);\nflow.set(\"yield\", result); \nmsg.payload = result;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 580,
        "wires": [
            [
                "bed817a14be0bcd0",
                "6afa84914ed00ffc"
            ]
        ]
    },
    {
        "id": "cc6d4f54c00bb7af",
        "type": "vrm-api",
        "z": "9170653ac436c1aa",
        "vrm": "9ff0559f26b37445",
        "name": "",
        "api_type": "installations",
        "idUser": "",
        "users": "",
        "idSite": "11111",
        "installations": "stats",
        "attribute": "solar_yield",
        "stats_interval": "hours",
        "show_instance": false,
        "stats_start": "boy",
        "stats_end": "eoy",
        "use_utc": false,
        "widgets": "",
        "instance": "",
        "vrm_id": "",
        "country": "",
        "b_max": "",
        "tb_max": "",
        "fb_max": "",
        "tg_max": "",
        "fg_max": "",
        "b_cycle_cost": "",
        "buy_price_formula": "",
        "sell_price_formula": "",
        "feed_in_possible": "",
        "feed_in_control_on": "",
        "store_in_global_context": false,
        "verbose": false,
        "x": 250,
        "y": 620,
        "wires": [
            [
                "1ed847d08ef6ef6b"
            ]
        ]
    },
    {
        "id": "1ed847d08ef6ef6b",
        "type": "function",
        "z": "9170653ac436c1aa",
        "name": "Yesterday PV",
        "func": "var pv = msg.payload.totals.solar_yield/1000;\nvar result = pv.toFixed(1);\nmsg.payload = result;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 490,
        "y": 640,
        "wires": [
            [
                "8d52a9a4633fd603"
            ]
        ]
    },
    {
        "id": "8d52a9a4633fd603",
        "type": "ui-text",
        "z": "9170653ac436c1aa",
        "group": "544125946ced033e",
        "order": 5,
        "width": 0,
        "height": 0,
        "name": "Yield yesterday",
        "label": "Yield yesterday (kWh)",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#717171",
        "className": "",
        "x": 680,
        "y": 640,
        "wires": []
    },
    {
        "id": "b76db982e6a19e2b",
        "type": "inject",
        "z": "9170653ac436c1aa",
        "name": "Run function",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "0 5-19 * * *",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 120,
        "y": 560,
        "wires": [
            [
                "cc6d4f54c00bb7af"
            ]
        ]
    },
    {
        "id": "9ff0559f26b37445",
        "type": "config-vrm-api",
        "name": "yourVRMconfig"
    },
    {
        "id": "544125946ced033e",
        "type": "ui-group",
        "name": "PV",
        "page": "1f3f6aba836b135f",
        "width": "5",
        "height": "1",
        "order": 2,
        "showTitle": true,
        "className": "",
        "visible": "true",
        "disabled": "false"
    },
    {
        "id": "1f3f6aba836b135f",
        "type": "ui-page",
        "name": "Home",
        "ui": "20a0d5584e491036",
        "path": "/page1",
        "icon": "Home",
        "layout": "grid",
        "theme": "199c1371468ee29c",
        "order": 1,
        "className": "",
        "visible": true,
        "disabled": false
    },
    {
        "id": "20a0d5584e491036",
        "type": "ui-base",
        "name": "Home",
        "path": "/dashboard",
        "includeClientData": true,
        "acceptsClientConfig": [
            "ui-notification",
            "ui-control"
        ],
        "showPathInSidebar": false
    },
    {
        "id": "199c1371468ee29c",
        "type": "ui-theme",
        "name": "Default",
        "colors": {
            "surface": "#ffffff",
            "primary": "#0094ce",
            "bgPage": "#eeeeee",
            "groupBg": "#ffffff",
            "groupOutline": "#cccccc"
        },
        "sizes": {
            "pagePadding": "12px",
            "groupGap": "12px",
            "groupBorderRadius": "4px",
            "widgetGap": "12px"
        }
    }
]

Configure the VRM API nodes to point to your site and to use your token.
Customise the gauge thresholds to be appropriate for your site.

Should look like this when working:

1 Like

Are those gauge and text box the normal dashboard ui nodes? When I import it it says it doesn’t recognise them!

No, they are the newer flowfuse dashboard 2.0.
Dash 1 is pretty much end of the road so I don’t use it any longer.
Just load it in the palette and do the initial setup.
There is a dedicated tab for it in VRM as well.

1 Like

So I got it working yesterday but the today one is not working and yesterday displays 0. I guess yesterday might be as only started yesterday afternoon. Not sure why today is failing, any ideas?

The middle node is in error, so it’s config is off and isn’t connecting.
Once you get that fixed it should work.
Place a debug node at the output of today/yesterday PV, then click the trigger nodes and confirm you are getting something out.
If the VRM API node is working the rest should just work.

Yesterday is a stored value so it should pull through if the API node is working.
Send some screenshots of the settings for those two nodes.

This is the todays yield!

looks fine. Add a debug node and then trigger an inject. See what comes out the API node.

Nothing comes out of that node!

Then your VRM connection is not right. Make sure you are using the right token, or create a new one. Double check your site ID. If those two things work it will return data.

Its all connected ok but for some reason it doesn’t like solar yield, in fact it doesn’t like much for today. I had to change the yesterday node to be total solar yield and not solar yield for that to work and that now reports correctly

Is your GX up to date?
Try delete the node and re-add it from scratch.
I run on a beta, but that shouldn’t break anything.
Be sure to deploy between changes.

Yeah up to date, Already tried deleting and re doing. Odd!

Fixed. Needs total solar yield and end of day instead of now.

It should still work as yield is only to now, you can’t have future yield :slight_smile:
Strange.