Automation to dynamically adjust Tesla charge rate based on home power usage

Just wanted to share this automation and get some feedback, I’m considering making it a blueprint for others to use.
The purpose of the automation is to try and prevent overloading the power supply to the house when the Tesla is charging. Because the Tesla charging is a normally a very high static load, there can be situations other many dynamic loads come on at the same time exceeding the power supply to the house.
Some smart car chargers do this using a power clamp on the house power supply but this automation provides similar functionality using a dumb charger.

How it works.
Tries to set charge rate to an optimal value above the target W and below max
Checks every 30 seconds to find the optimum charging value based on home power usage W
Only adjusts if the car is home, currently charging, and below the target or above the maximum
Decreases significantly when above the home maximum W and increases by 1 amp if below the home target W

Create two numbers helpers

  • Home Max Power Usage
  • Home Target Power Usage

Set the Max Power Usage value to 10000
Set the Target Power Usage value to 8000
Setup a Shelly EM on the main power supply
Setup Tesla integration


alias: Tesla Dynamic Charge Rate
description: >-
  Checks every 30 seconds to find the optimum charging value based on home power
  usage W

  Only adjusts if car is home, currently charging and below the target or above
  the maximum

  Decreases significantly when above the home maximum W and increases by 1 amp
  if below the home target W
  - platform: time_pattern
    seconds: "30"
  - condition: state
    entity_id: binary_sensor.tesla_charging
    state: "on"
    enabled: false
  - condition: state
    entity_id: device_tracker.tesla_location_tracker
    state: home
  - if:
      - condition: numeric_state
        entity_id: sensor.main_power_meter_power
        above: input_number.home_max_power_usage
      - device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        domain: number
        entity_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        type: set_value
        value: 5
        alias: Reduce Tesla charging rate to 5 amps
      - condition: numeric_state
        entity_id: sensor.main_power_meter_power
        below: input_number.home_target_power_usage
      - condition: not
          - condition: state
            entity_id: number.tesla_charging_amps
            state: "16"
        alias: Test charge rate is not already at the 16 amp maximum
      - service: number.set_value
          entity_id: number.tesla_charging_amps
          value: "{{ states('number.tesla_charging_amps') | int + 1 }}"
        alias: Increase charging rate by 1 amp
    alias: Adjust Tesla charging amp based on Home Power Max and Target values
mode: single


Whats the overloading scenario you are trying to avoid? The main breaker flipping? Then 30 seconds might be too long of a check rhythm. Our water cooker switches from 0 to 2500 W within a few seconds. Add a hairdryer, und you’re up 5000W on second 3 of your 30 second check cycle.
Did you consider a more proactive approach? Monitoring the biggest consumers continously, and triggering your charger adjustment once they go over a certain limit?

1 Like

Nice idea.

Have you simulated your overload scenario to see if it works as expected?

Why not move the numeric state condition to the trigger? It might still not be fast enough, depending on how long an overload is allowed to last for and depending on how severe the overload is. The 30s polling seems like an unnecessary overhead when you can just react when needed.

That said, a breaker will not typically trip at it’s rated load, but at a higher load over some sustained period.

This is an interesting read.

Lastly, try to get rid of using device IDs, as far as possible.

1 Like

The smart thing of course is to buy a wallbox that has dynamic load balancing built in. That is because Home Assistant does a lot of things and has a relatively high risk of being down. In that case the balancing stops in an unsafe situation, while safe engineering should always be that the situation is safe on faillure. The added cost hugely outweighs the risk, and if you can afford to own a Tesla…

If you insist on having HA do it, you need to know the total power draw on each phase that the charger is connected to.

I agree a hardware option would be best, but remember there’s no real safety risk in this case, since the breakers will do their job and trip the power as needed.

Have you read the above circuit braker myths? you posted them yourself. They are no catch all solution.

Yes, and I’m a qualified electrical and electronic engineer with a master’s degree. Have you read my answer? As long as one stays withing the ratings you generally would be fine. I already pointed out some risks too. At the end there will always be some point of failure. Houses have been fine dealing with overload situations using breakers for decades (when correctly installed, the right wire gauges are used, etc. etc.).

Sorry, I was not trying to be disrespectful, but reading it back I see I did come across that way. But you also must know circuit breakers are not perfect, and installation errors do occur. For all we know some people with ancient installations are using the above advise to buy and self install a €250, 22kW wallbox bought in a supermarket (I kid you not, I saw one advertised on my vacation).

A question: I own a different brand car, but in my case changing a car parameter may take a while because the car is online only periodically, even when connected to the charger and on home wifi. Did you check how long a Tesla takes to respond to changing the maximum charging rate? Also, my car is cloud connected, and the servers are notorious for outages in busy periods. Maybe Tesla is super reliable, but I would not trust my car integration enough.

All good!

I totaal agree with you. We bought a 40-year old house and I had to struggle for 3 years with the help of a lawyer to get the wiring up to standard, because an invalid compliance certificate was issued, giving me a false sense of safety. Shortcuts get taken all the time. I was lucky to understand and spot some of the issues, plus 200% perseverance to get it fixed (I’m not a qualified electrician though).

I always urge people, especially when they admit that something isn’t their strong suit to get installations done properly. Get it signed off. Buy good equipment.

Yeah, the goal is avoiding the main circuit breaker tripping.
So mains power theoretical max is 14400W so this automation is intended to make sure there is headroom for when dynamic loads like that to kick in.
I might set the max to 9000 and target to 7000 to allow for more headroom.
Good point on additional triggers, I could trigger on the main power exceeding max and another couple of energy monitors in the kitchen and laundry could provide triggers at other values.

Yeah I have reduced the max value and the automation operates correctly.
The 30-second trigger is needed to gradually increase the amps up to above the target value, but the numeric could also be a trigger for max yeah. Doing this I could decrease the timed trigger to 5 minutes or longer as it would only be for increasing the amps.
Thanks for the info on breakers, really interesting. This automation was more of a helper to keep well below the breaker maximums. i.e. max is 60A and this would kick in at say 40A. So yeah I guess instead of avoiding tripping the breakers, this will just reduce stress and wear and them and the wiring.

1 Like

Regarding updating the car parameters, from what I can tell while the car is charging that it’s pretty much constantly online so changes are very quick. I assume this because the car systems need to be online to manage the charging process. Other times though I have seen the same, those systems are offline while the car is in deep sleep and you need to wait for it to wake up and poll to push parameters to it.
Be interesting to know if that’s the case with other brand cars.

1 Like

I was hoping my Skoda would do the same, there’s not much need to save wifi power when you’re pulling multiple kW from mains, but alas, no. I guess they are protecting server load as well.

For those with a connected wallbox it may be a better alternative to limit charing current that way. Because if you have family over and you let them charge, your automation would not protect you.

Yeah, this automation could work with a charger that is natively supported in HA or supports OCPP integrated with HA or Charge HQ for example. Doesn’t need to be a Tesla.
Personally, I won’t get much benefit from using a smart charger with native load monitoring via a clamp, as the car charges in a separate building from where the main power meter is and we are on single-phase power. I’m waiting for the smart charging tech. to get better - support remote clamps etc.

1 Like

The first version of this blueprint is here for anyone interested in trying it out. Have yet to write it up and publish it in the blueprint exchange.
Be good to get some initial feedback from anyone with a Tesla and a power meter at home.

Tesla controlled charge rate based on power sensor - Blueprints Exchange - Home Assistant Community (

Tesla controlled charge rate based on power sensor (

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

This is exactly what I was looking for.
I opted for a Tesla Wall Connector, to charge my Model Y.
I didn’t like the sole option of Shelly EM to turn on/off the charging, I wanted something to adjust dynamically.
My question is, how does the car receive this information? Is it by Internet? It’s parked underground on a -2 floor. Should I get a router to give Wi-Fi to the car?

There is no known way to make the Wall Connector dynamically limit the charge power, right?


Great, be good to get some feedback if you are able to try it out.
The blueprint is now on the blueprint exchange with more details about how it works.

Yes, the car receives the changes via the internet, I know that while the car is charging it’s pretty much constantly online so rate changes are very quick (seconds) when it has Wi-Fi connectivity. In theory, if there is no wifi it would fall back to the Tesla Standard Connectivity (i.e. built-in cellphone network/3G), but I’m not sure if that system sleeps or how much delay that would add.

Haven’t got a Tesla Wall Connector integrated with HA, so I’m not sure if there is any option to change the charge rate. Looking at the integration page it seems maybe not.