Load balancing current to EV-charger

Thanks for the script. I am new to hass, and tried to find a way to load balancing e-go charger. I have adapted scripts for 3 phases, e-go charger and shelly 3em power meter. I have set my shelly 3em to update measurementes every 2 seconds, so charging ramps down from 16A to 6A in 20 seconds. If ramp down seems to be too slow i may just drop charging current to 6A, and let it ramp up again from there.

This has been working for couple of days, so i leave it here, hope it helps.
For this to work hass needs to have homeassistant-goecharger-mqtt

For decreasing charging current:

- id: '1648324411434'
  alias: Decrease_ev_charge_amps
  description: Decrease EV charger amps to avoid overcurrent
  trigger:
  - platform: state
    entity_id: sensor.shelly_3em_mainpwr_current_0
  - platform: state
    entity_id: sensor.shelly_3em_mainpwr_current_1
  - platform: state
    entity_id: sensor.shelly_3em_mainpwr_current_2
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: sensor.go_echarger_<Go-Charger serial>_car
      state: Charging
    - condition: device
      type: is_current
      device_id: 0472bf0cfb8b1bb51b1ba67ff7b5205d
      entity_id: number.go_echarger_<Go-Charger serial>_amp
      domain: sensor
      above: 7
    - condition: or
      conditions:
      - type: is_current
        condition: device
        device_id: cbb84a832bca9a53d3670601a8094f28
        entity_id: sensor.shelly_3em_mainpwr_current_0
        domain: sensor
        above: 22
      - type: is_current
        condition: device
        device_id: cbb84a832bca9a53d3670601a8094f28
        entity_id: sensor.shelly_3em_mainpwr_current_1
        domain: sensor
        above: 22
      - type: is_current
        condition: device
        device_id: cbb84a832bca9a53d3670601a8094f28
        entity_id: sensor.shelly_3em_mainpwr_current_2
        domain: sensor
        above: 22
  action:
  - service: goecharger_mqtt.set_config_key
    data:
      serial_number: <Go-Charger serial>
      key: amp
      value: '{{ (states.number.go_echarger_<Go-Charger serial>_amp.state |float|round(0) - 1)}}'
  mode: single
  max: 3

For increasing charging current:

- id: '1648389547513'
  alias: Increase_ev_charge_amps
  description: Increase EV charger amps
  trigger:
  - platform: state
    entity_id: sensor.shelly_3em_mainpwr_current_0
  - platform: state
    entity_id: sensor.shelly_3em_mainpwr_current_1
  - platform: state
    entity_id: sensor.shelly_3em_mainpwr_current_2
  condition:
  - condition: and
    conditions:
    - condition: state
      entity_id: sensor.go_echarger_<Go-Charger serial>_car
      state: Charging
    - condition: device
      type: is_current
      device_id: 0472bf0cfb8b1bb51b1ba67ff7b5205d
      entity_id: number.go_echarger_<Go-Charger serial>_amp
      domain: sensor
      below: 16
    - type: is_current
      condition: device
      device_id: cbb84a832bca9a53d3670601a8094f28
      entity_id: sensor.shelly_3em_mainpwr_current_0
      domain: sensor
      below: 19
    - type: is_current
      condition: device
      device_id: cbb84a832bca9a53d3670601a8094f28
      entity_id: sensor.shelly_3em_mainpwr_current_1
      domain: sensor
      below: 19
    - type: is_current
      condition: device
      device_id: cbb84a832bca9a53d3670601a8094f28
      entity_id: sensor.shelly_3em_mainpwr_current_2
      domain: sensor
      below: 19
  action:
  - service: goecharger_mqtt.set_config_key
    data:
      serial_number: <Go-Charger serial>
      key: amp
      value: '{{ (states.number.go_echarger_<Go-Charger serial>_amp.state |float|round(0) + 1)}}'
  mode: single
  max: 3
6 Likes