Alfen Eve Pro EV chargepoint interface via TCP modbus

Enabling modbus replaces the built-in active load balancing of the Alfen device.

So if you use Modbus, you have to interpret P1 readings to determine a sensible charging current and send that to the charger using Modbus.
So you have to create your own load balancing rules in Home Assistant.

(this also answers Scallidotcom’s question)

I can confirm that my BMW hybrid has the same issue: it will not start charging when the Alfen is first set to under 6 (5 in my case) and then goes to 6 or more.
So that charge current trick cannot be used to determine whether the car should be charging.

I wonder if there is another signal to send through Modbus or the API to gracefully disable/enable charging?
There is the “Suspend Charging Mode” which responds to a switch or relay connected to two of the lines that would otherwise be used for the P1 connection. That’s a last resort for me, because I would need to connect a relay to an ESP8266 and control that from home assistant. Quite a hassle for something that should be easy with software.

Hey @emv,

I did not succeed to reliably disable charging from the chargepoint either. I am using the API to the car to pause charging. This way I can ‘suspend’ the charging for longer times reliably. But I don’t know if your car brand supports this via API.

Another possibility - with limited extra energy consumption - would be to set the charge current to ‘0 A’ and enable the charging for a short time at 6A every now and then (e.g. every 15 minutes). To be tested if your car supports this of course…

[edit: oops, I did not realise you replied on a post from long ago where I basically explained how I tackle the charging…]. Either way: I would give it a go with testing 0 A for 15 minutes - 6A for 1 minute - 0A for 15 minutes - … to see if this helps…

Good luck!
Lieven

This thread is amazing! Thanks Lieven and BartLand!

@bartland would you mind sharing the codes to these services:

  - service: script.charger_define_phase_1_or_3_based_on_watt
  - service: script.charger_define_ampere_based_on_watt     
  - service: script.charger_define_and_write_register_based_on_ampere

I’m guessing these are the ones that set phases and amps on the charger? I have all the pieces working seperately, I can switch phases mode, I can change amps but the combination is something I have not been able to get working yet. I’m guessing the magic is in those 3 scripts :wink:

Here there are. Hope this helps.

charger_define_phase_1_or_3_based_on_watt:
  alias: "laadpaal - bepaal 1 of 3 fases"
  sequence:
  - service: >-
      {% if states('input_number.car_charger_watt') | float < 4 %}
      script.set_charger_to_1_phase
      {% elif states('input_number.car_charger_watt') | float >= 4 %}
      script.set_charger_to_3_phases
      {% endif %}

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

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

charger_define_ampere_based_on_watt:
  alias: "laadpaal: bepaal ampère"
  sequence:
  - 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 1.3 <= W < 1.5 %} 6
          {% elif 1.5 <= W < 1.8 %} 7
          {% elif 1.8 <= W < 2.0 %} 8
          {% elif 2.0 <= W < 2.2 %} 9
          {% elif 2.2 <= W < 2.4 %} 10
          {% elif 2.4 <= W < 2.5 %} 11
          {% elif 2.6 <= W < 2.8 %} 12
          {% elif 2.8 <= W < 3.1 %} 13
          {% elif 3.1 <= W < 4   %} 14
          {% elif 4   <= W < 4.6 %} 6
          {% elif 4.6 <= W < 5.3 %} 7
          {% elif 5.3 <= W < 6.0 %} 8
          {% elif 6.0 <= W < 6.6 %} 9
          {% elif 6.6 <= W < 7.6 %} 10
          {% elif 7.6 <= W < 8.5 %} 11
          {% elif 8.5 <= W < 9.2 %} 12
          {% elif 9.2 <= W %} 13
          {% endif %}

charger_define_and_write_register_based_on_ampere:
  alias: "laadpaal: bepaal registerwaarde voor ampère en stuur naar laadpaal"
  sequence:
  - 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 %}[0x4150, 0x0000]
      {% elif A == 14 %}[0x4160, 0x0000]
      {% endif %}

send_ampere_to_charger:
  alias: "laadpaal - schrijf Ampère naar register van laadpaal"
  sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: car_charger
      value: "{{ registervalue }}"

Yes that helps greatly @bartland ! I must confess that after posting my question I reread the thread and basically everything is there already, so sorry for the inconvenience :slight_smile:

Would you also happen to have the register byte values for 15 and 16 amps? :slight_smile:

Nice. This gives a more smooth increase of the wattages from 1.5 kW till 10.7 kW.

Just a warning if using high amperage: make sure that the electrical setup of your house can handle it.

When I used 14 ampere or above, the fuses in my electrical board sometimes went out.
Here, it’s just a line in a configuration file, but it’s “high power” stuff. :slight_smile:

Hi @bartland four followup questions after combing through your automations.

  • How did you calculate the bytes sent to the charger (based on amps) I’m trying to figure out how to add 15 and 16
  • Would you mind sharing your stop_charger script (and is there a start_charger one? couldn’t find that in your shared automation)
  • what are you using this for: car_charge_sun_max_netwattage I’ve now set it to -125 to have a little spare energy, but perhaps you are using it for a different purpose?
  • Purely out of curiousity, could you share your /dashboard-car/car-charging yaml?

Feel free to answer only some or none, I can imagine you’re getting these questions a lot since contributing to this thread :slight_smile:

Interesting, but I can’t find this setting in the Alfen app. Perhaps it’s only available in the Windows application?

Edit: I cannot find it the app on my android phone, but it is indeed available in the ACE. That means you can still do loadbalancing on the P1 even if you only have a RJ45 network cable.
For example: connect the P1 port with a raspberry pi, read the serial port and publish it to a tcp/ip port with ser2net. Then configure the charger with the ACE: select DSMR4.x/SMR5.0 as the protocol in Active Load Balancing, and in the DSMR/SMR (P1) tab, select Telnet as the interface, and enter the ip and port of the raspberry pi.

You can convert decimals to the hexadecimal representation of IEEE 754 floating point with this convertor: IEEE-754 Floating Point Converter

14 = 0x41600000
15 = 0x41700000
In the yaml code, you will need to write it as:
[0x4160, 0x0000]
[0x4170, 0x0000]

2 Likes

Stopping the charger is done by putting it at 5 ampère. That is too low for the car to charge, so the car stops charging but the charger itself is still powered on and the “session” continues.

stop_charger:
  alias: "laadpaal - stop laden door op 5 A te zetten"
  sequence:
  - service: modbus.write_register
    data:
      address: 1210
      unit: 1
      hub: car_charger
      value: [0x40a0, 0x0000]
1 Like

Hi all,

I’m able to read from the registers of the Alfen, but writing to it does not have any effect and neither does it give an error. Is there some setting that needs to be activated before you can write?

Edit: there is this setting: ‘SCN Modbus Slave Max Current enable’ at address 1431. This is disabled on my charger. Perhaps that is the reason. Any idea how it can be enabled?

Thank you.

Hi guys,
i’ve tried to connect to my alfen wallbox but without success.
I don’t know which user and password put in integraton fields.

I’ve tried owner, admin and my actual username released from Alfen.
I’ve two passwords. Ones to enter in Alfen service intaller software:

and the other to enter in the config section ofthe same software:

Cattura6

Could you help me please?
Regards,

Alessandro

Check the Logging tab in the ACE Service Installer application after you write a register, maybe there will be some information?
“SCN Modbus Slave Max Current enable” is only relevant when you are using a Smart Charging Network (which is when Alfen stations work together to stay below the configured maximum current, it also requires a separate license IIRC)

The first screenshot you showed is to login to the ACE Service Installer. This is done using your actual username from Alfen and the password that matches it.

The second screenshot you showed is to login to the charging station. This is done using the Owner user level (I think this uses ‘admin’ underwater, I’m not sure). For that, you need to use the password that came with your charging station (or whatever you changed it to). If you kept the password default, perhaps you can obtain the default password in Alfen customer portal?

Do you still have this issue? When you encounter this issue, can you download a week’s worth of logging using the ACE Service Installer application and send it to me? Maybe I can find something interesting in there…

Fixed!
admin and wallbox password :slight_smile:

(replying to a post from @hollie) Thanks, I now use the car API too. The latest version supports selecting “charge immediately” or “charge in time slot” which is enough to turn charging on or off. It’s not ideal because if I connect the car to a public charger somewhere, it won’t immediately start unless I also change that setting.

The momentary turning on of charging is something I haven’t tried yet, indeed.