Optimizer
Which solver decides what your battery does next, how finely it plans, and the limits it has to stay inside.
What this is for
- I want the battery to charge when power is cheap and carry me through the expensive hours.
- I want to choose between the solver built into EOS Connect and one I already run myself.
- I want to keep the plan inside the import and export limits my grid operator gave me.
Everything on this page sits under eos.*. What the optimizer is
given — prices, forecasts, measured load — is configured on the
other pages in this section.
Choosing an optimizer
The optimizer decides what your battery does next. Set it in
eos.source.
local_evopt
The default. A mixed-integer solver running inside EOS Connect. Nothing else to install or keep alive.
eos_server
Akkudoktor EOS, running separately. The most detailed house model, and the only backend that uses the outside-temperature forecast.
evopt
An external EVopt server. Lightweight, fast, and useful if you already run one.
Tuning the built-in optimizer
Three settings shape its behaviour, and all have sensible defaults:
eos.local_evopt_charging_strategy— defaultcharge_before_export: fill the battery before selling surplus to the grid. Alternatives aredischarge_before_import,maximize_self_consumption,attenuate_grid_peaksandnone.eos.local_evopt_discharging_strategy— defaultdischarge_before_import: use stored energy before buying. Oremergency_reserve, ornone.
eos.local_evopt_terminal_soc_value — default
cheapest_ahead: decides what charge still in the battery when the
planning horizon runs out is worth. This matters more than it sounds. The
optimizer plans a fixed window and then stops, so whatever it thinks the
leftover charge is worth is what decides whether it saves energy for tomorrow
or spends it tonight.
cheapest_aheadvalues it at the lowest electricity price in the horizon. Charging and discharging both lose a little to conversion, so this leaves a band around that price in which the battery simply holds: nothing is cheap enough to be worth buying just to store, and nothing near the bottom of the tariff is dear enough to be worth emptying into. It fits the way the planning window is cut — it always ends at midnight, and midnight is always followed by the cheapest hours of the night, so charge left over at the end can be bought back shortly afterwards for about the same price. On a day with cheap grid power available throughout, that means the battery is expected to end close to empty, and that is the correct answer rather than a fault.stored_priceis the old behaviour, kept so you can go back: leftover charge is valued at what it cost to put there. On a mostly solar-charged battery that is close to nothing, so the optimizer treats a full battery at the end of the horizon as near-worthless and empties it — even into cheap hours, and even when it means exporting solar surplus for the feed-in tariff rather than keeping it.
The external EVopt server runs the same engine and is sent the same figure,
so eos.external_evopt_terminal_soc_value does the same job when
eos.source is evopt. Only the slots genuinely ahead
are considered — in quarter-hourly mode the forecast wraps around, and
yesterday's prices trailing the end of it are not offers you can still take.
Set eos.local_evopt_emergency_reserve_pct above 0 to hold a hard
floor of charge in reserve at the end of the planning horizon, for outage
cover. It is a floor, not an economic signal — deciding how much charge
is worth keeping is
eos.local_evopt_terminal_soc_value’s job.
If your grid connection is limited, cap it explicitly with
eos.local_evopt_max_grid_import_w and
eos.local_evopt_max_grid_export_w. Both default to
0, meaning "use the inverter's own limit".
eos.local_evopt_num_threads sets how many threads the CBC
solver uses; 0 means automatic.
The solver's time is one budget per optimization, shared by every run of
the charging-curve loop and the cost comparison for managed loads:
eos.local_evopt_time_limit if set, otherwise 80 % of
eos.timeout, and never more than a quarter of the optimization
interval (refresh_time). CBC usually finds its plan within
seconds and spends the rest proving it optimal, so a plan cut off by the
budget is the one it would have kept. The log says so when that happens:
best plan found within the time limit.
The external-EVopt equivalents,
eos.external_evopt_max_grid_import_w and
eos.external_evopt_max_grid_export_w, ship with a default of
10000 W, not 0. The fallback to the
inverter limit therefore never fires unless you set them to
0 yourself.
Plan stability
The optimizer starts from scratch every cycle and does not remember what it decided fifteen minutes ago. Where two plans cost almost the same — a flat price curve with a full battery, a heat pump that could run at 11:00 or at 12:00 for half a cent of difference — it picks one more or less at random, and the next cycle may pick the other. A device then starts, stops half an hour later and starts again, and the next planned start an automation reads keeps moving.
To stop that, every Wh a decision moves away from the previous cycle's plan
for the same slot costs a fraction of the mean import price:
eos.local_evopt_plan_stability_weight, default
0.25. A real change — new day-ahead prices, a forecast that
moved a lot — is worth more than that and still wins; noise is not.
The full weight applies to the next two hours, where a change switches
something on or off; further ahead only a fifth of it, so a run planned
for the afternoon still moves for a modest saving. Because moving a run
counts its energy twice — off where it was, on where it goes —
the default means a run about to start moves for a saving of more than
half the mean price, one hours away for more than a tenth.
0 switches it off. The penalty only shapes the plan: it is not
part of the cost the dashboard reports.
eos.local_evopt_plan_stability_scope decides what it applies
to. managed_loads (default) holds the managed loads, which are
what switch something on and off. managed_loads_and_battery
also holds battery charging and discharging, for installations where the
charge plan visibly jumps between cycles. off disables it.
Measured over a day of quarter-hourly replanning with a heat pump, a 16 kWh battery and noisy PV forecasts: 3.0 starts a day and 19 jumps of the next planned start by an hour or more without it, 2.0 starts and under 4 jumps with the default, at 5 % less electricity. After a restart there is no previous plan, so the first cycle runs without it.
Planning resolution
eos.time_frame sets how finely the day is sliced:
3600 seconds (hourly, the default) or 900 (quarter-hourly).
Quarter-hourly follows a volatile tariff more closely and costs more computation.
Changing it needs a restart.
It also decides what happens to data that arrives more finely than
the slots. Prices are a rate, so an hourly slot averages the
quarter-hours it covers — a spike in one of them is flattened
into the other three, and the plan cannot act on what it can no longer
see. Load is energy, so it is summed instead: the total stays exact,
but the shape within the hour is gone.
EVCC is the case where
both arrive that way — its energy history and its persisted
tariff slots are quarter-hourly — so 900 plans on
what it actually measured. What that costs is the size of the problem
the optimizer solves: 192 slots across the horizon instead of 48.
Solar is energy too, and how much shape survives depends on the
provider. openmeteo plans on the quarter-hourly energy
Open-Meteo publishes, so at 900 the sunrise and sunset
ramps and a passing cloud each land in their own slot;
Forecast.Solar
buckets at its own resolution. The providers that answer hourly
— openmeteo_local and Akkudoktor — have one
value per hour to give, so each quarter gets a quarter of it: the
day's total is right, the shape inside the hour is flat.
With the Akkudoktor EOS server, quarter-hourly needs a recent
build. EOS has two optimization endpoints. The older
/optimize runs an algorithm whose interval is fixed at
3600 s; only /v1/optimize, added in later builds,
accepts 900. EOS 0.2.0 and 0.3.0 do not have it.
You do not have to work out which you are running: EOS Connect asks the
server when it starts. If it can, your 900 stands and the
requests are reshaped for that endpoint behind the scenes. If it
cannot — or is unreachable — the run falls back to hourly
and the log says why. EVopt and the built-in Local EVopt always plan
quarter-hourly.
A server that offers /v1/optimize is talked to through it
for hourly planning as well, not only for quarter-hourly. EOS marks
the older endpoint deprecated, and following that keeps the legacy
path to the servers that have nothing else. Nothing about this is
configurable and nothing about it is visible in the plan — the
log line at startup names the endpoint in use.
Behind /v1/optimize, EOS reads battery, inverter and car from
its own device configuration, and EOS Connect writes them there. Recent
builds describe these devices by profile; EOS Connect asks the server
for that as well and writes capacity and power limits as profile
adjustments — see The
battery itself for what the profile takes over.
Dynamic PV override
Set eos.dyn_override_discharge_allowed_pv_greater_load to allow
discharging in any slot where forecast solar exceeds forecast load, even if the
optimizer planned to hold. It stops the battery sitting idle through a bright but
intermittently cloudy afternoon that the plan treated as one flat block. Off by
default.
It never overrides a slot where grid charging was requested, and a manual override you set in the dashboard always wins over it.
The override is in effect from the first second of a slot. It is already applied to the upcoming slot, so the inverter is not briefly set to avoid discharge at the slot change while it waits for the next optimization run.
The rest of the optimizer settings
Timeouts, solver limits, and the import and export ceilings your grid operator sets — the last of these are explained under Grid import and export limits.