The clarification for the values that you see in my script is very simple and indeed something I did not mention in the original explanation: I am currently charging a plug-in hybrid car that only has a single phase charge current of max 16A. So a single ‘1A’ step account for ±230 W more or less power consumption.
Indeed if you are using 3-phase charging you need to account for the three phases.
Are you already switching between 1-phase and 3-phase charging via Home Assistant? If you do, feel free to add the required address to set that up, I cannot test it currently with my car.
thank you for the updates on your setup. From my side I am using a separate DSMR reader instance that pushes consumption values to an MQTT server once per second. Then wait for 3 incoming value to calculate an update for the charge point.
I have setup a timeout for the values received over modbus on the chargepoint of 60 seconds. This way, should anything fail in the software that calculates the new charge current so that it stops updating, then the chargepoint will fallback to the safe current after max one minute. This is a inverse compared to what you did with the setting of 16 A. It depends on what you what to obtain I guess
I agree with you that you have some margin on the fuses but I don’t want to experiment too much with that. Basically my method is ‘playing safe’ in a sense that I prefer to have the current lower for longer instead of it being too high for a short time.
So if my quooker kicks in for a couple of seconds it will immediately drive the Alfen down in power as there is a sudden drop in excessive power production.
Yes, this is what I also want to see as behaviour.
Thanks again for sharing and have fun with your setup!
that is a good question actually. I don’t have a P1 connection up to the chargepoint as it is located too far from my meter so this option is not activated on my device.
I do see in the configuration software of Alfen that the active load balancing data source can be either set to ‘Energy management system’ or to ‘Meter’. It is not clear to me if the modbus interface is active on the device if the load balancing is set to ‘Meter’.
I’d say: give it a try. For a minimal test you can add a readout of the chargepoint temperature to Home Assistant like this:
If this works when the chargepoint is connected to the P1 port for load balancing the you can extend the configuration to also readout the other relevant parameters.
How did you phisically connect to your charging station? Did you connect the RJ11 of RJ45?
I would like to have the same setup as you, but do not have any software to control my charging station. I’ve donwloaded the software from Alfen’s website, but cannot sign in because I dont have credentials. How did you get those? Or do you have a other way to get in to the management software?
Thanks in advance!
my charging station is connected solely over ethernet (RJ45). For de control software: you can simply download it from the site of Alfen as you state and then via their support desk you request an account. With that account you can open the software and configure the charging station as you wish.
The only thing I can add: depending on the ‘feature licenses’ that are already activated on your station it is possible that the feature ‘active load balancing’ is not yet unlocked. In that case you need to buy the additional license for that feature. It is required to be able to activate the modbus interface. That feature was not active on my charging station and I could unlock it via the extra license and the configuration software.
Best regards and success with the experiments!
Lieven
Thanks for your information.
I’ve got an account for the Alfen Service Installer and connected it to the same network as Home Assistant.
It turned out I have the license for Load Balancing and it is set to Modbus now. I filled in the IP address of Home Assistant. Unfortunately it does not work yet.
In Home Assistant I get ‘connection refused’ and the ACE tells me “connection error for Modbus unit 5 (192.168.1.10)”.
could you please share how you have the settings of modbus in ACE?
mine are as follows:
Data source: meter
Protocol: Modbus tcp/ip
and on the TCP/IP meter tab:
IP address 192.168.1.10
Slave address: 5
Mode: Custom Register Mapping/Socomec (both don’t work).
I coppied your HA config so these are the same.
Thanks in advance!
due to the holidays I don’t have physical access to the device to check the exacte settings, but if my memory serves well there should be an option ‘energy management system’ instead of ‘meter’ as data source. I think that is the reason why it is not working as expected for you right now.
Also: I did not have to make any changes to the TCP/IP tab.
If this does not help you further then let me know and I will provide the full info by the end of the week when I can check the service installer software.
Sure!
I connected my charger via RJ45 to my switch.
I have made a account on the Alfen back office and asked for ACE credentials.
After that I logged in on ACE with the delivered credentials I went to General and made sure the Active loadbalancing was unlocked.
Then I went to Load Balancing and set Data Source to ‘Energy Management System’. That did the trick!
I like it. I am starting my journey looking for chargepoint and have a proposal of Alfen Eve Pro so looking if I can interface it in a way or another with HA
Back to basic: you can read its status/variables via MODBUS & can “act” on some settings ? Correct ? Where/How did you find information about registers etc… (I am not a specialist but read already some data via MODBUS from my SMA)
Hi Lieven, I’m pretty new to HA. I followed your guideline and was able to read out the sensors of my Alfen charging station. However, I can’t really follow your explanation how to integrate your perl script in HA. Could you briefly explain how exactly I could integrate your perl code in HA?
good to hear you have the modbus interface up and running.
In fact the Perl script is just running in parallel next to HomeAssistant as a separate process.
The reason I wrote it this way is because for me it was easier to write the logic and the formatting of the data that needs to be sent to the chargepoint in Perl than in Python as I am more comfortable with Perl. @menloperk who is more comfortable with Python did provide an example code that you could actually integrate in Home Assistant but for one reason or another he removed his post from this thread.
The communication between the two happens over MQTT.
So you need:
an MQTT broker (e.g. mosquitto)
Home Assistant running and configured to communicate to the broker
the Perl script I wrote that is communicating to the broker
a unit that tells what the energy balance of the system is (e.g. an electricity meter with DSMR interface) to the broker
What the script does:
it listens to the topics dsmr/reading/electricity_currently_delivered and dsmr/reading/electricity_currently_returned over MQTT
based on the information it receives it will try to increase or decrease the current setting in the chargepoint to minimize the energy consumption from the grid by posting to the topic chargepoint/maxcurrent. That value is then consumed by the script in HomeAssistant to push it further to the chargepoint.
To allow easy deployment of the script I have updated the repository with a Dockerfile and an example docker-compose file that creates and runs a docker container with the script so that you don’t have to setup a Perl environment.
Thanks for the explanation Lieven, I understand now your setup. Do you run both HA and the docker file on the same hardware? I’m running HAOS and I’m not sure how to run a docker image inside HAOS.