EV Charger current control based solar panel production, home battery state and home consumption

I want an automation to dynamically change the charger current of my EV based on Solar Panel production, home battery state and home consumption. Hopefully someone can give an idea how to create this.

My solar panel system is limited to 5 kW.

My idea is to give priority to my home battery to charge from the solar system. Once the battery is full, my car may start to charge but ideal it should only use the solar panel consumption and not from the grid.

All entities and services are in Home Assistant but I don’t know how to make the automation.

Home Battery State / 0 till 100 %: sensor.battery_state_of_capacity
Solar Power Production / 0 till 5000 W: sensor.inverter_input_power
Home consumption: sensor.pv_home_usage
Service to set max charge of car: Easee EV Charger: Set charger max limit 0 till 32 A (0 till 7000 Watt)

My inverter is limited to 5000 W so if the total consumption is 6000 Watts and my Home Battery is full, it will take 1000 W from the grid. Also something I’d like to avoid.


Here’s a script for a tesla charger pulling data from a Neurio with direct access to the car’s commands. You might be able to extract some ideas from it. Runs in Bash.

I made it myself - plan is to package it up at some time but at the moment all is done with several Helpers and automation scripts. Happy to share them with you but it will be some work to get it going.

Thanks but I don’t have a Tesla. I drive with a VW ID4.

Would be very helpfull if you can share ‘your project’. I’ve posted also on Facebook and some guys came up with integrations that will do this job but they don’t support HA entities so that means I have to do difficult things with serial connections and/or IP related data. I’m not a specialist in that so I prefer to use the HA entities

I know. I wrote that script for my personal needs. You might be able to tailor it for your use when you figure out how to interface with your car.

I use node red for my house battery and ev charging, I just use the granny charger as I can switch it on and off with a smart plug and it only draws 2.3kw max, so during the day once my house battery is charged if I turn the EV charger on it will charge until the house battery drops to 93% as my inverter won’t start charging the house battery again after it has hit 100% until it goes below 94%. I have an auto charge at night setting as I get cheap night power, but aim to create a day charge function so it will look after itself but at the moment it’s manual.

You can find the automations i am using in the git repo here: GitHub - gsaurer/ha-ems: Energy managemnt system for Home Assistant keep in mind that you need several helpers to get those scripts going. I will try to package it up more cleanly in the next couple of weeks.

The automations are triggered based on power sensors, battery sensors and are directly telling the ev charging station (in my case go-e) with how much Amps it should charge.

Let me know if you have any questions.

i have the same Inverter 5k and after 5000W it uses Grid, so i added 2,2Kwp more on the roof and used a grid tied inverter on the generator/microinverter port. the power from that wort is AC and so it is added on Top of the 5000W. Works perfect for me since 2 month.
For setting the EV charge Amps i plan to write an automation next few weeks.
Have a Feyre (Tuya) charger and an Renault Twingo.