Skip to content
/ aio-ems Public

All-in-One Energy Management System for Home Assistant - Optimize EV charging using PV surplus and energy price forecasts.

License

Notifications You must be signed in to change notification settings

diemei/aio-ems

Repository files navigation

AIO‑EMS

GitHub Release GitHub Activity License

pre-commit Black

hacs Project Maintenance BuyMeCoffee

Discord Community Forum

This component provides an All-in-One Energy Management System: AIO-EMS. You can optimize the charging of your EV, heatpump, and home battery using the PV surplus, home battery, grid energy cost forecast, and weather forecast for future PV power. This component is in an early beta stage. For now the functionality is restricted to EV charging. It uses information from PV power and forecast, grid energy price forecast, and battery status. For EV charging the Tesla BLE HA component is used to control the charging and charging power. You will need to make some minor code changes to adjust this component to your wallbox, power converter, and home battery manager. See below feature extensions that I have in mind. Feel free to suggest other new features.

example

Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called aio_ems.
  4. Download all the files from the custom_components/aio_ems/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "AIO‑EMS"

Setup EV Charging (Tesla BLE)

For now EV charging is only supported for Tesla vehicles using the 'ESPHome Tesla BLE' component. This component uses a dedicated ESP controller to make Tesla charging controllable from HA. See ESPHome Tesla BLE for instructions to set this up. AIO-EMS assumes you already have a working Tesla BLE setup that exposes these entities:

  • Charger switch (switch.tesla_ble_*_charger_switch)
  • BLE connection switch (switch.tesla_ble_*_ble_connection)
  • Charging current number (number.tesla_ble_*_charging_amps)
  • Wake-up button (button.tesla_model_y_wake_up)
  • EV battery SOC sensor (sensor.tesla_model_y_battery)

Verify these entities exist in Home Assistant before enabling AIO‑EMS. If your IDs differ, adjust custom_components/aio_ems/config.py accordingly (see below).

Configuration with Code Edits

Some settings may need manual edits to match your hardware:

  • custom_components/aio_ems/config.pyENTITY_MAPPINGS: map logical keys (e.g., ev_charger_switch, ev_bt_connection_switch, ev_soc, grid_power, pv_forecast, energy_cost_forecast) to your real entity IDs.
  • custom_components/aio_ems/const.py → defaults for power limits (ev_charge_power_min/max/step), PV converter max, wallbox status strings (wallbox_ev_disconnected, wallbox_ev_waiting, wallbox_ev_charging), and comfort SOC thresholds. Adjust to your wallbox/EV limits.
  • EV_CHARGE_ECO_TOD_DEFAULT and EV_CHARGE_ECO_START_TIME_TOD in const.py define the default ECO window; change if your off-peak hours differ.

An options flow is not available yet; changes require manual file edits.

Setup Grid Energy Price Forecast

Install the custom component EPEX Spot. After installation, the entity sensor.epex_spot_data_total_price should exist and, on a regular interval (typically around noon), provide the "day ahead" forecast for today and tomorrow. For private users EPEX Spot is free of charge.

Setup PV power forecast

Install the custom component HA Solcast PV Solar Forecast. After installation, the entities sensor.solcast_pv_forecast_forecast_today and sensor.solcast_pv_forecast_forecast_tomorrow should exist and regularly provide the forecast for today and tomorrow. You need to configure this component for your personal PV setup. The predictions are great! For private users HA Solcast PV Solar Forecast is free of charge.

Entities

AIO-EMS creates these entities:

Entity Description
select.aio_ems_ev_charge_mode Select EV charging strategy: manual, fast, pv_only, eco.
select.aio_ems_battery_mode Select battery strategy: standard, economic, grid_support.
number.aio_ems_ev_target_soc Target SOC for immediate / PV-only charging modes (%).
number.aio_ems_ev_target_next_morning_soc Target SOC that must be reached by the next morning when in ECO mode (%).
time.aio_ems_ev_target_next_morning_tod ECO: latest time-of-day by which the next-morning target SOC must be reached (HH:MM, local time).

Dashboard Setup

Use an editor and copy the cards from custom_components/aio_ems/dashboard.yaml. Paste the cards into a dashboard of your choice. Only the Control Panel is essential. The flow, charts, and debug panels are optional.

Notes

  • The Energy Flow card requires the power-flow-card-plus custom component
  • The forecast cards (Energy Price and PV Power) require the apexcharts-card custom component
    • Install via HACS: Search for "ApexCharts Card" by RDEvents
    • Or manually: https://github.com/RomRider/apexcharts-card
    • Important: If your dashboard is in YAML mode, add the resource to configuration.yaml:
      lovelace:
        resources:
          - url: /hacsfiles/apexcharts-card/apexcharts-card.js
            type: module
      Then restart Home Assistant.
  • All power sensors should be in watts (W)
  • Positive values indicate power consumption
  • Negative values indicate power generation

EV Charge Modes

For EV charging you can select between these charge modes:

manual

EV charging is not touched. You can control charging with your vehicle or wallbox app.

fast

Charging starts immediately at full power - until the target SOC is reached

pv_only

Only surplus from the PV panels is used to charge the EV. All other home electricity consumers are ranked higher than the EV. At no time energy from the grid is used to charge your EV. The charge rate is regularly (every 30 seconds) adjusted - depending on the available surplus. Charging might pause for a long time if no surplus is available and start automatically again later.

eco

EV charging will use the grid energy price forecast to find the lowest cost to charge the EV overnight. Latest by aio_ems_ev_target_next_morning_tod tomorrow the vehicle will be charged to at least aio_ems_ev_target_next_morning_soc. In addition, any available PV surplus will be used - as described in pv_only. If you need your EV on a regular basis, you can use this as standard mode. It finds the overall lowest cost charging to make sure that you have the needed EV SOC tomorrow morning.

Contributions are welcome!

I'd love to know what additional capabilities you would like to have. Please open a GitHub issue for feature requests or ideas. If you want to contribute to this please read the Contribution Guidelines.

Credits

This project was generated from Home Assistant Custom Component Cookiecutter template. Code template was mainly taken from @Ludeeus's integration_blueprint template


About

All-in-One Energy Management System for Home Assistant - Optimize EV charging using PV surplus and energy price forecasts.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published