Dynamic EV Charging Automation for Home Assistant
This project automates the charging current of an electric vehicle based on household power consumption.
It works with any EV (Tesla, Mercedes, Ford, BYD, etc.) or any EV charger as long as it is integrated and can be controlled within Home Assistant.
This blueprint dynamically adjusts the charging rate, ensuring that the vehicle uses the maximum available power without exceeding the contracted limit.
It also supports different power limits for day and night to optimize charging based on electricity tariffs.
If you found this project helpful, please consider buying me a coffee!
Versions
Version 1.1 - Adjustments are made in 1A increments every 8 seconds to avoid charger errors.
Installation
This blueprint can be installed in two ways:
Direct Import via Home Assistant
Manual Installation
- Open the blueprint file in this repository:
https://github.com/EDV11/electric-vehicle-ev-dynamic-charging-home-assistant-/blob/55aff6f887136b29e311d646cfaea37b93042f07/Dynamic-EV-Charging-Automation.yaml - Copy the URL from your browser’s address bar.
- In Home Assistant, go to Settings → Automations & Scenes → Blueprints.
- Click “Import Blueprint” in the bottom right corner.
- Paste the URL and click “Preview Blueprint”.
- Click “Import Blueprint” to finalize.
Tested Hardware
This is some of the hardware I’ve used and tested with this automation:
- Shelly EM Energy Meter
- Tesla car with Tesla Fleet integration.
- Feyree Type 2 portable 7kW charger
- Feyree Type 2 Wallbox
Just to be clear, if you can control your car from Home Assistant and have access to its sensors, you can use this automation without a connected charger.
Requirements
Before using this blueprint, you need the following:
- Total Power Consumption Sensor
(e.g., Shelly EM Gen3 is recommended if you don’t have one; you can get it from that link). - Your EV or Charger integrated into Home Assistant, exposing the necessary sensors.
(For example, Feyree portable charger.) - Basic information about your electricity contract, including:
- Grid voltage (e.g., 230V for EU, 120V for the US).
- Maximum grid power limits (contracted power).
- Day and night tariff periods (if applicable).
Configuration
The following parameters need to be configured:
- Charging interval (1, 3, or 5 minutes).
- A device tracker (preferably the car) to ensure that the automation runs only when the EV is at home.
- A charging status sensor to ensure changes are only made when the EV is actively charging.
- Total power consumption sensor (measured in watts).
- Maximum Grid Power (Day) – Set to 0 if you only want to charge at night.
- Maximum Grid Power (Night).
- Charging current control entity – The EV or charger must support dynamic amperage control.
- Grid voltage.
- Maximum charging amperage – The system will never exceed this limit, even if extra power is available.
- Minimum charging amperage – The system will stop charging if power availability drops below this threshold.
- Day-time period settings (Define when “day” mode applies, typically when electricity is more expensive or power is limited).
How It Works
The automation runs every 1, 3, or 5 minutes, depending on the selected interval.
It only adjusts the charging rate if the EV is charging and at home.
Dynamic Load Adjustment
The automation continuously monitors household power usage and dynamically adjusts the charging current to avoid exceeding the contracted power limit.
If a high-power appliance (e.g., oven, stove, heating) is turned on, the charging rate will automatically decrease to prevent overloading.
Once power consumption drops, the EV will resume charging at the maximum allowed rate.
Day & Night Power Limits
Many electricity contracts offer cheaper power at night, along with higher power limits.
This blueprint allows setting different power limits for day and night, ensuring that charging is optimized based on your tariff structure.
Reporting Issues & Community Discussion
If you encounter issues or have suggestions for improvements, please post them below