Skip to content

AlphaESS: add holdcharge and discharge battery modes - #36892

Open
Moving4407 wants to merge 2 commits into
evcc-io:masterfrom
Moving4407:alphaess-battery-modes
Open

Moving4407 wants to merge 2 commits into
evcc-io:masterfrom
Moving4407:alphaess-battery-modes

Conversation

@Moving4407

@Moving4407 Moving4407 commented Dec 4, 2026 •

Copy link
Copy Markdown

Follow-up to #36014. Answers my open question in #35785 (is there a dispatch configuration for "no charge, discharge allowed"). Related: #35029, #35388.

What

Adds the two battery modes the alpha-ess-smile template is missing. Both use the dispatch block with the same registers, write order, 120 s duration and watchdog as the existing modes.

evcc mode Dispatch mode Active power SoC target
holdcharge 19, "No Battery Charge" 32000 (0 W) unused
discharge 2, SoC control 32000 + maxdischargepower minsoc / 0.4

Why

  • The optimizer requests holdcharge to export PV surplus instead of storing it. Without the mode evcc falls back to normal and the battery charges against the plan.
  • discharge is needed for grid discharge at high feed-in prices. evcc only uses it when grid discharge is enabled for the site.

Source

AlphaESS "Modbus/Server API Guide V1.0 EN" (2022-11-11), table 1. Mode 19: "The system will be self-consumption mode, the charging power does not exceed the set power", marked "only for specifical EMS version". The document does not name the version, hence the added sentence in the requirements text. Mode 2 is the one charge already uses, here with a discharge power.

Tested on

  • Inverter: SMILE-T10-HV, firmware V0.C6 (ARM V0.04), AC-coupled
  • EMS: EMS3.5, V0.00.58; BMS V1.10
  • Battery: SMILE-BAT-8.2PH, 1 pack
  • evcc: 0.320.0 with the template loaded via --template, optimizer on (automatic: full), Modbus TCP, id 85

holdcharge

2026-12-04, SoC 81 %, vehicle not connected. Mode chosen by the optimizer; normal forced for 60 s through POST /api/batterymode/normal, after which evcc returned to holdcharge by itself. Values from the evcc state API (10 s interval), battery negative = charging, grid negative = export.

Time Mode PV House Battery Grid
10:23:00 holdcharge 4602 W 428 W 0 W -4174 W
10:23:10 normal (set) 4643 W 441 W 0 W -4202 W
10:23:18 normal 4409 W 428 W -1873 W -2108 W
10:23:39 normal 4536 W 530 W -4352 W +346 W
10:24:10 normal 4602 W 558 W -3986 W -58 W
10:24:20 holdcharge (set) 4624 W 436 W -4241 W +53 W
10:24:28 holdcharge 4581 W 363 W 0 W -4218 W
  • Charging starts within 10 to 20 s of leaving the mode and stops within about 10 s of entering it.
  • Before this run the battery stayed at 0 W in holdcharge from 10:17 to 10:23 with 4.6 to 5.4 kW PV and 4.2 to 5.0 kW exported, so the 30 s refresh keeps the mode alive.
  • Discharge is still allowed: on 2026-12-03 around 11:06, in holdcharge with house load slightly above PV, the battery supplied 52 to 78 W and the grid stayed within 15 W of zero. Only seen at this small power so far.

discharge

2026-12-04, SoC 82 %, maxdischargepower 1000 W, minsoc 4 %, vehicle not connected. Mode set through POST /api/batterymode/discharge and renewed once, then released with DELETE /api/batterymode. PV was producing about 4 kW, so the battery discharge shows as additional export.

Time Mode PV House Battery Grid
10:28:40 holdcharge (optimizer) 4019 W 380 W 0 W -3639 W
10:28:50 discharge (set) 4029 W 342 W 0 W -3687 W
10:29:01 discharge 4420 W 373 W +848 W -4895 W
10:29:19 discharge 4134 W 360 W +951 W -4725 W
10:30:31 discharge 4274 W 376 W +920 W -4818 W
10:30:39 normal (released) 4343 W 380 W +920 W -4883 W
10:30:49 holdcharge (optimizer) 4201 W -1434 W -2830 W
10:31:00 holdcharge 4231 W 357 W 0 W -3874 W
  • Discharge starts within about 10 s and settles at 920 to 950 W for a 1000 W setting, held for 100 s.
  • On release evcc passes through normal for one cycle, the battery briefly charges from PV, then the optimizer's mode applies again.

No Modbus errors in the evcc log during either run.

Not tested

  • discharge at higher power, and the stop at minsoc (evcc switches to holddischarge there).
  • holdcharge discharging under a large load.
  • Stopping evcc during either mode. Both use the same 120 s dispatch duration and watchdog as the existing modes.
  • holddischarge and charge are unchanged; holddischarge has been in daily use with this template since 2026-12-02.

Notes

  • Not tested: other generations (SMILE-G3, SMILE-B3) and other EMS versions. On firmware without mode 19 evcc would report holdcharge while the battery charges, since the template cannot read the result back. Feedback from @timigit-pro, @softcat and @praetorianer777 would be very welcome.

🤖 Template change and this text were prepared with Claude; tests were run and checked by me.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 6 issues


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@praetorianer777

Copy link
Copy Markdown
Contributor

Thanks for the follow-up, and for the detailed measurements.

I tried the template on a SMILE-T10-HV with EMS v0.11.67 (BMS v1.61, inverter V0.C6, Modbus TCP, id 85), which is a newer EMS than the V0.00.58 you tested on. I used the template from this PR, rendered as a custom battery on evcc 0.320.0.

Mode holdcharge was accepted. I set it through POST /api/batterymode/holdcharge, renewed it once, and read the dispatch registers back: 2176 = 1, 2177 = 32000 (0 W), 2181 = 19, 2183 = 120. There were no Modbus errors in the log, and releasing it with DELETE /api/batterymode returned the battery to normal.

I can't yet say whether mode 19 really blocks charging on this EMS version. At the time of the test PV (about 700 to 800 W) was roughly equal to the house load (about 650 to 680 W), so there was no surplus that the battery could have charged from. I also have not tested discharge, as there was no load to make that meaningful.

I can only run a proper test once there is more sun again. I'll repeat it with a PV surplus of at least 2 to 3 kW, in the same way as your tests (forced normal against holdcharge), and report back here with the numbers.

@softcat

softcat commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Quick check on my SMILE-B3 (EMS V1.00.66) with this template on evcc 0.320.0: holdcharge is accepted, the dispatch block reads back 2176 = 1, 2177 = 32000, 2181 = 19 after the first write and after the refresh. No Modbus errors, normal resets it as usual.

No effect visible yet though, battery was at its 15 % reserve and there's no PV. I'll test again when there's some sun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants