Alfen Eve Pro EV chargepoint interface via TCP modbus

Yes ‘calculator’ isn’t installed by default. In node red just go to the upper right corner and click manage palette. In the install tab choose the Calc contrib.

I will share my code when I’m on pc.

2 Likes

Hi @Ace132 could you share your code please?

1 Like

If it might help anyone; I had a hard time connecting the “ethernet” cable to my network and connect to the charger. Finally, it turned out that the network cable with an RJ45 connector was meant for a load balancer (or digital meter) and it was connected to the RJ11 port inside the charger.
So make sure that the network cable is in the RJ45 connector (upper connector left above in the charger).

Next steps in my discovery: enabling load balancer and modbus. (Apparently I do not have the license for it now).

Hi @Ace132,

It would be great if you could share your development. I am very curious and think it will be useful for me as well. If you see a chance I would love to receive it!

Greeting,
Erikjan

Thanks. I am progressing in my setup.
Based on your example, I simply made 3 scripts to set the charger 8 A (which is max. 5,5 kW on 3 phases), 9 A (6,2 kW) and 10 A (6,9 kW) and I added 3 buttons in the lovelace to launch it.

However, there was a problem: the register 1206 (Actual Applied Max Current) was not changed when I increased the value in register 1210.
I found the problem: the max. charging speed of connector 1 was put at 8 A. So, even when I increased the value of register 1206 via modbus, it was not changed accordingly.
Then I set the max. charging speed at 10 A and the buttons to set charger at 8 A, 9 A and 10 A are working perfectly.

Via the ACE service software, I also changed the time that the value written via modus stays valid. By default this is only 60 secondes. I changed it to the max. 32.767 (about 9 hours). When you send a new Ampere value, it overwrites and the counter restarts from 32.767.

To make sure that the Ampere stays at the value I want, I will make an automation that runs every 6 hours and rewrites the current ampere again (and the counter starts over again; I tested this).

I hope this helps somebody. I am really glad I came across this post. Big thanks @hollie !

1 Like

Hi @bartland ,

Could you please share your 3 scripts?

thanks,
Jeroen

The scripts to set Alfen charger at 6, 7, 8, 9 and 10 Amp

set_charger_to_6_a:
  alias: "laadpaal - zet max. op 6 A"
  sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: laadpaal
      value: [0x40c0, 0x0000]

set_charger_to_7_a:
  alias: "laadpaal - zet max. op 7 A"
  sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: laadpaal
      value: [0x40e0, 0x0000]

set_charger_to_8_a:
  alias: "laadpaal - zet max. op 8 A"
  sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: laadpaal
      value: [0x4100, 0x0000]

set_charger_to_9_a:
  alias: "laadpaal - zet max. op 9 A"
  sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: laadpaal
      value: [0x4110, 0x0000]

set_charger_to_10_a:
  alias: "laadpaal - zet max. op 10 A"
  sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: laadpaal
      value: [0x4120, 0x0000]
2 Likes

You can use these scripts to set the charger to 1 phase or 3 phases via HA.
Note that you need to enable the option (only once) to change between 1 and 3 phases via the ACE Service Installer.

set_charger_to_1_phase:
  alias: "laadpaal - zet op 1 fase"
  sequence:
  - service: modbus.write_register
    data:
      address: 1215
      unit: 1
      hub: laadpaal
      value: 1

set_charger_to_3_phases:
  alias: "laadpaal - zet op 3 fases"
  sequence:
  - service: modbus.write_register
    data:
      address: 1215
      unit: 1
      hub: laadpaal
      value: 3

Here are some combinations of the Ampere and the 1 or 3 phases.
1 phase
6 A = 1,3 kW
7 A = 1,5 kW
8 A = 1,8 kW
9 A = 2,0 kW
10 A = 2,2 kW
11 A = 2,4 kW
12 A = 2,6 kW
13 A = 2,8 kW
14 A = 3,1 kW

3 phases
6 A = 4,1 kW
7 A = 4,8 kW
8 A = 5,5 kW
9 A = 6,2 kW
10 A = 6,9 kW
11 A = 7,6 kW
12 A = 8,5 kW
13 A = 9,2 kW
14 A = 9,9 kW

I think I will make a slider to select the W and then use this as a variable in a script to set the A and phases.
eg. if chosen W is between 1,3 and 3,1 then it’s only 1 phase and formula to define the A is
A = 6 + (W - 1.3) / 0.2
eg. if chosen W is between 4.1 and 9,9 W then 3 phases should be used and formula to define the A is
A = 6 + (W - 4.1) / 0.3

3 Likes

Here some additional useful stuff.

I have created some automations and scripts to set the Alfen charger to 1 or 3 phases and to different Ampere by selecting the Watt via a simple slider in a dashboard.

First, create 2 helpers:
input_number.car_charger_watt with values from 1 to 10 (this is in kW)
input_number.car_charger_ampere with values from 6 to 14 (below 6 A, the car will not charge, at more than 14 A my electricity circuit shuts off)

In your dashboard add the slider of the entity input_number.car_charger_watt

Now, based on the W you select, we need to define the A.

- alias:  Watt has changed to < 4 -> select 1 phase
  id: 'f27a3c48-775c-471f-bd6d-33d23c638826'
  description: ''
  trigger:
  - platform: state
    entity_id: input_number.car_charger_watt
  condition: []
  action:
  - condition: numeric_state
    entity_id: input_number.car_charger_watt
    below: 4
  - service: script.set_charger_to_1_phase
    data: {}
  mode: single

- alias: Watt has changed to > 4 -> select 3 phases
  id: '71d739ea-2973-4bfc-be0f-680846cd8e77'
  description: ''
  trigger:
  - platform: state
    entity_id: input_number.car_charger_watt
  condition: []
  action:
  - condition: numeric_state
    entity_id: input_number.car_charger_watt
    above: 4
  - service: script.set_charger_to_3_phases
    data: {}
  mode: single

The scripts that are called are:

set_charger_to_1_phase:
  alias: "laadpaal - zet op 1 fase"
  sequence:
  - service: modbus.write_register
    data:
      address: 1215
      unit: 1
      hub: laadpaal
      value: 1

set_charger_to_3_phases:
  alias: "laadpaal - zet op 3 fases"
  sequence:
  - service: modbus.write_register
    data:
      address: 1215
      unit: 1
      hub: laadpaal
      value: 3

Next step, we need to define the A based on the W we want to charge.
The following automation runs when the A is changed via the slider in the dashboard.

- alias: Wattage has changed = define Ampère
  id: 'fefe7ddf-8730-4d3e-af5c-0e6b18b9ede5'
  description: ''
  trigger:
  - platform: state
    entity_id: input_number.car_charger_watt
  condition: []
  action:
  - service: input_number.set_value
    target:
      entity_id: input_number.car_charger_ampere
    data:
      value: >-        
          {% set W = states('input_number.car_charger_watt') | float %}
          {% if 0.9 < W < 1.4 %} 6
          {% elif 1.4 < W < 1.7 %} 7
          {% elif 1.7 < W < 1.9 %} 8
          {% elif 1.9 < W < 2.1 %} 9
          {% elif 2.1 < W < 2.3 %} 10
          {% elif 2.3 < W < 2.5 %} 11
          {% elif 2.5 < W < 2.7 %} 12
          {% elif 2.7 < W < 2.9 %} 13
          {% elif 2.9 < W < 4.7 %} 6
          {% elif 4.7 < W < 5.4 %} 7
          {% elif 5.4 < W < 6.1 %} 8
          {% elif 6.1 < W < 6.8 %} 9
          {% elif 6.8 < W < 7.5 %} 10
          {% elif 7.5 < W < 8.4 %} 11
          {% elif 8.4 < W < 9.1 %} 12
          {% elif 9.1 < W < 9.8 %} 13
          {% endif %}
  mode: single

Now, we have defined the Ampere, but you cannot send that number to the charger like this. It needs to be converted. That is what the next automation does.

- alias: Ampere has changed = define the value to send to the register
  id: '9550cbe2-2979-4c7f-9974-ec7eaebc249e'
  description: ''
  trigger:
  - platform: state
    entity_id: input_number.car_charger_ampere
  condition: []
  action:
  - service: script.send_ampere_to_charger
    data:
      registervalue: '{{registervalue}}'
  variables:
    registervalue: >-        
      {% set A = states('input_number.car_charger_ampere') | float %}
      {% if A == 6 %}[0x40c0, 0x0000]
      {% elif A == 7 %}[0x40e0, 0x0000]
      {% elif A == 8 %}[0x4100, 0x0000]
      {% elif A == 9 %}[0x4110, 0x0000]
      {% elif A == 10 %}[0x4120, 0x0000]
      {% elif A == 11 %}[0x4130, 0x0000]
      {% elif A == 12 %}[0x4140, 0x0000]
      {% elif A == 13 %}[0x4160, 0x0000]
      {% endif %}
  mode: single

Now that the Ampere is formatted in the value that the charger understands, we need to send the value to the charger via the following script.

send_ampere_to_charger:
  alias: "laadpaal - send Ampère to charger register"
  sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: laadpaal
      value: "{{ registervalue }}"

Notes:

  • Carefully read above which code is for automations and which for scripts.
  • With these automations and scripts, you do not need the Perl script that Lieven mentioned earlier.
  • Because these automations and scripts are triggered by a change in the requested Watt, it will be easy (I hope) to implement an automation to charge with solar power only. Eg. measure how much kW is sent back to the grid and use this amount (or a bit less) to define the Watt for your car charger.

Hope this helps.

5 Likes

Hi All,

I’m trying to get this to work on my Alden charging station but I’m struggling with some errors when adding the scripts and automations.

When adding the automation that generates the registervalue I get this error:
Message malformed: expected dictionary

Anything I can do to resolve it? Would be so nice to have this as an (HACS) component and you would only need to fill in the IP-address of the charger and then select which entity measures the other consumers/production in the house for load balancing.

Let’s first start with getting this to work :wink:

Hello! What was the price for this license? I’m in the same boat.
I requested two days ago licence info, but no reply yet.

Hey @Macrisu

the license you need is ‘load balancing with smart meter’ and if I am not mistaken it costs around 200 euro (but that is from memory, so not 100% sure).

Best regards,
Lieven

I can verify that indeed P1 and Modbus are not operational at the same time.

Using the P1 feature made it pretty fail-safe, as it was decreasing power when your household is using more.

One of the things I wanted to have was some sort of dynamic charging as I have more than 20 solar-panels. At daytime, I want to make use of the sun, while at night I want to make use of the cheaper electricity I have.

I’ve been using most of the information mentioned in this thread with a few moderations:

  • I’ve got a input.value which holds how much A the system is allowed to draw from the electricity network
  • Using P1 changing values to do recalculations and write a new max A value (I didn’t want to set the timeout timer that long, as I do want the charging station to go to its safe current when I don’t receive values anymore)
  • Using P1 changes on T1 and T2 counters (both import and export) to set an input.boolean to define when my electricity is in night-time (and thus cheaper!)
  • When connecting my car in daytime AND the car can drive less than 100km, charging will be done at full speed anyway. (I came home this week with just 14km left. I want to be able to get to a hospital if needed. With the above settings coming home just after the sun went away, the car would not charge until the electricity got cheaper. That was one thing I wanted to avoid)

Things are not as neat as can be (just started using HomeAssistant), but I’m willing to send some examples where necessary.

1 Like

I created a weekplanner in which the target SOC is defined per day (just 7 helpers; eg. input_number.car_target_soc_day_1)
That is the MINIMUM SOC that should be reached at 6 AM that day.

eg.
Monday: 30% (work in the office)
Tuesday: 20% (work at home, so I want a minimum of 100 km range)
Wednesday: 30% (work in the office)
Thursday: 20% (holiday, stay home)
Friday: 60%
Saturday: 80%
Sunday: 80%

In the best case, the car is charged to that daily target with solar energy. If not, at night, it will charge from the net.
When plenty of sun is available, it charges more than the target.
It would be stupid to stop at eg. 20% on Thursday based on solar energy and then the next day, not being able to charge to 60% because not enough sun that day.

I also use the Forecast.Solar integration which shows how many kWh will be produced today and tomorrow. Based on this, I calculate how much % can be charged by sun and how much should be done by the net.

I plug in the cable every time I come home; the system calculates whether it needs to charge or not.

1 Like

Hey @bartland

how do you suspend the charging of the car to wait for the sun on Thursday? I tried setting the charge current to ‘0’ but then when I try to start the charging process when the energy from the PV becomes available the car enters ‘charging error’ mode.

Kind regards,
Lieven.

To suspend or stop car charging, I simply set that charget at 5 Amp.

Hey @bartland

thanks, setting the charge current to 5 indeed gives a different behaviour compared to setting it to ‘0’. Now I can configure the car to only start charging when there is solar generation the next day when I arrive home in the evening.

Regards,
Lieven.

Hi Bart,

Thanks for these scripts, I’ve added them to Home Assistant but cannot get them to work.
Switchting between phases does work with a slight delay.

What I find strange is that Home Assistant automatically changes the code as you posted to the decimal value:

alias: Laadpaal - 10A max
sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: laadpaal
      value:
        - 16672
        - 0
mode: single

I just copied your script and this is how it is saved. Doe you guys face this issue too? Would like to set the charging current but cannot get it to work this way. I used the ioBroker add-on as workaround but I would like to integrate everything in Home Assistant directly.

@bartland update: after testing over the night I see that after a bit more than 3 hours on 5A the chargepoint status changes from C1 (this means ‘charging’ but of course it is not actually charging because the current is too low) to B2 (this means car connected but not charging). I think this is the car stopping to attempt charging because of a timeout that happens.

I then have to open/close the car lock to get the charging going in the morning.

I’ll try again with setting the charge current to 6A every hour for a short moment to see if this makes the car behave differently.

Can you confirm that you can keep the car on 5A over the night to suspend the charge process and that it then it automatically resumes charging when you increase the start current to 6A? My car is a Volvo, maybe other brands handle this differently…