Dynamic EV charging BMW Connect

Hello to the community! I would appreciate some help to check yaml code.

I am trying to use HA to create a dynamic charging automation for my BMW i4 using the BMW Connect integration.

I live in Belgium in Flemish region. Over here the final price of electricity is influenced by the peak electricity consumption. For this reason, I would like to keep my total drawn from the grid at max 2500 W.

I have an EV charger that I cannot control. My car charging can be controlled through BMW Connect. When no limit is applied, the car is using more than 7kW.

Using BMW Connect, I can limit the Amperes from 0 to 32. The automations below were intended to do the following (but ID 001 is not working):

ID 001
When the car is connected to the EV charger (binary_sensor.i4_m50_charging_status_2) AND the Override button is off (input_button.override_ev_charging)
Should change the A (sensor.i4_m50_ac_current_limit) to keep electricity from the grid bellow 2500W

ID 002
Should change the A limit to 32A when I disconnect from the charger

ID 003
Should Override ID 001 in case I need to get max charging speed

Any help really appreciated

This it the code from my automation.yaml

- id: '001'
  alias: Dynamic EV Charging Amperage
  description: Dynamically adjust EV charging amperage to keep total house consumption
    below 2500 watts
  triggers:
  - entity_id: sensor.dsmr_reading_electricity_currently_delivered_watt
    for: 00:01:00
    trigger: state
  conditions:
  - condition: state
    entity_id: binary_sensor.i4_m50_charging_status_2
    state: 'on'
  - condition: state
    entity_id: input_button.override_ev_charging
    state: 'off'
  actions:
  - variables:
      total_power: '{{ states(''sensor.dsmr_reading_electricity_currently_delivered_watt'')
        | float }}'
      max_allowed_power: 2500
      current_amperage: '{{ states(''sensor.i4_m50_ac_current_limit'') | float }}'
      voltage: 230
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ total_power > max_allowed_power }}'
      sequence:
      - target:
          entity_id: sensor.i4_m50_ac_current_limit
        data:
          value: '{% set excess_power = total_power - max_allowed_power %} {% set
            new_amperage = current_amperage - (excess_power / voltage) %} {{ [new_amperage,
            0] | max | round(1) }}  # Allow amperage to go down to 0A

            '
        action: number.set_value
    - conditions:
      - condition: template
        value_template: '{{ total_power < max_allowed_power }}'
      sequence:
      - target:
          entity_id: sensor.i4_m50_ac_current_limit
        data:
          value: '{% set available_power = max_allowed_power - total_power %} {% set
            new_amperage = current_amperage + (available_power / voltage) %} {{ [new_amperage,
            32] | min | round(1) }}  # Ensure amperage doesn''t exceed 32A

            '
        action: number.set_value
  mode: single
- id: '002'
  alias: Reset EV Charging Amperage on Unplug
  description: Set the charging limit to 32A when the EV is unplugged
  trigger:
  - platform: state
    entity_id: binary_sensor.i4_m50_charging_status_2
    from: 'on'
    to: 'off'
  action:
  - service: number.set_value
    target:
      entity_id: sensor.i4_m50_ac_current_limit
    data:
      value: 32
  mode: single
- id: '003'
  alias: Override EV Charging
  description: Set the charging limit to 32A when the override button is pressed
  trigger:
  - platform: state
    entity_id: input_boolean.override_ev_charging
    to: 'on'
  action:
  - service: number.set_value
    target:
      entity_id: number.your_bmw_charging_amperage
    data:
      value: 32
  mode: single
1 Like

Hello,
I also want to join the discussion. Unfortunately I cannot help, because I am also an absolute Home Assistant beginner. I also have an BMW (Model iX1) and I don’t have a Wallbox but only the BMW Flexible Fast Charger which has no ethernet / wifi connection. So the only way to start/stop and define the AC Limit of the charging process is possible via the MyBMW App.

But there is an Home Assistant integration for BMW Assist which makes it possible to start/stop the charging process and define the AC limit.

I have solar panels on my roof and I want to start the charging if there is an energy surplus in my house. Has anybody already implemented this?

@Drossi : I think there is a minimum of 6A to begin the charging Process… when I try to limit this I can step down from 32A to 6A but not below…

Any help would be appreciated…

Indeed. The min charging is 6A. Below 6A is off. I was not able yet to find the solution but keep trying…

1 Like

And if your BMW only supports 11kW the values over 16A also don’t have no impact to the charging process. So if you choose 16A or 32A for your 11kW car it won’t change the power input for your car and this is only relevant if your car supports 22kw AC.

Hi,

I don’t have a smart Wallbox but only the flexible charger. But with the BMW integration and automations you can build a process that charging starts / stops and the power increases / decreases depending on the solar power …

I have an X1 Hybride which I charge via the home charger. The charging is automated via HA.
HA will:

  • (Re) start charging the car when enough solar power
  • Stop charging the car when house asks to much power (to avoid peak extra price)
  • Restart charging (only in off-peak period)

Only manual action I need todo is to always connect the charger when I get home. Also HA does not take into account solar prediction and HA also does not know when car can charge during day when I am working from home, so I need to manually interven.

I only start/stop charging the car, I don’t change the Amperes.

Is there maybe someone that has knowledge with the NodeRed package node-red-contrib-car-bmw? I noticed that there is a function in this package that could controle the charging speed.

I have tried to implement this with my IX3, but I’m not able to get it working:

As shown above, I was doing some testing with changing the AcLimit (charging speed in Amps) and the charingTarget. An event is triggered without any error code, but nothing changes in the connected app nor the car itself…

Other function calls (open/close carr, sound horn, …) work like a charm :slight_smile:

Hi @Eld0h

I will soon get my new iX1 and I want dynamically charge it too. As far as I know currently BMW blocked integration with homeassistant. Does your automated charging still works, nowadays? For automatic charger do I need actually any data from BMW or all what I need is just smart wallbox charger? Which I can turn on or off via home assistant and no actual BMW integration is needed?

Thank you in advance!