Tesla controlled charge rate based on power sensor

I can confirm that in my setup I need to put in the kW’s
Via the Developers tools I manually increased the “Power Consumed = 15” to trigger the bp > with success!

When I increased the main power (sensor 1), the bp dropped the charging rate of my Tesla. Then when I changed it back, it started ramping up the Tesla again. So the bp and Tesla integration works.

My problem now is that the power entities in HA is not being updated quick enough. It took HA 44 minutes to see the increase in power usage. Obviously way too long so I’m afraid I need to park this plan. I guess I hoped that this bp would trigger an update by HA more quickly…

Thanks, I’ve updated the BP to clarify the units need to match the units used in the sensor (W or kW).

What type of power sensor are you using, I am using Shelly EM which has a CoIoT or MQTT feature so they push updates to Home Assistant very quickly.

I’m using Aqara power plugs for the washer, dryer etc. Those can measure up to
10A and similar to the Shelly I guess. The oven uses more than the 10A and like the cars + heatpump, they’ll use all 3 phases and I don’t have a dedicated entity to measure their power. So I use the DSMR and reading the P1 port using this thingy of Marcel Zuidwijk

It’s been doing it task of monitoring general energy consumption for a while. I’ll need to check if meanwhile there are better, quicker and more reliable ways to read the DSMR…


I made a fork to be able to use it on a 3-phase system.

I didn’t test it yet, as my car is already fully charged right now.

I have a Tesla wall connector gen 3, so this is the only way to do some load balancing.

I don’t understand the difference between the max and upper value. I want to charge with max 2300W and have 400W for other loads. I set max charge current to 10A and both max and upper to 2700W. Will this achieve what I want?

If I set the minimum charge to 4A, will the Tesla stop charging when no room for its minimum 5A charging? If changing minimum charge to lower like 1A, will the only difference be that it takes longer for it to ramp up charging current?

Would it be possible to combine this with some schedule so it only charge at certain times?

I expected that it was like:
The max limit is a trigger to set the charging speed to the minimum immediately.
The upper limit is a trigger to lower the charging speed gradually down.

But you are right, they do the same thing.

The upper and max do the same thing, both trigger a reset in the charging amps. The max is just an additional checkpoint in the case for some reason the upper was missed. Maybe in the future max could stop the charging and generate a fault or something, max should never really get hit.
Assuming your on 240V, I would set the upper to 2300W max to 2700W, and the lower value to something like 2000W.
The blueprint won’t ever stop the charging. The only control the blueprint has is to reduce the charging amps, so giving a low minimum charging amps value allows it to do that.
Yes the main downside with 1A minimum is the speed at which it increases the charging rate after hitting the limit.

This blueprint only runs when the car is charging, so starting the charging with another automation or the car’s own schedule works fine with it.

Great thank you.
I’ve been looking for a way to have the sensors be optional/ignored if empty in the BP, that would allow the same BP to be able to be used for both.
How did your testing go?

I understand that the blueprint doesn’t stop charging, but just regulate the charging current. But does the Tesla still charge when the charging current is set to 1-4A? I thought it would stop charging if the available current is less than 5A?

About the blueprint only running when the car is charging, I think there is some glitch somewhere, that makes it run sometimes anyhow, maybe once everytime it is started? Because I haven’t had the car plugged in yet, but the blueprint has regulated the current down to 5A and if I restart the blueprint it regulate it up 1A every time (if enough time passed).

It should do, it does for me. I know you can’t change it to below 5A via the Tesla app but via the API it can be set lower. Try setting it to lower than 5A via the HA integration to confirm.

Regarding it changing rates when the car isn’t charging. Check the traces in the automation, the very first condition that is checked is that the car must be charging so maybe HA is thinking the car is charging or something when it isn’t. Maybe check the state of the binary_sensor.tesla_charging?

The normal triggered events seem to workfine, they stop on the charging test. But when you start the blueprint it is running through once, even I haven’t the Tesla charging.

That’s expected, When you manually run any automation it will skip the triggers and conditions. It only runs the actions section of the automation.

Ok, that explains it. I guess if the charging test was done under the action instead of condition, it would never run when not charging. But it doesn’t matter.

Do you know if the car stops charging if setting the amps to 0 or is it an invalid value? Would it be possible to jump from 5 to 0 amps and from 0 to 5 when ramping up? I don’t want to charge with lower amps than 5.

I hadn’t actually tried 0A charging, it is a valid value and testing it just now it does seem to reduce the charging load to 0W. While still keeping the car in charging state.
I might make a change to the BP so that if max is hit, it drops down to 0A.

Why dont you want to charge below 5A?

Not tested yet. Working from home too much…
Its an Tesla with LFP, so shouldn’t be too bad to stay at 100% :slight_smile:

Look at this blueprint, it has optional values:

Another nice addition would be to check the contactor state of the Tesla Wall Connector. We have a public charger across the street. When I plug in there it shouldn’t loadbalance. Will try to add it as optional value in my forked blueprint when I finally can test this first version.

It is said that charging with low current is inefficient and that is why Teslas own user interface stop at 5A.

I think it’s better to have the car back off than stop and start charging repeatedly. That creates wear on the relays etc. Pretty sure I’ve seen posts about that prematurely causing problems with changing hardware.
The 5A in the UI make sense because you wouldn’t want to hard set to an inefficient value for a long charge session. With automation of the charging thats not relevant.
That inefficiency only exists temporary with automation and control via API. It can ramp back up again above the 5A value like this BP will do, when the other temporary loads are gone. For example if the BP polling is set to 1 min it will ramp back up in about 5 minutes.

Thanks I’m taking a look at that example now of optional entities.
Regarding the contactor state of the Wall Connector, I tried to avoid adding complexity and dependency on the actual external charger used by using the Home location as a bit of a master switch, but I guess that doesn’t work in your case because it’s so close to you. I’ll see if I can add an optional master switch (what is the entity type of the contactor in HA?)
As a work around you could have another simple automation that disables this BP when the contactor changes to open (and vice versa when closed) for now.

I’m finally able to test. The automation trigger itself works fine, but the Tesla API seems te be closed down since 1 Januari.
Seems you cannot control anything from home assistant anymore. Also I cannot enable/disable sentry mode etc. Seems that everything is read only now…

Until this part is sorted out, the whole automation is useless :frowning:

Well this is bad, as it is not yet possible to do load balancing on the Tesla Well Connector V3.

In case the API get fixed (I’m sure someone will figure this out very soon). The enitiy type of the wall connector is: binary_sensor.tesla_wall_connector_contactor_closed
It “On” while charging.
“On” when connected