question

carel-landman avatar image
carel-landman asked

Node Red VRM API - Consumption Forecast

Hi There

I am struggling to get the Consumption Forecast, is this possible? Please see below:


1701864856652.png


Node-REDapi
1701864856652.png (11.4 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
Daniel Hillenbrand avatar image
Daniel Hillenbrand answered ·

Yes, you need to do it using http request node.

function -> http request (GET) -> json

const VRM_ID = "XXXXXX";
const VRM_ACCESS_TOKEN = "XXXXXXXXXXXXXXXX";

let today = new Date();

let startDate = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0, 0);
let endDate = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 999);

let start = Math.floor(startDate.getTime() / 1000);
let end = Math.floor(endDate.getTime() / 1000);

return [
    {
        'url': "https://vrmapi.victronenergy.com/v2/installations/" + VRM_ID + "/stats?type=forecast&interval=hours&start=" + start + "&end=" + end,
        'headers': {
            'x-authorization': "Token " + VRM_ACCESS_TOKEN
        }
    }
];
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Dirk-Jan Faber (Victron Energy) avatar image
Dirk-Jan Faber (Victron Energy) answered ·

You can use the flow as shown below:
1702885409490.png
After injecting the timestamp, the information on the solar yield gets fetched:
1702885481053.png

The records part shows, per hour, the expected yield. The first field in that hourly array is the timestamp, the second one the expected yield for that hour.

The totals shows the expected totals for the day. Note that this only works on sites that produce solar. If your site does not produce solar, the records and totals will show 'false':

1702885621765.png


For full reference:
1702885726072.png


1702885409490.png (8.6 KiB)
1702885481053.png (32.4 KiB)
1702885621765.png (13.0 KiB)
1702885726072.png (25.0 KiB)
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

gloitom avatar image gloitom commented ·

The topic starter was about the consumption forecast and not the solar forecast.

0 Likes 0 ·
Dirk-Jan Faber (Victron Energy) avatar image Dirk-Jan Faber (Victron Energy) ♦ gloitom commented ·

You are right. That was added in version 0.0.8 of the victron-vrm-api.

0 Likes 0 ·