Weather prediction in Node Red

Just checked. I’m at Admin level.

Well, there’s a thing. I’ve done absolutely nothing but a little sideways progress…

image

And then…

image

So I think we’re past the mysterious user privileges issue…

… and after my wife’s laptop refused to connect to the internet (DNS issue) I restarted the router and guess what!..

I’m not seeing anything useful yet but the API call seems to be partially working.

And finally (with the greatest of respect and gratitude) I was hoping to get a few useful values. Any thoughts?

Send a screenshot of what you have set the node to.
In the payload, click the little right arrow, it should expand all the objects beneath it. Each will have their own arrows to expand it further.
Compare to the API docs, it should help.

1 Like

Sorry, this is it…

Nick, sorry, It seems to be working!


I’ve just got to find a way to extract the solar irradiance data.

You’ve been amazing! (and very patient)

Thank you :pray:

I will help you with that. Just tomorrow. It’s been a long, hot day and it’s time for a bevvie :wink:

Good man. I’m in the South of England and it’s freezing and raining! :cold_face:

South of Africa, and its been bordering 35C.
I’m willing to swap :slight_smile:

It will help to go through some of the node red video tutorials, on messages, objects, arrays, context etc. it is the foundation of nodered, so understanding the concepts will help you.

You can find the answer in my previous screenshot.

for (let i = 24; i < 48; i++) {
    if (msg.payload.records.solar_yield_forecast[i][1] > 500){ 

Where i goes from 24 to 48, which is the next day since I fetch the data at 22 PM, starting from the begining of the day.

Replace solar_yield_forecast with vrm_solar_irradiance_fc

1 Like

Which particular value do you want?
My example gives the remaining PV from when the query is run to the end of the day, so no filtering is required, the total can be used.

@nickdb

Good tip. :+1:
I can probably simplify my code because I only need the total too. :laughing:

Dear Diederik,

Thank you very much. It’s absolutely fantastic to get such excellent help, patience and support.

Best regards

Paul

Hi Nick,

I’ll be back on this around 7pm (your time) No worries if you’re not about /otherwise engaged.

All the best

Paul

If you use my method and node config (shown earlier), then you should get the following data returned:

The totals object is what you want (it is in Watt hours).
This is referenced by this path:
msg.payload.totals.solar_yield_forecast

If you divide it by a thousand, you get kWh. In my case I round it up to a single decimal with the toFixed(1) function.

As much as I can’t stand AI chatbots, they are pretty good with code, so for beginners they can be quite helpful getting assistance with writing functions.

1 Like

Just a reminder, toFixed(1) returns a string, not a number.

1 Like

Indeed, but it works for some purposes like read-outs etc.
no need to truncate it for calculations.

1 Like

Dear Nick,
My plan is to look at the solar yield forecast and set the charge schedule (1) to a SOC like so…

solar yield (from API)
0-10% charge to 100%
21-60% charge to 40%
61-100% charge to 10%

I’ll need to write a Function? to pass the ‘charge to xx%’ value after looking at the predicted solar value from the API call. Does this seem like the right path to take? …

What is the logic you want to use? Are you calculating this throughout the day, or at specific times.
Here, some get to the afternoon, check soc and then adjust the soc based on level. On an ideal day, you know where soc should be to meet your consumption, if it is under, then adjust it. PV forecast can be secondary if your usage is predictable.
In my case, I should be fully charged by midday. So I can judge by the delta if action is required.

1 Like