Skip to content

Adding an EV to your system

This walkthrough adds an electric vehicle (EV) to an existing home energy system. It covers creating a trip calendar, scheduling trips, and configuring the EV element so HAEO charges the car ahead of departures. It follows a BYD Atto 2, but any car whose integration provides similar sensors works the same way.

System overview

After completing this walkthrough, your system will include:

  • Base system: Inverter, battery, solar, grid, and load (from the Sigenergy System guide)
  • EV: a 51.13 kWh battery on a 25 kW Sigen DC charger, a 20% minimum charge, and a trip calendar
graph LR
    subgraph DC Side
        Battery[Battery<br/>32kWh] <--> Inverter
        Solar[Solar<br/>27kW] --> Inverter
        EV[EV<br/>51.13kWh<br/>25kW DC charger] <--> Inverter
    end

    subgraph AC Side
        Inverter[Inverter<br/>30kW] <--> Switchboard[Switchboard]
        Grid[Grid<br/>±55kW/±30kW] <--> Switchboard
        Switchboard --> Load[Load<br/>1kW]
    end

Prerequisites

Complete the Sigenergy System walkthrough first. This guide builds on that configuration and adds a trip calendar and an EV element.

EV sensors

The car's integration provides its battery level, odometer, and consumption, and the Sigenergy integration provides the DC charger's sensors:

  • Battery level: the car's state of charge.
  • Plugged in: required, since you need one to automate charging anyway. Here it is the charger's Running State, which reports words such as Idle, Occupied, or Charging rather than on or off. HAEO asks which of its states mean unplugged when you add the EV. A binary sensor from the car or the charger works too, without that step.
  • Charge rate: the charger's Rated Charging Power, 25 kW.
  • Odometer (optional): tells HAEO how far the car has gone on the current trip, so a car that is back early is not planned as if it had not left. It needs a state class of total_increasing, which car integrations usually set.
  • Average consumption: turns each trip's distance into the energy it needs, so it is required. A sensor in kWh/100km, kWh/km, Wh/km, km/kWh, or mi/kWh lets trip energy follow how the car is actually driven; you can enter a fixed figure instead.

Step 1: Create a trip calendar

HAEO reads upcoming trips from a Home Assistant calendar. Create a dedicated Local Calendar so trip events stay separate from your personal calendars.

Navigate settings home
Navigate settings sidebar
Navigate settings settings page
Navigate integrations settings item
Add integration page
Add integration button
Search integration dialog
Search integration search box
Search integration results
Search integration select
Dialog opened
Fill Calendar name field
Fill Calendar name filled
Click Submit target
Success dialog dialog
Success dialog finish button
Success dialog result
1 / 17 Navigate settings home

Step 2: Schedule a trip

Create an event for each trip. Its start and end mark when the car is away, and its title says where it goes and how far, such as Office 105 km. The commute happens every day, so set it to repeat daily and each day's trip is planned without adding it again.

Success dialog result
Navigate calendar sidebar
Navigate calendar calendar page
Create event add button
Create event event dialog
Create event title field
Create event title filled
Create event start time hour
Create event start time minute
Create event end time period
Create event end time hour
Create event end time minute
Create event recurrence selector
Create event recurrence option
Create event recurrence set
Create event save button
Create event event saved
1 / 17 Success dialog result

Distance format

Write the distance as a number followed by its unit, such as 105 km or 30 mi, among any other words in the title. Keep to one distance per event: a title with two distances, or a number without a unit, is ignored, and HAEO raises a repair issue so you can fix the event. An event without a distance still marks the car away for its duration, but asks for no trip energy. An event with an unrelated number, such as Pick up 2 kids, raises a repair issue; add 0 km to its title to say it needs no energy.

Step 3: Add the EV element

Navigate to the HAEO integration page and add the EV element.

Create event event saved
Home
Sidebar
Settings page
Settings item
Card
Integration page
1 / 7 Create event event saved

Configure the EV with its battery, charging, and trip details. A DC charger is part of the inverter, so the EV connects to the Inverter. An AC charger would connect to the Switchboard instead.

Integration page
Click EV target
Dialog opened
Fill EV name field
Fill EV name filled
Select Connection dropdown
Select Connection option
Select Connection selected
Choose Battery capacity Constant button
Choose Battery capacity Constant selected
Constant Battery capacity field
Constant Battery capacity filled
Entity Energy per distance picker
Entity Energy per distance search box
Entity Energy per distance search results
Entity Energy per distance select
Entity Energy per distance selected
Entity Current state of charge picker
Entity Current state of charge search box
Entity Current state of charge search results
Entity Current state of charge select
Entity Current state of charge selected
Choose Min charge level Constant button
Choose Min charge level Constant selected
Constant Min charge level field
Constant Min charge level filled
Entity Max charge rate picker
Entity Max charge rate search box
Entity Max charge rate search results
Entity Max charge rate select
Entity Max charge rate selected
Entity Plugged in picker
Entity Plugged in search box
Entity Plugged in search results
Entity Plugged in select
Entity Plugged in selected
Expand Trips collapsed
Expand Trips expanded
Choose Trip calendar Entity button
Choose Trip calendar Entity selected
Entity Trip calendar picker
Entity Trip calendar search box
Entity Trip calendar search results
Entity Trip calendar select
Entity Trip calendar selected
Choose Odometer Entity button
Choose Odometer Entity selected
Entity Odometer picker
Entity Odometer search box
Entity Odometer search results
Entity Odometer select
Entity Odometer selected
Expand Public charging collapsed
Expand Public charging expanded
Constant Public charging price field
Constant Public charging price filled
Expand Efficiency collapsed
Expand Efficiency expanded
Constant Charge efficiency field
Constant Charge efficiency filled
Click Submit target
Dropdown States meaning off Idle dialog
Dropdown States meaning off Idle select
Dropdown States meaning off Idle selected
Dropdown States meaning off Fault dialog
Dropdown States meaning off Fault select
Dropdown States meaning off Fault selected
Dropdown States meaning off Alarm dialog
Dropdown States meaning off Alarm select
Dropdown States meaning off Alarm selected
Click Submit target
Finish dialog dialog
Finish dialog button
Finish dialog result
1 / 74 Integration page

After you submit, HAEO asks which of the Running State's states mean on and off. Choose Idle, Fault, and Alarm as the states meaning off: every other state, such as Occupied or Charging, then counts as plugged in. In Fault or Alarm the charger cannot charge until the car is replugged, so counting them as unplugged keeps HAEO from planning a charge that cannot happen. HAEO lists the states the charger has reported recently, so type any that are missing and add them as a custom item.

Charge only, at 93%

The max discharge rate is left empty, so HAEO only ever plans to charge the car, and the charge efficiency is set to this charger's measured 93%. Match HAEO's EV settings explains both.

Min charge and public charging

The min charge keeps the battery above 20% for an unplanned trip: HAEO never plans to drain past it. The public charging price is what a top-up away from home costs; HAEO weighs it against charging at home before each trip.

The 105 km commute at 14.6 kWh/100km needs about 15.3 kWh. HAEO plans that energy into the car before each departure, choosing the cheapest time to charge, and keeps the battery above 20% throughout.

Step 4: Verify setup

After completing configuration, verify that all elements were created successfully.

Finish dialog result
Final overview
1 / 2 Finish dialog result

Verification

Navigate to Settings → Devices & Services → HAEO to view the complete system.

Expected device hierarchy

Element Type Key Sensors
Atto 2 EV Charge power, energy stored, SOC, trip energy delivered

The EV element adds to the existing base system elements (Inverter, Battery, Solar, Grid, Load).

Key EV sensors

  • sensor.atto_2_charge_power — Optimal charging power (kW)
  • sensor.atto_2_discharge_power — V2G discharge power (kW), which stays at 0 without a max discharge rate
  • sensor.atto_2_energy_stored — Current energy in the EV battery (kWh)
  • sensor.atto_2_state_of_charge — EV battery percentage (%)
  • sensor.atto_2_trip_energy_delivered — Energy used by the current trip, reset at each trip start (kWh)
  • sensor.atto_2_trip_energy_shortfall — Trip energy expected to be topped up publicly, at each trip's end (kWh)

All sensors include a forecast attribute with optimized future values.

What to expect

With the commute scheduled:

  • Overnight: HAEO charges the EV during the cheapest electricity periods
  • Before departure: The EV reaches sufficient charge for the trip distance
  • During the trip: The EV is away; a trip energy shortfall appears at the trip's end only if home charging could not cover the trip
  • After return: HAEO resumes home charging based on the remaining schedule

The optimizer balances EV charging against battery storage, solar generation, and grid prices to minimize total system cost.

Automate the charger

HAEO plans when the car charges, but the Sigen DC charger only charges when something starts it and sets its limit. This section builds an automation that follows the plan through the charger's controls from the Sigenergy Local Modbus integration. Automating your hardware explains the pattern it follows.

Set up the charger

In the mySigen app, set the charger's charging mode to Fast charging. In this mode the charger is an independent load that follows its charge limit exactly, whatever mode the plant runs in, so HAEO's plan runs as written. That includes charging the car from the home battery while the home battery discharges.

Avoid the other modes:

  • Bidirectional (V2X) makes the car part of the plant's battery. The plant's mode then sets one direction for both, so the car charges barely at all in Maximum Self Consumption and can never charge while the home battery discharges.
  • Solar surplus is meant to charge from spare solar only, which would override any plan to charge from the home battery or the grid.

Also in the app:

  • Turn off any charging schedule, or the charger starts at its scheduled time regardless of HAEO.
  • Match the battery boost minimum to the home battery's min charge in HAEO, 10% in the Sigenergy walkthrough. The plant does not discharge the home battery below this level to charge the car, and may hold it there for the house too. If HAEO's min charge is lower, HAEO plans on energy the plant will not release, and the grid quietly supplies the difference.

Match HAEO's EV settings

The EV you added in step 3 is already set up for this charger:

  • Max charge rate is the charger's rated charging power.
  • Plugged in is the charger's running state, with Idle, Fault, and Alarm meaning unplugged.
  • Charge efficiency is 93%. HAEO plans the charge power on the home side of the charger, but the charger's limit caps the power it delivers to the car. This charger loses about 7% of its power across its range, so the automation multiplies the plan by the charge efficiency to get the limit. With an efficiency above the charger's real one, the charger draws more than planned, and when the home battery is already at its limit the grid supplies the difference at whatever price it is.
  • Max discharge rate is empty, so HAEO treats the car as charge-only, as Fast charging mode does.

Add a manual switch

Create a toggle helper so you can stop the automation and control the charger yourself at any time.

  1. Go to Settings → Devices & services → Helpers.
  2. Select Create helper → Toggle.
  3. Name it "HAEO EV charging control", which gives it the entity ID input_boolean.haeo_ev_charging_control.

Add the charging automation

The automation reads HAEO's sensor.atto_2_charge_power and number.atto_2_charge_efficiency, whose IDs start with the EV's name. It reads the charger's running state and drives its charge and discharge limits and its start and stop buttons. Their IDs start with sigen_inverter_dc_charger, which depends on how your plant and inverter are named, so check yours on the charger's device.

Go to Settings → Automations & scenes, create a new automation, select Edit in YAML from its menu, and paste:

alias: HAEO EV DC Charging
description: >-
  Start, stop and limit the Sigen DC charger to follow the charge power
  HAEO plans for the Atto 2.
triggers:
  # Changes to the plan, but not the forecast updates of every optimization.
  - trigger: state
    entity_id: sensor.atto_2_charge_power
    to:
    for:
      minutes: 1
  # React within seconds when the plan crosses the minimum charging power.
  - trigger: numeric_state
    entity_id: sensor.atto_2_charge_power
    above: 1.0
  - trigger: numeric_state
    entity_id: sensor.atto_2_charge_power
    below: 1.0
  - trigger: state
    entity_id: sensor.sigen_inverter_dc_charger_running_state
    to: [Occupied, Scheduled]
    for:
      minutes: 2
  - trigger: state
    entity_id: sensor.sigen_inverter_dc_charger_running_state
    to: Charging
    for:
      seconds: 10
  - trigger: state
    entity_id: input_boolean.haeo_ev_charging_control
  - trigger: time_pattern
    minutes: /5
conditions:
  - "{{ is_state('input_boolean.haeo_ev_charging_control', 'on') }}"
actions:
  - variables:
      running_state: sensor.sigen_inverter_dc_charger_running_state
      charge_limit: number.sigen_inverter_dc_charger_max_charging_power_limit
      discharge_limit: >-
        number.sigen_inverter_dc_charger_max_discharging_power_limit
      plan_kw: "{{ states('sensor.atto_2_charge_power') | float(0) }}"
      charger: '{{ states(running_state) }}'
      # The charger has been in its current state for at least 2 minutes.
      charger_settled: >-
        {{ now() - states[running_state].last_changed
           >= timedelta(minutes=2) }}
      efficiency: "{{ states('number.atto_2_charge_efficiency') | float(100) }}"
      min_kw: 1.0
      # Hold a charge through a pause in the plan shorter than this.
      hold_minutes: 10
      # Minutes until the plan next charges at min_kw or more, or none.
      minutes_to_next_charge: >-
        {% set ns = namespace(m=none) %}
        {% for f in state_attr('sensor.atto_2_charge_power', 'forecast') or [] %}
        {% if ns.m is none and f.value >= min_kw and as_datetime(f.time) > now() %}
        {% set ns.m = (as_datetime(f.time) - now()).total_seconds() / 60 %}
        {% endif %}
        {% endfor %}
        {{ ns.m }}
  - if:
      - condition: template
        value_template: '{{ states(discharge_limit) | float(0) != 0 }}'
    then:
      - action: number.set_value
        target: {entity_id: '{{ discharge_limit }}'}
        data: {value: 0}
    alias: Never discharge the car
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ plan_kw >= min_kw and charger == 'Charging' }}"
        sequence:
          - action: number.set_value
            target: {entity_id: '{{ charge_limit }}'}
            data:
              value: '{{ (plan_kw * efficiency / 100) | round(1) }}'
        alias: Charge at the planned power
      - conditions:
          - condition: template
            value_template: >-
              {{ plan_kw >= min_kw
                 and charger in ['Occupied', 'Scheduled']
                 and charger_settled }}
        sequence:
          - action: number.set_value
            target: {entity_id: '{{ charge_limit }}'}
            data:
              value: '{{ (plan_kw * efficiency / 100) | round(1) }}'
          - action: button.press
            target:
              entity_id: button.sigen_inverter_dc_charger_start_charging
        alias: Start once the charger has settled for 2 minutes
      - conditions:
          - condition: template
            value_template: >-
              {{ plan_kw < min_kw and charger == 'Charging'
                 and minutes_to_next_charge is number
                 and minutes_to_next_charge <= hold_minutes }}
        sequence:
          - action: number.set_value
            target: {entity_id: '{{ charge_limit }}'}
            data: {value: '{{ min_kw }}'}
        alias: Hold at the minimum when charging resumes soon
      - conditions:
          - condition: template
            value_template: "{{ plan_kw < min_kw and charger == 'Charging' }}"
        sequence:
          - action: button.press
            target:
              entity_id: button.sigen_inverter_dc_charger_stop_charging
        alias: Stop when no charge is planned soon
mode: queued
max: 3

If your EV has another name, replace atto_2 with it.

How it works

  • Follows the plan. While at least 1 kW is planned and the car is charging, it sets the charger's limit to the planned power times the charge efficiency.
  • Starts once the charger has settled. When charging is planned and the car is plugged in but not charging, it waits until the charger has been in that state for 2 minutes, then sets the limit and presses Start. That covers both a fresh plug-in and the gap after a stop. Pressing Start sooner makes the charger more likely to fault, and a start takes about 45 seconds of handshaking before the charger ramps up.
  • Holds through short pauses. When the plan drops below 1 kW while the car charges, it looks ahead in the plan's forecast attribute for the next period that charges at 1 kW or more. If that is within hold_minutes, 10 minutes, it holds the charger at 1 kW instead of stopping, so the session survives the pause without another handshake. The plan often pauses charging for a single price interval, so this saves many restarts.
  • Stops for long pauses. If no charge is planned within hold_minutes, it presses Stop, so the charger is not left running at low power, where its own overheads are a large share of what it draws. Planned charges below 1 kW are skipped.
  • Never discharges the car. It holds the charger's discharge limit at zero.
  • Runs when something changes. It runs within seconds when the planned power crosses 1 kW, once any other new planned power has held for a minute, when the car is plugged in or starts charging, when you turn the helper on, and every 5 minutes as a backstop. The empty to: on the plan trigger ignores the forecast updates of every optimization, so it only runs when the planned power itself changes.
  • Leaves the plant alone. It never changes the plant's mode, which the plant automation controls. In Fast charging mode the charger does not depend on it.

Known behavior

  • Restarting without replugging is unreliable. After a stop, a start often resumes charging, but sometimes the charger instead ends the session and raises a "Charging fault" alarm on the plant and inverter. The running state then reads Alarm, which HAEO treats as unplugged, and unplugging and replugging the car clears it. The 2-minute wait before Start and the hold through short pauses both make this rarer by avoiding quick stop and start cycles.
  • Holding draws a little power. A 10-minute hold at 1 kW uses at most about 0.17 kWh. Lower hold_minutes if your plan pauses often for long stretches, or raise it if your charger faults on most restarts.

Next steps