question

pwacquiez avatar image
pwacquiez asked

how to activate a relay today if tomorrow's forecast is above a defined level?

Hi all,


how to close a relay today if the forecast of future production (tomorrow) is higher, at my location, than a defined level?

M’y goal is to automatically drain my batteries today if the forecast indicates that there will be a lot of sunshine tomorrow.

Does anyone have an idea please?

solar forecast
2 |3000

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

1 Answer
matt1309 avatar image
matt1309 answered ·

Not sure what language you're planning this in but I would do it in node red running on the gx device.

1. Get forecast data for the next day using VRM api node:

victron-vrm-api (node) - Node-RED (nodered.org)

2. If it's just the one number you're doing the if statement on then use switch node. ie switch property being msg.payload and criteria being greater than your defined value (assuming the value is static).


If however you have a longer list of criteria or do some more complex things maybe a function node and some JS might be better.

Say you wanted to get the defined value from somelist based on time of year or some other webserver or if you wanted to check multiple criteria like batttery soc also, then maybe a function node woud be better.


3. If criteria met then turn on relay by returning msg.payload = 1 and then have another node that turns off relay once the minimum SoC you want is hit.

This is assuming the relay is being controlled by node red. If you're using a smart switch (shelly or equivalent in place of a relay) then http node can do this





2 |3000

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

Related Resources

Additional resources still need to be added for this topic