evcc-io / evcc

Sonne tanken ☀️🚘
https://evcc.io
MIT License
3.52k stars 650 forks source link

Battery Control for SOLAX Hybrid G4 #11227

Closed ioniks closed 10 months ago

ioniks commented 10 months ago

Hi,

The new feature Battery control is a very good feature.

For solax inverters, the only parameter that can be changed is the battery output A power that can be limited.

Is it possible during fast charging or smart grid to limit the output power of the battery and return it normally to the end of charging or back to a normal mode?

This parameter can be modified with a value defined in the configuration for example? (and not updated all the time, because according to the returns the eprom has a predetermined maximum write capacity)

Thanks

premultiply commented 10 months ago

Yes please provide all technical details like Modbus registers, documentation, command flow examples, ...

ioniks commented 10 months ago

Command flow is just when charging at full speed or smart grid (full speed too).

Change battery_discharge_max_current to 5 or 10A (it's better if i can change it in yaml for exemple) Charge at fast mode When stop charging (vehicle disconnected or fully charged) or mode change the battery_discharge_max_current is restored (can be a setting in yaml too)

For modbus register : https://gbc-solino.cz/wp-content/uploads/2022/07/Hybrid-X1X3-G4-ModbusTCPRTU-V3.21-English_0622-public-version.pdf

It's 0x0091 "Battery_DischargeMaxCurrent", recommended 25 A and can be 0 to 30A

Say if you need more information.

premultiply commented 10 months ago

Looks these two registers may fit the requirements:

image

normal: 0x1f to 0 and 0x20 to 0 hold: 0x1f to 2 and 0x20 to 0 charge: 0x1f to 3 and 0x20 to 1

ioniks commented 10 months ago

First is the inverter mode for backup or other. (So no) The second is for force charge the battery with the grid.

So I don't think this is useful for discharge control of the battery.

If grid is lost, the backup function doesn't start

premultiply commented 10 months ago

Please no guessing. Did you try it? Switching to backup mode should stop discharging the battery.

ioniks commented 10 months ago

I'm not guessing for backup and self use mode, I'm always on backup mode.

Backup mode just keeps a minimum soc more important (can be set) of the battery and when no solar power, inverter keep eps active, in self use mode if battery is at or less min soc (and no solar power ) the inverter is on standby and don't backup if grid lost.

So if you are in manual mode with no force charge and discharge, the inverter go to standby (I think because no backup mode) and don't go to eps mode when grid is lost.

It's not possible to have a boolean on mqtt when full speed charging for fast mode or smart grid price mode ? (Other solution to match and update with automation)

premultiply commented 10 months ago

image

ioniks commented 10 months ago

Ok I have re read and i don't know why I think this.

(Or it's another setting like hot standby setting)

But your solution is 2 setting update (2 writes), setting only discharge max current is just one setting. But your solution can be better for no power from battery. (I don't know how many write can be set)

andig commented 10 months ago

Can someone confirm https://github.com/evcc-io/evcc/issues/11227#issuecomment-1868543284?

andig commented 10 months ago

Bitte mal testen

TobiP3005 commented 10 months ago

@andig getting an decoding error on starting, please have a look. I did not change anything in the config. It does not work since the last update:

FATAL 2024/01/01 13:59:27 cannot create meter 'battery': cannot create meter 'template': cannot create meter 'custom': battery mode: 1 error(s) decoding:

meters:
...
- type: template
  template: solax
  id: 1
  device: /dev/ttyUSB0
  baudrate: 19200
  comset: 8N1
  usage: battery
  modbus: rs485serial
  name: battery
andig commented 10 months ago

@ioniks could you please tun evcc meter --log error,modbus:trace --battery-mode hold --battery-mode-wait 30s Thanks!

On 4. Jan 2024, at 11:56, ioniks @.***> wrote:

I have tested the battery control activation and i have a error in EVCC : Request failed with status code 400: API request failed http://XXXXXXXXX:7070/api/batterydischargecontrol/true

And in network tab, the response is : {"error":"modbus: exception '4' (server device failure), function '6'"}

— Reply to this email directly, view it on GitHub https://github.com/evcc-io/evcc/issues/11227#issuecomment-1876899849, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABND365WLPGBGEOT4Z5WFTYM2DG3AVCNFSM6AAAAABBBNE6TGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZWHA4TSOBUHE. You are receiving this because you were mentioned.

docsnyder7 commented 10 months ago

@andig is there interessed for other users with Solax Hybrid WR´s? could you need more informations?

ioniks commented 10 months ago

@andig

Can i set this mode in Yaml ? (i have docker version of evcc)

andig commented 10 months ago

It's unclear to me if Solax works. If not we'll need an issue with relevant details.

ioniks commented 10 months ago

@andig

I have set in yaml

log: debug
levels:
  modbus: trace

This is the log when i set the battery control to On, same API error and nothing in log for modbus

[lp-1  ] DEBUG 2024/01/04 12:28:34 charge power: 0W
[site  ] DEBUG 2024/01/04 12:28:34 pv power: 2108W
[site  ] DEBUG 2024/01/04 12:28:35 battery soc: 46%
[site  ] DEBUG 2024/01/04 12:28:35 battery power: -1560W
[site  ] DEBUG 2024/01/04 12:28:35 grid power: -0W
[site  ] DEBUG 2024/01/04 12:28:35 battery has priority at soc 46% (< 95%)
[site  ] DEBUG 2024/01/04 12:28:35 site power: 150W
[lp-1  ] DEBUG 2024/01/04 12:28:35 charge total import: 3428.009kWh
[lp-1  ] DEBUG 2024/01/04 12:28:35 charger status: A
[site  ] DEBUG 2024/01/04 12:28:44 set battery discharge control: true
[site  ] DEBUG 2024/01/04 12:28:49 ----
[lp-1  ] DEBUG 2024/01/04 12:28:49 charge power: 0W
[site  ] DEBUG 2024/01/04 12:28:50 pv power: 2008W
[site  ] DEBUG 2024/01/04 12:28:50 battery soc: 46%
[site  ] DEBUG 2024/01/04 12:28:50 battery power: -1438W
[site  ] DEBUG 2024/01/04 12:28:50 grid power: -0W
[site  ] DEBUG 2024/01/04 12:28:50 battery has priority at soc 46% (< 95%)
[site  ] DEBUG 2024/01/04 12:28:50 site power: 150W
[lp-1  ] DEBUG 2024/01/04 12:28:50 charge total import: 3428.009kWh
[lp-1  ] DEBUG 2024/01/04 12:28:50 charger status: A
[site  ] DEBUG 2024/01/04 12:29:04 ----

Where i can set this --battery-mode hold --battery-mode-wait 30s in yaml ?

andig commented 10 months ago

Run on command line:

evcc meter --log error,modbus:trace --battery-mode hold --battery-mode-wait 30s
docsnyder7 commented 10 months ago
evcc meter --log error,modbus:trace --battery-mode hold --battery-mode-wait 30s
[main  ] INFO 2024/01/04 12:14:22 evcc 0.123.5
[main  ] INFO 2024/01/04 12:14:22 using config file: /etc/evcc.yaml
[modbus] TRACE 2024/01/04 12:15:22 modbus: send 00 01 00 00 00 06 01 06 00 1f 00 02
[main  ] FATAL 2024/01/04 12:15:22 set battery mode: read tcp 192.168.178.57:35484->192.168.178.88:502: read: connection reset by peer

ich setze mal die Ausgabe aus meinem system ein..

ioniks commented 10 months ago
evcc meter --log error,modbus:trace --battery-mode hold --battery-mode-wait 30s
[main  ] INFO 2024/01/04 13:09:25 evcc 0.123.5
[main  ] INFO 2024/01/04 13:09:25 using config file: /etc/evcc.yaml
[modbus] TRACE 2024/01/04 13:10:55 modbus: send 00 01 00 00 00 06 01 06 00 1f 00 02
[modbus] TRACE 2024/01/04 13:10:57 modbus: recv 00 01 00 00 00 03 01 86 04
[main  ] FATAL 2024/01/04 13:10:57 set battery mode: modbus: exception '4' (server device failure), function '6'

In Home Assistant when i set Manual mode (with solax modbus plugin) it revert to Backup mode (my previous mode), and when i set it in Solax app, it works (but when it's set Stop charge and discharge, it continue charging ...)

andig commented 10 months ago

modbus: exception '4' (server device failure), function '6'

Potentially, Solax doesn't support the modbus writesingle function code 6. We could try writemultiple instead.

In Home Assistant when i set Manual mode (with solax modbus plugin) it revert to Backup mode (my previous mode), and when i set it in Solax app, it works (but when it's set Stop charge and discharge, it continue charging ...)

I have no idea what that means. Zero.

That said and since this issue has been closed: if anyone has a problem with Solax please open new issue with required information. The main problem here is that we're working on unconfirmed information and do not have access to test devices.

andig commented 10 months ago
evcc meter --log error,modbus:trace --battery-mode hold --battery-mode-wait 30s
[main  ] INFO 2024/01/04 12:14:22 evcc 0.123.5
[main  ] INFO 2024/01/04 12:14:22 using config file: /etc/evcc.yaml
[modbus] TRACE 2024/01/04 12:15:22 modbus: send 00 01 00 00 00 06 01 06 00 1f 00 02
[main  ] FATAL 2024/01/04 12:15:22 set battery mode: read tcp 192.168.178.57:35484->192.168.178.88:502: read: connection reset by peer

ich setze mal die Ausgabe aus meinem system ein..

TCP Connection weg- ob/was das mit einem potentiellen Modbusproblem zu tun hat ist unklar.