Skip to content

Battery discharge control: hold silently reverts after 60 min on Fronius GEN24 (one-shot write vs. SunSpec InOutWRte_RvrtTms) #33037

Description

@marknisk

Describe the bug

With batteryDischargeControl enabled, evcc correctly puts the home battery into hold mode when smart-cost (or plan/fast) charging starts — but the hold is written to the device once and never refreshed. On a Fronius GEN24 the SunSpec model 124 revert timer (InOutWRte_RvrtTms, register 40358) is 3600 s, so the inverter silently reverts to normal self-consumption exactly 60 minutes after evcc's single write. evcc's internal state still says "hold", so it never re-writes, and the home battery then discharges at full power into the vehicle charge for the rest of the session.

Any battery hold longer than 60 minutes is affected; shorter charges appear to work, which makes this easy to misdiagnose.

Observed behaviour (telemetry, 30 s resolution, times UTC)

Vehicle smart-cost charging at ~11 kW, home battery at 48%:

Time Event
21:00:41 Charging starts; one sample of ~7.7 kW battery discharge
21:01:11 Hold applied — battery power drops to ~1 W, SoC steady at 48%
22:00:41 → 22:01:11 Exactly 3600 s after the hold write: battery jumps to ~7.7 kW discharge (its maximum), grid import drops ~11.7 → ~4.2 kW, charging continues at ~11 kW
23:13 Vehicle reaches its 80% limit, charging stops; battery has drained 48% → ~23%

Smart-cost remained active the whole session (all hours ≤ the 0.12 limit), the loadpoint kept fast-charging, and there is no battery mode change or error in the logs — the release happens inside the inverter, not in evcc.

Root cause

  1. core/site_battery.gorequiredBatteryMode(): keepUnlessModified returns api.BatteryUnknown while the current mode already equals the required mode, so applyBatteryMode is skipped on every subsequent cycle. On current master this is reinforced in applyBatteryMode by the site.batteryModeApplied cache ("don't re-apply the mode the battery is already in").
  2. The fronius-gen24 template's batterymode hold case writes StorCtl_Mod=2, OutWRte=0 and does not touch InOutWRte_RvrtTms.
  3. The GEN24 (tested: Symo GEN24 Plus 8.0, FW 1.39.5-1) has InOutWRte_RvrtTms = 3600, so the storage-control settings expire after 60 minutes without a refreshing write. Per SunSpec model 124 this revert-timeout behaviour is standard, so other SunSpec storage devices are likely affected too.

Expected behaviour

The hold should persist for the whole charging session. Possible fixes:

Version

0.313.3 (behaviour verified unchanged in core/site_battery.go on current master)

Configuration

meters:
  - name: battery
    type: template
    template: fronius-gen24
    usage: battery
    host: <inverter>
    port: 502
    id: 200
site:
  meters:
    grid: grid
    pv: pv
    battery: battery
loadpoints:
  - charger: wallbox   # ocpp template
    vehicle: bmw_ix    # cardata template
    mode: pv

batteryDischargeControl: true and smartCostLimit: 0.12 set via UI.

Log details

Log level INFO — the session only shows (times local, UTC+3):

[lp-1  ] INFO 2026/08/21 00:00:41 start charging ->
[lp-1  ] INFO 2026/08/21 02:13:11 stop charging <-

No battery mode: errors, no planner warnings during the session. The hold engage/release timing above is from the site's InfluxDB export (batteryPower, batterySoc, gridPower, chargePower).

Metadata

Metadata

Assignees

No one assigned

    Labels

    devicesSpecific device support

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions