Optimizer: derive per-device action suggestions from result
Replaced reverted https://github.com/evcc-io/evcc/pull/30783
Converts the optimizer schedule into a per-device advisory action for the current slot, surfaced alongside the existing evopt-batteries payload. Advisory only — control (loadpoint/battery) is intentionally not wired up yet.
Because the optimization is linear, the first slot sits at an operating-range extreme, so it maps cleanly onto the discrete action that control would later apply. An idle battery is interpreted from the grid flow:
- home battery:
charge(charging while importing from grid),hold(idle while importing, i.e. discharge withheld),holdcharge(idle while exporting, i.e. charging withheld), elsenormal - loadpoint/vehicle:
charge/stop - plus the raw recommended charge/discharge power (W)
batteryResult gains a suggestion field; no new publish topic and no change to requiredBatteryMode() or loadpoint.Update().
TODO
- [ ] expose in UI @naltatis
@copilot resolve the merge conflicts in this pull request
@copilot resolve the merge conflicts in this pull request
Resolved by merging origin/master into this branch and fixing the conflict in core/site_optimizer_test.go. Included in commit 014accd.
Created UI for battery and loadpoints. Updated publishing structure. See description and screenshots above,.
Following this with interest. It looks like the direction that would replace a workaround I'm running.
I have a Vaillant aroTHERM heat pump modelled as a heating loadpoint (SoC = DHW tank temperature), PV-only + dynamic tariff + smartCostLimit, no EV. Two behaviours I currently emulate with a small external script that just flips the loadpoint's limitSoc via the API:
- source-dependent target: store to 60 °C only from PV surplus, cap grid/smartCost heating at 50 °C (the last 10 K are the worst COP band, and on grid they're pure loss vs. feed-in);
- forecast gate: don't grid-charge in the morning if the solar forecast says PV will cover the tank for free later today.
Both are exactly what a price+forecast optimizer should decide on its own, so I'd rather drop the script.
Will the per-slot suggestions (and later the wired-up control) extend to heating/thermal loadpoints, where "SoC" is a tank temperature and the store is thermal rather than a battery/EV? Or is the initial scope battery + EV only? Happy to test on a real thermal + PV + dynamic-tariff system if that's useful.
NICE!