Disclaimer: You use this entirely at your own risk, I'm not an expert, and I only started using Node Red and Javascript in March (about 6 weeks ago!). Satisfy yourself that this does what you need, and does it safely, I'm not responsible for any problems however caused, and share this for the community to adapt to their needs.
I required scheduled discharging, which Victron doesn't support, also I couldn't find any available flows, so after some research and a quick bit of learning I've come up with my own.
I've also added a graph, which can be useful for seeing what's going on.
The aim is to ensure that the battery is discharging the set wattage, so it calculates the grid set point taking into account total PV power, total AC loads and the discharge rate you want, it will then set the grid set point to that value. It calculates this every once every minute, I've built in an adjustable range so you can change the frequency the set point is changed, if the new set point is within + or - the range value of the existing set point it is not changed. This reduces the frequency that the set point changes, I've no idea if changing it too often could cause issues (see this thread), so I've set the timer to run once a minute, and the range value will further reduce the amount of times its changed. There is also a minium SOC of charge setting, once reached just the excess solar will be exported until the timer turns off.
I've been running this for a couple of weeks, making the odd modification, and it seems to be working well.
My grid set point is normally set to 0, so if yours is different you will need to alter the flow so that it sets it back to the value that you use.
There are sliders & reset buttons for the following:
Schedule on off switch.
Maximum grid set point - sets maximum allowed grid export.
Range value - so you can easily alter the range.
Maximum battery discharge to use.
Minimum SOC - stops discharging when reached.
When you first import the flows, you will need to alter the MQTT's flow to suit your equipment, I have two MPPT controllers, and an AC inverter. You will need to change the Victron nodes to suit what you have, and make sure you select the same "Measurement", otherwise it won't work. Another complication you may well have is calculating the total PV, the flow will need altering to add this up correctly depending on what equipment you have. This should all be in the MQTT's flow, there will also likely be stuff in there you don't need, as I also use it in my other flows. You can see which MQTT nodes are used on the Scheduled discharge flow, and remove what you don't need in the MQTT's flow.
Included in the MQTT's flow is a time to go calculator, it will turn Victrons discharge time to go in to days, hours and minutes, and if the battery is charging it will estimate the time to go before the battery is full, it calculates the average over 3 minutes.
The actual timers are built into the flow, but they are easy to edit, alter, and recreate.
There is also a manual control, to use this you need to turn the "Scheduled Discharge" switch off if your are within a timer period, otherwise the grid point will be altered by the scheduled discharge routine. Moving the slider to the positive side will charge the batteries, moving it to the negative side, will discharge the batteries, it literally sets the grid set point, and that's it, reset sets it back to 0.
I've included a screen shot of my pallet, the moment node is not used in these flows.
I've probably missed things, so just ask and I'll try to help, but I can't fix everyone's issues as I am just one person with limited time.
If you notice any problems in my code, then please let me know.
Main MQTT's Flow - there is a lot here not used in the scheduled discharge flow, as I use it elsewhere, so you can delete what's not required.
Scheduled Discharge Flow
Palette
Edit:22 April 2023. Made some modifications to the scheduled discharge flow, simplified some bits, altered the layout, and changed the timer so it only runs once a minute.
Edit:25 April 2023. Modified the flow so that if there is excess PV when the minimum SOC is reached then the excess will be exported, this stops the battery charging, and full export starting again. Also added a graph with useful information on it.
Edit: 29 April 2023 Fixed a bug which would cause it to start discharging outside of a timer period if you moved the sliders or pressed the buttons. I just deleted the two link nodes for the sliders/reset buttons.
Edit: 29 April 2023. Spotted another minor bug on the chart, the "Grid Set Point" function node at the top for the chart should get its value from msg.payload = flow.get("PresentGridSetPoint");