Due to the current climate crises, alternatives in your everyday lives help to reduce CO2 emissions. Electric vehicles are an excellent alternative to classical consumption in the mobility sector.

There are different OEMs out there, and the market for electric vehicles is becoming even more prominent. Some well-known cars from the PSA Group / Stellantis are, for example, the Opel Corsa-e (the best-selling electric small car in Germany), the Peugeot e-208, and their big brothers, the Opel Mokka-e, and the Peugeot e-2008.

TL;DR

To set a charging threshold / limit for electric PSA vehicles, use the Python PSA Car Control on a home server and integrate them into your Home Assistant setup optionally. Read this guide for a detailed setup.

Problems of PSA Electric Vehicles (EVs)

A big problem that is mentioned pretty often in various reviews is the missing ability to set a charging limit or threshold. When plugging the car into a charging station like a wall box, it starts charging and stops when the battery reaches 100%. This reduces the lifetime of the expensive battery and makes it wear quickly. To have something from the car as long as possible, different suggestions exist for battery conservation. On the one hand, almost all articles dealing with the longevity of batteries suggest reducing the 100% charges as much as possible. Depending on the source, the desired and best charge level is around 50 - 80%. On the other hand, it is also logical not to perform deep discharges converging towards 0%.

Therefore, most other OEMs ship functionality in the car or with an external app that allows setting a charging threshold. The myOpel app, for example, only allows the configuration of time-delayed loading without a limit function.

Solution: Use the PSA Control Python Program

Those who occupy themselves a little more notice that the car often phones home. Your battery level, the car position (if a navigation system is installed), the odometer reading, etc., are regularly sent to the PSA servers. Just good that they provide a WEB API that allows getting and setting data from almost all PSA brands like Opel, Peugeot, DS, Citroën, and Vauxhall.

An excellent Python script is available as open source on GitHub called PSA Car Controller. It allows different functionalities like setting the charging limit and much more.

Pre-Requirements & Installation

A system with Python or Docker installed is necessary (the operating system doesn't matter; Windows, Linux, and macOS are all OK). I highly suggest running it on a small home server like the Raspberry Pi 4* (see my blog article for a basic Raspberry Pi setup). Thus, I will explain it for the RPi setup.

The easiest way is to use Docker and docker-compose. Just clone the repository in a location of your choice (e.g., /opt):

$ git clone https://github.com/flobz/psa_car_controller.git

Go into the folder and start the container; that's it!

$ cd psa_car_controller
$ docker-compose up -d

You should now be able to visit the frontend by opening a browser and navigating to http://YOUR-SERVER-IP:5000. This should result in the following output:

PSA Car Control Configuration
PSA Car Control Configuration

An initial configuration is needed by selecting the car brand, entering the login credentials of the PSA account (that's the one from the app), and the country code. After an SMS verification with the SMS and PIN code (also the one from your account / the app), the system should be ready.

Set Charging Limit

After everything is configured correctly and running, visit the following URL to set your charging threshold to 80%:

http://YOUR_SERVER_IP:5000/charge_control?vin=YOUR_VIN&percentage=80 

Remember to replace YOUR_SERVER_IP with the IP of your home server or localhost when using the same system and YOUR_VIN with your vehicle identification number (that's the unique ID of your car).

That's it! Your vehicle should automatically stop charging after 80% is reached! You can also change the number 80 in the URL to any threshold you want.

Integration into Home Assistant

When running a Home Assistant instance, it is possible to integrate the PSA controller.

To do it, follow the step-by-step instructions from this repository. I added a slider functionality into it that allows quickly changing the threshold directly from Home Assistant in 1%-steps:

Slider in Home Assistant
Slider in Home Assistant

References