evcc icon indicating copy to clipboard operation
evcc copied to clipboard

LG ESS: backupmode remains ON after grid charging stops

Open hmauchert opened this issue 4 months ago • 26 comments

Describe the bug

When using EVCC with LG ESS Home 8/10, enabling grid charging triggers backup mode correctly:

  • backupmode = on
  • backup_soc = 100

However, when grid charging is stopped, EVCC updates:

  • backup_soc = 1
  • BUT backupmode remains ON

Observed result: The inverter remains in backup mode permanently, even though grid charging has ended.

This leads to unintended behavior:

  • LG falls back to its default reserve (e.g. 20%)
  • Battery operation is no longer normal

Expected behavior: EVCC should disable backup mode after grid charging ends:

  • backupmode = off

Logs (TRACE):

[lgess-https://] TRACE 2026/08/03 11:21:53 {"auth_key":"0f896240-8f0b-11f1-a647-e0e1a955cd72"} -- { "statistics": { "pcs_pv_total_power": "5109", "batconv_power": "3988", "bat_use": "1", "bat_status": "1", "bat_user_soc": "67.7", "load_power": "1197", "ac_output_power": "8", "load_today": "0.0", "grid_power": "76", "current_day_self_consumption": "99.4", "current_pv_generation_sum": "11955", "current_grid_feed_in_energy": "75" }, "direction": { "is_direct_consuming_": "1", "is_battery_charging_": "1", "is_battery_discharging_": "0", "is_grid_selling_": "0", "is_grid_buying_": "0", "is_charging_from_grid_": "0", "is_discharging_to_grid_": "0" }, "operation": { "status": "start", "mode": "6", "pcs_standbymode": "false", "drm_mode0": "0", "remote_mode": "0", "drm_control": "255", "on_matching": "false", "match_complete": "false" }, "wintermode": { "winter_status": "off", "backup_status": "off" }, "backupmode": "", "pcs_fault": { "pcs_status": "pcs_ok", "pcs_op_status": "pcs_run" }, "heatpump": { "heatpump_protocol": "1", "heatpump_activate": "on", "current_temp": "0", "heatpump_working": "on" }, "evcharger": { "ev_activate": "off", "ev_power": "0", "auth_method": "off", "evcharger_detected": "off", "authentication": "false" }, "gridWaitingTime": "0" }
[lgess-https://] TRACE 2026/08/03 11:21:53 {"auth_key":"0f896240-8f0b-11f1-a647-e0e1a955cd72","autocharge":"1","backup_soc":"100","backupmode":"on"} -- { "status": "success" }
[lgess-https://] TRACE 2026/08/03 11:22:04 {"auth_key":"0f896240-8f0b-11f1-a647-e0e1a955cd72","autocharge":"1","backup_soc":"1","backupmode":"on"} -- { "status": "success" }
[lgess-https://] TRACE 2026/08/03 11:22:23 {"auth_key":"0f896240-8f0b-11f1-a647-e0e1a955cd72"} -- { "statistics": { "pcs_pv_total_power": "5095", "batconv_power": "3892", "bat_use": "1", "bat_status": "1", "bat_user_soc": "67.7", "load_power": "1205", "ac_output_power": "8", "load_today": "0.0", "grid_power": "2", "current_day_self_consumption": "99.4", "current_pv_generation_sum": "11955", "current_grid_feed_in_energy": "75" }, "direction": { "is_direct_consuming_": "1", "is_battery_charging_": "1", "is_battery_discharging_": "0", "is_grid_selling_": "0", "is_grid_buying_": "0", "is_charging_from_grid_": "0", "is_discharging_to_grid_": "0" }, "operation": { "status": "start", "mode": "1", "pcs_standbymode": "false", "drm_mode0": "0", "remote_mode": "0", "drm_control": "255", "on_matching": "false", "match_complete": "false" }, "wintermode": { "winter_status": "off", "backup_status": "off" }, "backupmode": "", "pcs_fault": { "pcs_status": "pcs_ok", "pcs_op_status": "pcs_run" }, "heatpump": { "heatpump_protocol": "1", "heatpump_activate": "on", "current_temp": "0", "heatpump_working": "on" }, "evcharger": { "ev_activate": "off", "ev_power": "0", "auth_method": "off", "evcharger_detected": "off", "authentication": "false" }, "gridWaitingTime": "0" } 

Environment:

  • EVCC version: v0.313.0
  • LG ESS Home 8/10

Steps to reproduce

  1. start grid load
  2. stop grid load

...

Configuration details

i do not use evcc.yaml

Log details

[lgess-https://] TRACE 2026/08/03 11:21:53 {"auth_key":"0f896240-8f0b-11f1-a647-e0e1a955cd72"} -- { "statistics": { "pcs_pv_total_power": "5109", "batconv_power": "3988", "bat_use": "1", "bat_status": "1", "bat_user_soc": "67.7", "load_power": "1197", "ac_output_power": "8", "load_today": "0.0", "grid_power": "76", "current_day_self_consumption": "99.4", "current_pv_generation_sum": "11955", "current_grid_feed_in_energy": "75" }, "direction": { "is_direct_consuming_": "1", "is_battery_charging_": "1", "is_battery_discharging_": "0", "is_grid_selling_": "0", "is_grid_buying_": "0", "is_charging_from_grid_": "0", "is_discharging_to_grid_": "0" }, "operation": { "status": "start", "mode": "6", "pcs_standbymode": "false", "drm_mode0": "0", "remote_mode": "0", "drm_control": "255", "on_matching": "false", "match_complete": "false" }, "wintermode": { "winter_status": "off", "backup_status": "off" }, "backupmode": "", "pcs_fault": { "pcs_status": "pcs_ok", "pcs_op_status": "pcs_run" }, "heatpump": { "heatpump_protocol": "1", "heatpump_activate": "on", "current_temp": "0", "heatpump_working": "on" }, "evcharger": { "ev_activate": "off", "ev_power": "0", "auth_method": "off", "evcharger_detected": "off", "authentication": "false" }, "gridWaitingTime": "0" }
[lgess-https://] TRACE 2026/08/03 11:21:53 {"auth_key":"0f896240-8f0b-11f1-a647-e0e1a955cd72","autocharge":"1","backup_soc":"100","backupmode":"on"} -- { "status": "success" }
[lgess-https://] TRACE 2026/08/03 11:22:04 {"auth_key":"0f896240-8f0b-11f1-a647-e0e1a955cd72","autocharge":"1","backup_soc":"1","backupmode":"on"} -- { "status": "success" }
[lgess-https://] TRACE 2026/08/03 11:22:23 {"auth_key":"0f896240-8f0b-11f1-a647-e0e1a955cd72"} -- { "statistics": { "pcs_pv_total_power": "5095", "batconv_power": "3892", "bat_use": "1", "bat_status": "1", "bat_user_soc": "67.7", "load_power": "1205", "ac_output_power": "8", "load_today": "0.0", "grid_power": "2", "current_day_self_consumption": "99.4", "current_pv_generation_sum": "11955", "current_grid_feed_in_energy": "75" }, "direction": { "is_direct_consuming_": "1", "is_battery_charging_": "1", "is_battery_discharging_": "0", "is_grid_selling_": "0", "is_grid_buying_": "0", "is_charging_from_grid_": "0", "is_discharging_to_grid_": "0" }, "operation": { "status": "start", "mode": "1", "pcs_standbymode": "false", "drm_mode0": "0", "remote_mode": "0", "drm_control": "255", "on_matching": "false", "match_complete": "false" }, "wintermode": { "winter_status": "off", "backup_status": "off" }, "backupmode": "", "pcs_fault": { "pcs_status": "pcs_ok", "pcs_op_status": "pcs_run" }, "heatpump": { "heatpump_protocol": "1", "heatpump_activate": "on", "current_temp": "0", "heatpump_working": "on" }, "evcharger": { "ev_activate": "off", "ev_power": "0", "auth_method": "off", "evcharger_detected": "off", "authentication": "false" }, "gridWaitingTime": "0" }

What type of operating system or environment does evcc run on?

Linux

External automation

  • [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.

Nightly build

  • [x] I have verified that the issue is reproducible with the latest nightly build

Version

0.313.0

hmauchert avatar Aug 03 '26 09:08 hmauchert

Investigation

Looked at the LG ESS battery-control code path in meter/lgess.go. The trace log lines up exactly with this code:

// batteryMode implements the api.BatteryController interface
func (m *LgEss) batteryMode(batterySocLimits batterySocLimits) func(api.BatteryMode) error {
	return func(mode api.BatteryMode) error {
		switch mode {
		case api.BatteryNormal:
			// firmeware bug: battery not discharging after hold mode
			// if battery is sleeping, wake up with charging for 10sec
			m.conn.BatteryMode("on", 100, true)
			time.Sleep(10 * time.Second)
			// now turn Battery discharge on
			return m.conn.BatteryMode("on", int(batterySocLimits.MinSoc), true)

(meter/lgess.go:140-149)

When api.BatteryNormal is requested (i.e. grid charging stops and the loadpoint returns to normal operation), evcc first calls BatteryMode("on", 100, true) to wake the battery, waits 10s, then calls BatteryMode("on", MinSoc, true). This matches the two PUT /v1/user/setting/batt requests in the log exactly 11s apart, with backup_soc going from 100 to 1 (the reporter's configured MinSoc).

The important part: for every battery mode (normal, hold, charge), meter/lgess.go always sends "backupmode": "on" to the LG ESS device — it relies solely on backup_soc to express "normal" operation (low soc = effectively no reserve) and never sends "backupmode": "off". This has been the case since battery control was first added (#19630) — it's not a recent regression.

Per the reporter, on their LG ESS Home 8/10 this doesn't behave as intended: once backupmode is left on (even with a low backup_soc), the inverter appears to fall back to its own default reserve rather than honoring backup_soc, so the battery no longer discharges normally after grid charging ends.

Assessment

This looks like a plausible defect in meter/lgess.go's handling of api.BatteryNormal — it may need to explicitly send backupmode: "off" instead of relying on backup_soc alone. However, I can't verify the correct LG ESS API semantics (whether backupmode: "off" is valid, and how backup_soc should be handled in that case) without access to real hardware, so I'm not opening a fix PR for this — it needs verification against an actual LG ESS Home 8/10 unit before changing behavior for all users of this integration.

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 03 '26 09:08 github-actions[bot]

I can confirm this behavior on a real LG ESS Home 8/10 system:

  • When backupmode remains "on", the inverter does NOT respect low backup_soc values
  • Instead, it falls back to its internal default reserve (around 20%)

This explains the observed issue: After grid charging, EVCC leaves backupmode enabled, which prevents normal battery discharge.

Conclusion: backupmode must be explicitly set to "off" to restore normal operation.

I can test any proposed fix if needed.

hmauchert avatar Aug 03 '26 09:08 hmauchert

This was added in https://github.com/evcc-io/evcc/pull/19630

/cc @zaj78 could you kindly take a look? /cc @marcelGoerentz

andig avatar Aug 03 '26 10:08 andig

Looking at the implementation again:

The wake-up sequence (BatteryMode("on", 100, ...)) makes sense due to the firmware issue.

However, after returning to normal operation, backup mode remains enabled.

Would it be safer to:

  • keep the wake-up logic as-is
  • but explicitly disable backup mode afterwards?

This might avoid reintroducing the "sleeping battery" issue while restoring correct discharge behavior.

Happy to test different variants if needed.

hmauchert avatar Aug 03 '26 10:08 hmauchert

Hmmm, we may should store the previous settings and restore them after grid charging gets disabled?

marcelGoerentz avatar Aug 03 '26 10:08 marcelGoerentz

That makes perfect sense 👍

On my system the issue occurs because backupmode stays enabled, so restoring the previous state would solve this cleanly without overwriting user settings.

Happy to test this once implemented.

hmauchert avatar Aug 03 '26 11:08 hmauchert

@claude could you prepare a PR, where the LG ESS settings getting stored when batter mode changes from normal to grid charging and then restore the settings when switching back to normal?

marcelGoerentz avatar Aug 03 '26 11:08 marcelGoerentz

Unfortunately, I can't verify discharge behavior right now because my battery SOC remains too high given the current weather. However, I recall that it was possible to discharge it well below user-displayed 20% level even in backup mode. Please note, however, that the actual usable SOC range is always between 10% and 100%. @hmauchert, what firmware version is your ESS on?

zaj78 avatar Aug 03 '26 19:08 zaj78

@claude could you prepare a PR, where the LG ESS settings getting stored when batter mode changes from normal to grid charging and then restore the settings when switching back to normal?

Did that work?

zaj78 avatar Aug 03 '26 19:08 zaj78

@zaj78 Firmware version on my system:

PMS: 10.05.7438 PCS: 05.00.01.00 R201 1.197.3

On my setup, as soon as backupmode remains "on", the inverter no longer discharges below its internal default reserve (~20%), even if backup_soc is set to a very low value (e.g. 1%).

So for my system, backupmode must be explicitly disabled to restore normal discharge behavior.

Happy to provide more logs if helpful.

hmauchert avatar Aug 03 '26 20:08 hmauchert

@claude could you prepare a PR, where the LG ESS settings getting stored when batter mode changes from normal to grid charging and then restore the settings when switching back to normal?

Did that work?

Unfortunately no

marcelGoerentz avatar Aug 03 '26 20:08 marcelGoerentz

@hmauchert I only had PMS P10.05.7437 and P10.05.7439, currently P10.05.7440. But that ~20% is still strange. Are you sure it's some "default reserve" and not a misconfigured winter mode or something else? What does the EnerVu Plus App show at the bottom of system information?

zaj78 avatar Aug 03 '26 20:08 zaj78

@marcelGoerentz Could you try once again or give me a tip on how to persist current settings?

@claude could you prepare a PR, where the LG ESS settings getting stored when batter mode changes from normal to grid charging and then restore the settings when switching back to normal?

Did that work?

Unfortunately no

zaj78 avatar Aug 03 '26 20:08 zaj78

Retrieve the current settings via the API, save them in a field of the struct in a map for example.

// LgEss implements the api.Meter interface
type LgEss struct {
        implement.Caps
        usage string     // grid, pv, battery
        conn  *lgpcs.Com // communication with the lgpcs device
        currSettings map[string]any
}

And you may need to add a mutex to make it thread safe.

marcelGoerentz avatar Aug 03 '26 20:08 marcelGoerentz

Summary of findings on LG ESS behavior:

Firmware:

  • PMS >= 10.05.7438

Observed behavior:

  • When EVCC enables backupmode, the battery stops discharging at ~20% SOC
Image Image

Verification via EnerVu Plus App:

  • Backup mode is enabled
  • Backup SOC is configured to 20%
  • Winter mode is enabled but currently not active (outside configured time range)
  • Battery operating range is 10% – 100%

Key observation:

  • As long as backupmode = ON, the system enforces a discharge floor of ~20%
  • When backupmode is not used, normal discharge below 20% works as expected

Additional test:

  • I manually changed Backup SOC from 20% to 5% via installer interface
  • This value was automatically reset back to 20% by the system

Conclusion:

  • The LG firmware appears to enforce a minimum Backup SOC (~20%) when backupmode is active
  • The backup_soc value set via API (EVCC) is ignored or overridden in this mode

Implication for EVCC:

  • Setting backup_soc alone is not sufficient to control discharge behavior
  • backupmode must be disabled to restore normal operation
  • Restoring the previous battery state (including backupmode) after grid charging is the correct approach

Happy to test any changes or provide additional logs if needed.

hmauchert avatar Aug 03 '26 20:08 hmauchert

Retrieve the current settings via the API

Don't see something useful on current state of backup mode it in current responses - only

    "wintermode": {
        "winter_status": "off",
        "backup_status": "off"
    },
    "backupmode": "",

I'll try to take a look at it over the weekend - my HomeAssistant reads that data somehow

zaj78 avatar Aug 03 '26 21:08 zaj78

Additional test: * I manually changed Backup SOC from 20% to 5% via installer interface * This value was automatically reset back to 20% by the system

@hmauchert, that "automatically reset back to 20%" could be the problem with your setup. I can't change this over installer settings without stopping operations, but if I change it in "user settings" (your first screenshot), it stays at whatever I set it to. Is where some other system, that sets it to 20%?

zaj78 avatar Aug 03 '26 21:08 zaj78

I have the same settings on my system, but the firmware for the PCS is slightly different. My system can be set to 0% when backup mode is on and the battery gets discharged until 10% SoC.

Nevertheless storing the settings before changing them and then restoring them after grid charging would be the best anyway.

marcelGoerentz avatar Aug 04 '26 04:08 marcelGoerentz

Additional test:

  • I manually changed Backup SOC from 20% to 5% via installer interface
  • This value was automatically reset back to 20% by the system

@hmauchert, that "automatically reset back to 20%" could be the problem with your setup. I can't change this over installer settings without stopping operations, but if I change it in "user settings" (your first screenshot), it stays at whatever I set it to. Is where some other system, that sets it to 20%?

@zaj78 yes this is correct.

I explicitly tested this without any external influence:

  1. Stop operations
  2. Change Backup SOC in installer settings (e.g. from 20% to 5%)
  3. Start operations again

Result:

  • The value is automatically reset back to 20%

There is no other system involved

This strongly suggests that the LG system itself enforces or restores this value.

hmauchert avatar Aug 04 '26 06:08 hmauchert

@zaj78 @marcelGoerentz

Additional finding:

After setting "Minimal SOC" in EVCC to 1% and restarting EVCC, the behavior changed significantly.

Test results:

  • Before: After grid charging, Backup SOC always returned to 20%

  • After setting EVCC minimal SOC to 1%: After grid charging, Backup SOC now returns to 1%

This suggests:

  • The fallback to 20% is not a hard firmware limit
  • Instead, LG seems to restore a "valid" SOC value depending on the system state
  • EVCC configuration influences this behavior

This might indicate that EVCC does not always provide a consistent SOC state when switching modes.

TestDetails: Ladezustand Speicher während der Tests: ca. 46% bis 50%

Test 1: auf der UserAkku-Seite 20% auf 0% geändert und gespeichert. Wiederholtes aufrufen der Seite hat den Wert nicht geändert, bleibt also gespeichert. Auf der Installateur-Seite steht jetzt auch 0% ohne das ich auf der Installateur-Seite diese Wert geändert habe. Dann das Netzladen provoziert. Auf der UserAkku-Seite geht der Wert auf 95%. Auf der Installateur-Seite steht jetzt auch 95% Dann das Netzladen beendet und der Wert auf der UserAkku-Seite springt auf 20% Auf der Installateur-Seite steht jetzt auch 20%

Test 2: Normalbetrieb beendet auf der Installateur-Seite den Wert auf 10% geändert (Das System gibt einen Bereich von 10-50% vor) Normalbetrieb gestartet auf der UserAkku-Seite den Wert kontrolliert: dort stehen jetzt auch 10% Dann das Netzladen provoziert. Auf der UserAkku-Seite geht der Wert auf 95% und bleibt bei 95% (der Wert steht jetzt auch auf der Installateur-Seite) Dann das Netzladen beendet und der Wert auf der UserAkku-Seite springt auf 20% ebenso wie auf der Installateur-Seite.

EVCC Konfiguration geändert: auf der Battery-Seite den optionalen Wert für "Minimaler Ladestand" von 'leer' auf '1%' geändert gespeichert und EVCC neu gestartet.

Wiederholung Test 1: auf der UserAkku-Seite 20% auf 0% geändert und gespeichert. Wiederholtes aufrufen der Seite hat den Wert nicht geändert, bleibt also gespeichert. Auf der Installateur-Seite steht jetzt auch 0% ohne das ich auf der Installateur-Seite diese Wert geändert habe. Dann das Netzladen provoziert. Auf der UserAkku-Seite geht der Wert auf 95%. Auf der Installateur-Seite steht jetzt auch 95% Dann das Netzladen beendet und der Wert auf der UserAkku-Seite springt auf 1% Auf der Installateur-Seite steht jetzt auch 1%

hmauchert avatar Aug 04 '26 07:08 hmauchert