šŸš— Tesla Dynamic Charging (Ford, Mercedes… any EV) Automation

I tested it with the Tesla API back in the day, but I changed it to control the charger because of this reason. I didn’t want to depend on changes to the API (like they happened) and I wanted it to be universal (what if I was charging a different car, and not a Tesla?).

That’s why I recommend to go the charger way. If you can control it through Home Assistant, you are future proof.

Ok, checking this right now, it’s an issue

I’ve been working on an update. I’ve modified the logic, stopped the charging when below threshold and making it more robust in general.

I’ll give it a test and will post the update to the github soon.

1 Like

:red_car::zap: Dynamic EV Charging Automation Blueprint v2.0 - Major Update Released!

I’m excited to announce version 2.0 of my Dynamic EV Charging Automation blueprint with significant improvements and new features that make it more reliable and robust than ever!

:new: What’s New in v2.0

:star: Smart Start/Stop Control

The biggest addition is automatic charger control. Instead of trying to set charging current to 0A (which many chargers can’t handle), the automation now:

  • Stops charging when available power drops below minimum threshold
  • Restarts charging when sufficient power becomes available again
  • Prevents charger errors caused by invalid amperage values

:wrench: Fixed Power Calculation Logic

Resolved a critical issue in the power calculation formula that could cause:

  • :x: Incorrect available power calculations
  • :x: Oscillating start/stop behavior
  • :x: Charging stopping when it should continue

The new logic correctly calculates actual available power for the charger.

:shield: Enhanced Stability

  • Gradual amperage adjustment prevents rapid changes that cause charger errors
  • Improved oscillation prevention through better state management
  • More reliable operation during power fluctuations

:wrench: Installation & Upgrade Instructions

:clipboard: New Users:

Import Blueprint

:arrows_counterclockwise: Existing Users - IMPORTANT:

You MUST recreate your automation as new configuration options have been added:

  1. Import the updated blueprint using the button above
  2. Delete your existing automation (or disable it)
  3. Create a new automation with the updated blueprint
  4. Configure the new required entity (see below)

:gear: New Required Configuration

:electric_plug: EV Charging Toggle (Start/Stop)

New required input: You must select a select entity that controls your charger’s start/stop state.

Supported options should include:

  • "Start charging"
  • "Stop charging"
  • "Waiting for command"

Examples of compatible entities:

  • select.ev_charger_toggle_charging
  • select.wallbox_charging_state
  • select.charger_control

How to find yours:

  1. Go to Developer Tools → States
  2. Search for entities with domain select related to your charger
  3. Look for one with charging control options

:dart: How It Works Now

Intelligent Power Management:

  1. Monitors total household power consumption every 1-3 minutes
  2. Calculates available power for EV charging
  3. Adjusts charging current gradually (1A steps with delays)
  4. Stops charging when insufficient power (instead of setting 0A)
  5. Restarts automatically when power becomes available

Dual Time Period Support:

  • Day mode: Lower power limit (e.g., 4.7kW)
  • Night mode: Higher power limit (e.g., 6.2kW)
  • Configurable days and hours for each mode

Safety Features:

  • Maximum/minimum amperage limits
  • Gradual adjustments to prevent charger errors
  • Only operates when car is home and plugged in
  • Respects charger capabilities

:bar_chart: Example Scenarios

Scenario 1: High House Consumption

  • House using 4.5kW, charger using 3kW
  • Available power drops below minimum
  • Action: Stops charging until house consumption decreases

Scenario 2: Low House Consumption

  • House using 1.5kW, plenty of power available
  • Action: Starts/continues charging at maximum safe rate

Scenario 3: Power Fluctuation

  • Appliances turn on/off throughout the day
  • Action: Gradually adjusts charging rate in 1A increments

:mag: Compatibility

Works with any EV charger that has:

  • :white_check_mark: Amperage control via Home Assistant (number entity)
  • :white_check_mark: Start/stop control via Home Assistant (select entity)
  • :white_check_mark: Charging state sensor (sensor entity)

:bug: Bug Fixes

  • Fixed power calculation causing incorrect stop/start decisions
  • Resolved oscillation issues during marginal power conditions
  • Improved handling of edge cases when charger consumption varies
  • Better error handling for invalid amperage values

:bulb: Tips for Best Results

  1. Set realistic min/max amperage based on your electrical system
  2. Monitor for the first few days to ensure stable operation
  3. Adjust time periods to match your electricity tariff
  4. Use shorter intervals (1 min) for faster response to power changes

:pray: Feedback & Support

This blueprint has been tested extensively, but every setup is different. Please:

  • :star: Star the repository if you find it useful
  • :bug: Report issues via forum
  • :speech_balloon: Share your experience in the comments
  • :arrows_counterclockwise: Suggest improvements for future versions

Repository: GitHub - EDV11/electric-vehicle-ev-dynamic-charging-home-assistant-

Happy charging! :red_car::zap:

1 Like

I’m using both an Easee charger and a Tesla. But neither have a select sensor for charging. Have got tons of other sensors, but the blueprint requires select.

Would your advice be to just create a helper for this? Or are there other possibilities?

With Tesla Fleet integration you have a charging switch, you may try that option. Before making any modifications just try and start charging the car and enable and disable the switch to see how it behaves and if the charger resumes.

If it does work fine, you would have to do some changes to the blueprint

  1. Search and replace in charger_toggle
    Old
charger_toggle:
  name: EV Charging Toggle (Start/Stop)
  selector:
    entity:
      domain: select

New

charger_toggle:
  name: EV Charging Switch (On/Off)
  selector:
    entity:
      domain: switch

2 Search and replace in Service Call
Old

- service: select.select_option
  target:
    entity_id: !input charger_toggle
  data:
    option: |-
      {% if actual_free_power / voltage >= min_amps %}
        Start charging
      {% else %}
        Stop charging
      {% endif %}

New

- choose:
    - conditions:
        - condition: template
          value_template: "{{ actual_free_power / voltage >= min_amps }}"
      sequence:
        - service: switch.turn_on
          target:
            entity_id: !input charger_toggle
    - conditions:
        - condition: template
          value_template: "{{ actual_free_power / voltage < min_amps }}"
      sequence:
        - service: switch.turn_off
          target:
            entity_id: !input charger_toggle

Try that and see if the car can replace that feature of the charger.

1 Like

One question, is it possible to analyze each of the phases, because in my case I can spend a maximum of 18 amps per phase, which means that depending on the type of consumption I have at home I can have, for example, one phase spending 8 amps and the other 2 1 amp if I am charging at 16 amps per phase the electrical panel will trip

I guess it would be possible if you add one Shelly per phase.

my wall box see amp per phase and i have a shelly 3em