How to control charging a car with excess solar power

Hi all,

I need some ideas on how to best control the charging of my car. I can only charge my car with a maximum of 2,200W via a socket. I need a kind of automation that turns on the socket when the power flowing into the public grid is greater than 2,200W for a time ‘t’. I can query the excess energy from the inverter, but how do you build a trigger from it? The whole thing would have to work according to the principle of a thermostat.

Any ideas?

Use a numeric state trigger.

trigger: numeric_state
entity_id:
  - sensor.inverter_entity
above: 2200
for:
  hours: x
  minutes: x
  seconds: x

Try this

https://community.home-assistant.io/t/pv-solar-excess-optimizer-auto-control-appliances-wallbox-dish-washer-heatpump-based-on-excess-solar-power/552677

1 Like

Hi,

thanks, the trigger will be performed, if we are above 2200. But will it also be performed if it is below 2200 in order to switch off again?

I tried it with a binary_sensor and it seems to work:

binary_sensor:
  - name: "Car charging ready"
    unique_id: 'charge_car'
    device_class: power
    state: >
      {{ (states('sensor.solaredge_m1_ac_power') > '2300') }}
alias: UI_Charge_Cupra
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.car_charging_ready
conditions: []
actions:
  - if:
      - condition: state
        entity_id: binary_sensor.car_charging_ready
        state: "on"
    then:
      - action: switch.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: switch.kg_ev_k07_steckdose_stellplatz
    else:
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.kg_ev_k07_steckdose_stellplatz
mode: single

The link I provided is for a finer control. If your excess hovers around the 2300 mark you will be turning the power on and off quite rapidly which may not be good for your vehicles onboard charger. You don’t want small clouds etc. to damage your car!

Take a look at the option I gave.

maybe I missed something, but I do not understand how the “magic” in the background is working. Is there a more detailled documentation of it? How is on/off calculated?

My 230V Car-Charger does not only switch on/off the power, it is doing it very smoothly within a few seconds. So I think, it is not too problematic for the car

I also have to modify my solution because it only based on the excess. But then charging will be switched off, if the excess is less then 2k3. But charging should only stop it the production of the energy is less than the current consumption. For that I have to do it in this way, I guess:

  • criteria for charging on: (consumption + 2k3) < (production) for a timeframe of e.g. 5min
  • criteria for charging off: (consumprion) > (production)

in order not to switch on/off too many times, I am thinking about a kind of grace period which can be covered by the battery if the battery is at least more than 30% of charge…but I do not have a clue at the moment how to implement this into the critera.

It’s a long thread I know, but I can tell you it does work well. I also use it to run my immersion - been using it for 2 years with no issues. It does the things you require.

Battery is covered in this solution as well.

I’m sure you can ask in thread how the ‘magic’ works :slight_smile:

@Neil_Brownlee,

Convinced! I’ll work my way through it this evening and let you know!
Thx.

1 Like

I saw that pyscript via hacks is necessary and I am using the official python_script for other apps. I guess this can cause issues, if two different pythen scripting apps are running in parallel!

I’ve had no issues - it’s worth an ask on the thread if anyone else has.