evcc icon indicating copy to clipboard operation
evcc copied to clipboard

Add rudimentary battery controls to Growatt Hybrid

Open schulzh opened this issue 1 year ago • 5 comments

This adds rudimentary battery controls to the growatt hybrid battery. (https://github.com/evcc-io/evcc/issues/12858)

The growatt hybrid inverter supports three operating modes: Load first (default), Battery first and Grid first.

  • In "Load first", the inverter behaves as you'd expect from a hybrid inverter; charging excess PV production and discharging when production is insufficient for the load.
  • In "Battery first", it will only charge excess production but will not discharge the battery. Additionally, in this mode we can enable another property called "AC charging", that will charge the battery even if there is not enough production, importing additional energy from the grid.
  • "Grid first" will discharge the battery into the grid until empty.

The operating mode of the growatt hybrid inverter cannot be set directly. Instead, timeslots can be configured to change the mode for specific times of the day. There are 3 timeslots for each operating mode. Each timeslot is defined by a start time, end time and enable flag.

This implementation uses the first "Battery first" timeslot. It is set to start at 0:00 and end at 23:59. The mode is then switched from "Load first" to "Battery first" by using the enable flag on this timeslot.

Another quirk of this inverter is that the registers to set the start, end and enable registers all need to be set in one write operation, otherwise it will not accept the new values. Once the timeslot is set, it is possible to just change the enable value though.

Unfortunately, I did not find a solution to write to exactly three registers (1100-1102) at once. I would like to add this if someone can give me a hint on how to achieve this. Until then, it is required to setup the timeslot manually by writing the values 0, 5947, 0 to the registers (e.g. using https://github.com/favalex/modbus-cli: modbus [...] H@1100=0 H@1101=5947 H@1102=0).

The operating mode can be observed by querying the input register 118 and AC charge power can be monitored with input registers 116 and 117 (uint32, 0.1kw). I am using this on my Growatt SPH8000TL3 BH-UP and its working fine so far.

schulzh avatar Aug 25 '24 15:08 schulzh

This implementation uses the first "Battery first" timeslot. It is set to start at 0:00 and end at 23:59. The mode is then switched from "Load first" to "Battery first" by using the enable flag on this timeslot.

Do these slots always exist? If not, hint should be added to the template.

andig avatar Aug 25 '24 17:08 andig

Do these slots always exist? If not, hint should be added to the template.

Yes. Altough unlikely, it is possible for a user to use these slots otherwise, so I guess a hint in the documentation should be added regardless.

Do you have any input on how to write to three registers at once? I would not like requiring the user to manually set up the slots as mentioned.

schulzh avatar Aug 25 '24 17:08 schulzh

Thats not currently possible :/

andig avatar Aug 25 '24 18:08 andig

I've added a description to explain the necessary steps. Is it possible to have a parameter that toggles the battery control capability?

schulzh avatar Aug 26 '24 09:08 schulzh

Wofür würden wir den brauchen? Zumindest "laden" muss ja im UI schon explizit freigeschaltet werden.

andig avatar Aug 28 '24 09:08 andig

Technisch brauchen wir sie nicht, richtig. Es wäre nur etwas sauberer, dem Nutzer die Funktionen nicht anzubieten, solange er die notwendige Einrichtung noch nicht durchgeführt hat. Das hätte er dann mit einem parameter bestätigen können, welcher die Funktionen aktiviert. Wenn es das aber nicht gibt, ist es auch OK das so zu mergen. Wenn sich jemand wundert warum die Funktionen bei ihm nicht funktionieren, wird er wohl früher oder später in der Dokumentation vorbeischauen.

schulzh avatar Aug 31 '24 19:08 schulzh

Technisch brauchen wir sie nicht, richtig. Es wäre nur etwas sauberer, dem Nutzer die Funktionen nicht anzubieten, solange er die notwendige Einrichtung noch nicht durchgeführt hat. Das hätte er dann mit einem parameter bestätigen können, welcher die Funktionen aktiviert.

Da der Nutzer die Funktion aktiv einschalten muss sollten er auch in der Lage sein, die Doku zu befolgen. Aktuell ist das erstmal der Stand der umsetzbar ist.

Vielen Dank für den PR!

andig avatar Sep 01 '24 08:09 andig