A while ago I wanted to have more control over my Alfen ChargePoint.
The firmware didn’t allow charging with ‘solar only’, and there was no ‘power-charge’ mode, to force hi-power charging if needed.
Then I stumbled on the topic from @hollie who started the same a while ago. : https://community.home-assistant.io/t/alfen-eve-pro-ev-chargepoint-interface-via-tcp-modbus
So if you’re more into scripts & automation, please check that topic !
Starting from his project, and the replies on that, I wanted to implement this fully in Node-Red.
In my case, I’m using 1fase 230V 32A charging (max 7.4kW)
What is needed :
- A switch, for enabling power-charging : input_boolean.power_charge
- Max powercharge current : input_number.max_powercharge_current : (0…32A) defines the max total current that can be drawn from the net during charge
- Car Charge Ampere : input_number.car_charger_ampere : (in my case 5…30A) the values that are valid for sending to the chargepoint
Why 5A? when it’s below 6A but not 0A, the car won’t charge, but will stay ‘active’ and just pause the charging process.
in your configuration.yaml, you need to add the modbus part, and a template to make the chargepoint levels readable (credits @hollie )
template:
- sensor:
- name: mode3_sanitized
state: "{{states('sensor.laadpaal_mode3_state').replace('\0','') }}"
- name: chargepoint_status
state: >
{% set m3 = states('sensor.mode3_sanitized') %}
{% if m3 in ['A', 'E'] %} available
{% elif m3 in ['B1', 'B2', 'C1', 'D1'] %} connected
{% elif m3 in ['C2', 'D2'] %} charging
{% else %} {{ m3 }}
{% endif %}
modbus:
- name: laadpaal
type: tcp
host: 192.168.x.x
port: 502
sensors:
- name: laadpaal_name
slave: 200
address: 100
count: 17
data_type: string
- name: laadpaal_temperature
slave: 200
address: 1102
data_type: float32
unit_of_measurement: °C
- name: laadpaal_active_max_current
slave: 200
address: 1100
data_type: float32
unit_of_measurement: A
- name: laadpaal_real_power_sum
slave: 1
address: 344
data_type: float32
unit_of_measurement: W
- name: laadpaal_mode3_state
slave: 1
address: 1201
count: 5
data_type: string
scan_interval: 5
- name: laadpaal_actual_applied_maxcurrent
slave: 1
address: 1206
data_type: float32
unit_of_measurement: A
- name: laadpaal_modbus_maxcurrent
slave: 1
address: 1210
data_type: float32
unit_of_measurement: A
- name: laadpaal_socket1_current_valid_time
slave: 1
address: 1208
data_type: uint32
unit_of_measurement: s
The flow :
- Flow starts every 20sec
- first check if car is connected (sensor.chargepoint_status)
- If not connected, do nothing
- if connected, check if powercharge button (input_boolean.power_charge) is active an send state to flow.powerbutton for use later
- Poll my digital meter
- take an average of the last 3 readings (to filter out small spikes)
- powerbutton NOT active :
- set ‘set power level’ switch node (ampere) -2 -1 +1 +2, according to injected or consumed power
- powerbutton active :
- Check Powercharge current set in UI (input_number.max_powercharge_current) and use it in flow
- translate current to power (in my case current x 230)
- make negative
- create array with powercharge power & DM power
- add them togehter to create a value that allows us to draw the extra power from the net
- inject this into the ‘set power level’ switch node
- set ‘set power level’ switch node (ampere) -2 -1 +1 +2, according to injected or consumed power
- read currecnt state of ‘input_number.car_charger_ampere’
- create float32 value from current (credits : @DelfuegoNL)
- write float32 value to charger over modbus
If you have questions, better flows, please respond, this is still version 0.1 beta, so I’m testing it, but it looks like it’s working :
My dashboard looks like :
Node red flow :