Repository navigation
EV charging in EMHASS: which use-cases should the docs cover? (and: would a Cookbook section help?) #824
Replies: 16 comments 21 replies
Yes a cookbook section is probably a good idea. |
|
A very related entry to this discussion here: #820 |
|
@OptimalNothing90 A) Scheduling/calender B) Charging behavior: C) User interface (UI): D) Charger integration: |
|
Regarding the opportunistic charging and the mandatory kWh target I've found the solution is a dynamic target. Myself and I suspect many people are running MPC calls fairly frequently (5 minutes for me). This means that I can dynamically update the expected excess (to allocate to the EV) every 5 minutes and the charge duration changes with it. So although it is "mandatory" on each MPC call it can be recalculated dynamically. |
|
I'm confused with
Isn't it what a non-semi-continuous-deferrable is about ? Like defining the max charging power as nominal load for the deferrable + the minimum power ? I thought that was something that was supported |
|
deferrable loads also have operating_timesteps_of_each_deferrable_load you can use (undocumented runtime parameter if you have timesteps smaller than 1 hour) and they do have minimum and nominal power. Minimal was introduced for ev charging for 6A minimum (1,2kw for 1phase, 4,2kw for 3phase charging) |
Quick status updateLots of useful feedback in this thread. @marst444's grouping, @TD944's trick of recalculating the kWh target every MPC call for surplus charging, @PerretDavid and @scruysberghs confirming that Three things jumped out:
I've been working on an approach that could address this inside EMHASS — not just for EVs, but as a general pattern for flexible loads with state (think heat pumps, DHW deadline profiles, battery priority rules). If it works, it would simplify what @informatico-madrid's component has to do on the outside while letting his trip planning logic and EMHASS's optimizer work together more directly. @informatico-madrid — would you be up for reviewing an early RFC draft? Your multi-trip window calc and deficit propagation are exactly the kind of domain knowledge that should shape how this gets built. Next steps on my side:
Separate from all that: cookbook recipes for the patterns that work today. I'll keep collecting input here and start drafting those. The architecture question is its own track. |
|
Quick status, I was the last week very busy and will review everything here as soon as possible |
|
quick update: I opened a discussion on evcc to understand it they would support an adapter to emhass, as evcc knowns all edge cases already. see evcc-io/evcc#29815 if interessted, but it's in german |
|
Hi all — apologies for the silence. I've been heads-down for the past few weeks on a significant Now that it's in better shape, my next focus areas are:
@OptimalNothing90 — the evcc discussion you opened looks really interesting. I'll dig into it. |
|
@OptimalNothing90 @davidusb-geek Happy to pitch in on this, and the evcc side (#9) especially since I've got it running in production rather than in theory. My setup has EMHASS (naive-mpc) as the planner and evcc as the EV-only enforcement layer for a Tesla. EMHASS owns the optimisation across a few deferrables (an EV must-charge floor, an EV PV-surplus top-up, and a pool pump) against a TOU tariff with a hard export cap and no feed-in tariff. evcc just executes the per-loadpoint decision and reads SoC/range/state back. The Tesla command path is fully self-hosted and free: own Fleet app plus tesla-http-proxy for signed commands, with a Cloudflare Worker serving the well-known public key so Tesla's domain validation passes without standing up a public web server. A few things worth capturing in the cookbook from actually living with this:
I'd be glad to write the evcc-coupling recipe (#9) end to end against this live deployment, following whatever template you settle on, and to review the others. If there's appetite for a first-class EV deferrable type or a stateful-context API, I'm happy to be a daily-driven test bed for it. |
|
Hi, as discussed before, I completely agree with this approach. Remember that we want to keep EMHASS strictly hardware-agnostic and stateless. Its speed and stability rely on being a stateless MILP optimizer. Building complex, stateful multi-trip logic or hardcoded third-party adapters (like EVCC) directly into the core risks bloating the architecture and slowing down the solver. But don't get me wrong, I do highly respect the engineering that has gone into calculating multi-trip windows and stateful contexts. I think the Cookbook is the best way to channel this amazing community knowledge on these EV related topics |
|
Thanks @davidusb-geek, that split makes sense to me. Keep the solver hardware-agnostic and stateless, and push the EV glue into copy-pasteable recipes. I had a look at the cookbook as it stands. The EV section already notes the evcc-coupled recipes are waiting on evcc-io/evcc#29815, but that thread is about EMHASS running as an evopt-style backend inside evcc, with evcc as the master. The integration I run is the other way around: EMHASS stays the master MPC across the deferrables and the battery, and evcc only enforces the EV charge downstream. That model doesn't depend on #29815 landing, so I think it can go in now without treading on the backend work. If it's useful I'll write that one up against @OptimalNothing90, you're driving #29815 and the wider EV pattern list here, so I don't want to overlap. I'm happy to keep mine to the EMHASS-on-top / evcc-as-enforcer angle and leave the evcc-backend recipe and the broader catalogue (daily-commute, calendar-driven, surplus-only, and so on) with you. Does that division work for you both? If so I'll get a draft up for review. |
|
@OptimalNothing90 Yeh, I wouldn't mind this, just to make you aware I am in Australia, so coordinating could be tricky, happy to give it a crack though. |
|
@davidusb-geek @scruysberghs Approach 1 is basically what I run in production, so I can speak to it rather than in theory. EMHASS (naive-mpc) is the master planner across the deferrables and the battery, and evcc only executes the EV charge. It holds up well. The override doesn't need MQTT specifically. evcc's REST API exposes the charge goal (its session SoC limit and energy plan) and takes the loadpoint mode (now/pv/off) over the LAN, so a HA rest_command is enough. The piece that matters more than the transport is recomputing the EV's required energy and window from live SoC on every MPC pass, rather than pinning a static kWh target. That's the same point TD944 made earlier, and it's what makes the "mandatory" deferrable behave on a dynamic tariff. One honest caveat from doing it: EMHASS plans the EV on/off at nominal and does the time-shifting, it isn't modulating the charge current within a slot. Map every planned-on slot to evcc "now" and you charge at the configured rate in the cheap slots EMHASS picked, which is what you want for a deadline. If you'd rather follow PV surplus within the window you run evcc in pv/minpv instead and accept it may deliver less than planned. Worth being clear which of the two you're after. The "evcc UI shows Fast" point is real but cosmetic. You keep evcc's UI for setting goals and EMHASS overrides the mode underneath, which is the closest answer to @scruysberghs's "evcc as controller and UI, EMHASS as optimiser" question that works on released software today. On Approach 2, I'd be careful recommending the fake-tariff route where EMHASS is meant to be the optimiser. You end up with two planners: evcc still re-plans against the shadow price on its own cadence, so it can disagree with EMHASS at the edges, and you lose the real price in the evcc UI. Neat nudge, but I wouldn't put it on the control path. Your external-planner-type idea is the clean long-term answer, and it's close to what @OptimalNothing90's evcc thread (#29815) is circling. Worth pushing there. I've put the "EMHASS as planner, evcc as enforcer" recipe up as the first cookbook addition, written against this live setup: #990. |





Uh oh!
There was an error while loading. Please reload this page.
Following up on #789, which started as a question about @tomvanacker85's fork but turned into a real use-case sharing thread. Bringing it here as a discussion so it stays discoverable and we can keep adding patterns.
I'm running EMHASS + EVCC + Node-RED at home, tuning it week by week. EMHASS as the single planner, EVCC handling hardware enforcement, Node-RED in the middle. The patterns below are not theoretical, they're what I actually run. My aim is to get them into shape so the next user can copy a recipe instead of re-deriving it from scratch.
The new EV walkthrough is an early draft on purpose. It covers one pattern: windowed deferrable-load with pre-deadline kWh-target. That's the common case, not the only one.
Looking through #789, at least nine distinct EV use-cases came up. Worth crowdsourcing which deserve full first-class recipes (config + Node-RED/HA snippet + caveats) and which are better as variants on the existing
ev.mdpage.Use-cases from #789
operating_hours.hours = (target_kWh - current_kWh) / charger_kW, recomputed per MPC call. Plug-aware:start_timestep = 2h_futurewhen unplugged,0when plugged. (@purcell-lab, my setup)evcc/loadpoints/N/mode/setper slot. (my setup, prototyping)Plus the one @xitation already offered: a simplified pure-HA setup guide (no Node-RED, no EVCC) referenced via sigenergy.annable.me/emhass/, which David already invited to bring into the docs.
What to share
If you run EMHASS with an EV, drop a comment with: which pattern you use (one of the nine, or a new one), why the default deferrable-load didn't work for your case, the actual config or Node-RED/HA snippet, and the edge cases that bit you. Real numbers in
runtimeparamspayloads are gold. So is anything for modulating chargers (Tesla 3.6–11.5 kW is the worst fit for deferrable-load right now), multi-EV households, and calendar-integration patterns.A meta-question to @davidusb-geek
Looking at these nine, plus what's already on other pages (DHW deadline profile, MPC payload templates, infeasibility triage), they're recipes. Short, focused, copy-pasteable solutions to "I want to do X with EMHASS". Not narrative walkthroughs like
heat_pump_walkthrough.md, not parameter references likethermal_battery.md. They sit between the two, andstudy_cases/is starting to feel mismatched as it picks up more of them.A lot of Python projects solve this with a Cookbook section (scikit-learn is one example most readers know). Each recipe is short, follows a fixed template, stands on its own. Readers grep for "EV", "DHW", "Tibber".
Would a
docs/cookbook/folder be welcome? Walkthroughs instudy_cases/stay narrative, recipes get a scannable home. Happy to sketch an initial structure as a separate small PR if you're interested. If you'd rather keep everything understudy_cases/, that's fine too, the recipes just go there.Where this lands
I'll collect responses and post a normalized draft as a follow-up comment for community review before any PR. Best guess on outcome: 2–3 EV recipes (commute / surplus-only / multi-day),
ev.mdbecoming a single-pattern intro, plus agood_practices.mdsection for cross-cutting bits. @xitation's pure-HA guide as its own page.Comments not PR is fine. Screenshots, Node-RED flows, HA YAML all welcome.
cc @davidusb-geek @tomvanacker85 @scruysberghs @marst444 @xitation @PerretDavid @purcell-lab @TD944, since you all put real patterns into #789.
All reactions