Skip to content

Home battery discharge control  #10379

Closed
@GrimmiMeloni

Description

@GrimmiMeloni

Overview

Disable home battery discharge during fast mode/planner charging. The intention is to prevent home battery draining while a car is charging. The use case arises either during winter, or when charging at night based on planner. There's prior art in multiple forms (either through messaging or mqtt). However, the general ask comes up time and again, see #5826, #7979, #9090, #9301, and probably more, so I feel it makes sense to drive towards "standardization" and I am willing to donate my time to do the required groundwork.

The way to keep the battery from discharging is vendor specific. Depending on capabilities of battery hardware the behavior can be achieved either through simple enabling/disabling the battery discharge, or controlling the discharge power of the battery, or by pinning the SOC of the home battery.

For clarity: Independent from the way the discharge is prevented, it generally means that ALL power for the home will be taken from the grid , not just the car charge.

Assumptions

  • This feature only makes sense if the HEMS system does not provide this natively (or am I missing something?)
  • Battery control is applied site wide (we could allow „low energy“ load points like bike chargers to opt out in a later iteration)
  • Only works with 1 single battery (like the rest of evcc currently does)
  • Smart Charging of Batteries is considered a related but different use case and will not be covered in the initial implementation.

Deliverables

  1. a generic interface for battery discharge control
  2. implementation of required logic in evcc's main control flow
  3. an example implementation of the interface based on Tesla Powerwall (as that's what I own and can test)

The intention is that ideally others can further contribute implementations of the interface for other hardware going forward.

Control Flow

  • Site controls the battery discharge as part of the interval
  • Check site has battery discharge control enabled, if not end here
  • Decide on required battery discharge control as follows
    • for each loadpoint, check
      • If it is charging, AND
      • If the charge mode is either fast, or the planner is active

    • If all above conditions are met for at least one loadpoint, battery discharge should be disabled
    • If not, battery discharge should be enabled
    • perform enable/disable operation as determined

Configuration

Site.batteryDischargeControl = true



Battery specific configuration options will differ, depending on how control is achieved, for example

  • Default / reset values, that represent „unlimited“ state if these are not static (e.g. Tesla power wall emergency reserve 20%)
  • Specific authentication options for battery control (e.g. tesla PW needs additional cloud API tokens to control battery discharge)
  • 
other specific things that cannot be hardwired into the batteries' implementation

Config Validation

  • site needs to do a config sanity check on boot up, to ensure that configured battery support discharge control if the global switch for battery control is set
  • the battery must check for required (optional, type specific) config values if the discharge control is enabled for the site

API

BatteryDischarge // optional interface implemented by Batteries
- Enable(bool) 
- Enabled() bool //indicates if battery is currently allowed to discharge


Notes

  • For „simple“ batteries (like the Powerwall), any value for SetLimit() (other than -1) would equal a limit of 0, i.e. discharge is completely disabled.
  • We could also make the interface more speaking, by replacing the magic value -1 with a dedicated Unlimited() instead.
  • If helpful (for UI, or messaging?), we could also have GetLimit() int on the interface

Other considered but scratched solutions

  • There was an idea to control the discharge power of the battery, trying to matching home’s power consumption as closely as possible (this would limit grid usage to car charging, while home power is still covered by the battery). This was rejected for now, as it is unclear if this might lead to increased wear of the flash memory of the hardware.
  • The above idea was also causing a need for a slightly different interface referred to as SetLimit(limit int). This was replaced by the binary Enable(bool) shown above, as the current scope does not require more.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions