here is my working nodered - it is used on a sph3600 and in danish conditions, use it as an idea what can be done - i am pretty sure i will change it a bit during the year to fit the conditions changing.
In Denmark we have high tariff on electricity in my area from 17-20, and cheap electricity during the night… as of writing we also have short days and the sun is not high on the sky (low production)
So when i found this i could finally get some logic to charge/and discharge my main SPH.
all is done in a HA installation with node-red plugin.
first is the implementation of the opportunities from HA into node-red: HA Growatt Node-red - Pastebin.com
The above is using all the functions from the Growatt Inverter Mode Switch implementation mjdyson have made. and with correct entities as of mid jan 2023
Feel free to use this directly, should work after import, no special packages other than node-red needed.
Then is the logic i am using for my setup, i will try to get into some details, but feel free to ask.
My setup is that i either runs in battery first, or load first mode - and switching these two modes on and off, it is more or less hardcoded for what i have at my home and in my HA installation, but use it as inspiration, i am no coder, so i am sure it could be done in a lot of different ways, but i all work for me. Logic 1 and logic 2 - Pastebin.com
Logic 1 have three main functions:
- turn off battery discharge when SoC is below 60%
- turn off battery discharge when EV is charging
- turn on battery discharge at 70%
And the Cron plus function calls discharge at high tariff (load first@1700)
Logic 2 have two main functions:
- charge battery at cheapest price during sunset to sunrise (external function from pvprodk (Jonas) · GitHub)
- enable ‘load first’ two hours before sunrise
a lot of the functions is used only during the day (when sun is up) So here is the explaining:
i start the day two hours before sunrise, the systems goes into load first and starts discharging the battery (logic 2.2)… if during the day my SoC comes below 60% i stop discharging my battery (logic 1.1) if sun have charged my batteries enough to get to 70% soc i trigger logic 1.3 (load first). otherwise i will go into load first again ay 1700. On sunny days i do not go under 60% before the sun is up and recharging the battery. the 60% is chosen because then i have enough battery SoC for my usage from 1700 to empty (15% SoC)
For battery turn off discharge i set the settings to Battery first, with an max SoC at 10% (this will then not AC charge the battery, because i expect my battery to be above 10%) but it will disable ‘load first’
if i start charging my EV, and the charging power goes over 1kW, it triggers logic 1.2 (go in to battery first at 10%) and then pauses the ‘load first’ state, enabling no discharge from my growatt system in to my car.
For charging my battery during the cheapest period of the night i have a custom made plugin from pvprodk (Jonas) · GitHub that tells me when it is the cheapest time to charge in a defined time frame (often during the night) this function will trigger the AC charge to the battery and start fill the battery and when it is filled, and the time is two hours before sunrise it all starts over.
TLDR; switching between “load first” and “battery first” and SoC setting 10 and 100.