[UI Config] Cannot add OCPP Charger: connector already registered: 1
Describe the bug
When adding a Wallbox Commander 2 (FW 6.x), the charger connects to EVCC's OCPP correctly, but then I cannot add it to my dashboard. I get the following error: create failed: cannot create charger type 'template': cannot create charger type 'ocpp': connector already registered: 1
Steps to reproduce
- Add Charger
- Select Wallbox FW 6.x
- Enter station id
- Click Save, box populates with correct info, popup with error
Configuration details
[main ] INFO 2025/03/13 20:40:42 evcc 0.200.9
[main ] INFO 2025/03/13 20:40:42 using config file: /etc/evcc.yaml
[db ] INFO 2025/03/13 20:40:42 using sqlite database: /root/.evcc/evcc.db
[mqtt ] INFO 2025/03/13 20:40:43 connecting evcc-514717598 at tcp://hass.smart:1883
Konfiguration (/etc/evcc.yaml):
network:
host: evcc.edm.sh
port: 7070
interval: 30s
# trial token, valid until 2025-03-24
sponsortoken: *****
mqtt:
broker: hass.smart:1883
topic: evcc
user: *****
password: *****
circuits:
- name: main
title: Main Circuit
maxPower: 7
vehicles:
- name: XC60
type: template
template: volvo2mqtt
title: XC60
capacity: 18.8
icon: car
timeout: 720h
vin: *****
- name: XC40
type: template
template: volvo2mqtt
title: XC40
capacity: 78
icon: car
timeout: 720h
vin: *****
meters:
- name: grid
type: template
template: tesla-powerwall
usage: grid
host: battery.power
password: *****
- name: pv
type: template
template: tesla-powerwall
usage: pv
host: battery.power
password: *****
- name: battery
type: template
template: tesla-powerwall
usage: battery
host: battery.power
password: *****
- name: solar
type: template
template: fronius-solarapi-v1
usage: pv
host: inverter.power
user: *****
Version: `0.200.9`
Log details
[ocpp ] INFO 2025/03/13 20:42:46 charge point connected, registering: garaje1
[garaje-1] WARN 2025/03/13 20:43:12 failed triggering StatusNotification: cannot send request 3658716379, no client garaje exists
[garaje2-1] WARN 2025/03/13 20:56:49 failed triggering StatusNotification: cannot send request 3313779249, no client garaje2 exists
[ocpp ] INFO 2025/03/13 21:02:39 charge point connected, registering: cambrils
What type of operating system or environment does evcc run on?
Docker container
External automation
- [x] I have made sure that no external automation like HomeAssistant or Node-RED is active or accessing any of the mentioned devices when this issue occurs.
Nightly build
- [x] I have verified that the issue is reproducible with the latest nightly build
Version
evcc version 0.200.9 (c2f31f14)
When I check the DB, there are no chargers logged in it, so I'm not sure how connector 1 can already be registered
Using the evcc config assistant works
We've addressed similar issues in the last days https://github.com/evcc-io/evcc/issues/19143, https://github.com/evcc-io/evcc/issues/19229. @andig should OCPP cleanup work right now?
Sorry, tried searching the issues but I cannot speak German, so it was a little difficult to find relevant ones.
let me know if you need any other info from me, it is very easily reproducible on my side.
@aguilaair thanks. I'll come back to you if we can't reproduce.
@mfuchs1984 du bist hier so super im Thema... könntest Du Dir evtl. mal anschauen was es brauchen würde um den Connector erneut registrieren zu lassen? Im Prinzip gibts zwei Möglichkeiten:
- nach dem Context cancel räumen wir alle Konfiguration wieder ab (das bräuchte man wohl für "anonyme" Charger) oder
- wir erlauben einfach, dass bei erneuter Konfiguration die schon bestehenden Strukturen getroffen werden können
Hey, hier auch gleiches Problem mit einer EON vbox bzw Vestel EVC04. Auch nach Werkseinstellung (Hard-Reset) zurücksetzen und evcc komplett Neuinstallation.
@andig das wird leider zeitlich schwierig, kann also nichts versprechen.
Hey, hier auch gleiches Problem mit einer EON vbox bzw Vestel EVC04. Auch nach Werkseinstellung (Hard-Reset) zurücksetzen und evcc komplett Neuinstallation.
The only way to fix it is to use the .yaml file to configure the chargers
I´m facing the same problem with an Vestel EVC04 that I want to connect via OCPP. Also the the error code: cannot create charger type 'template': cannot create charger type 'ocpp': connector already registered: 1. I run EVCC as add on in Home assistant and did the config of the battery etc. via the experimental UI so if I open up my evcc.yaml the file is empty. How could I manually add the OCPP connection or is there any way to do that ?
Easiest way is to use the evcc assistant to generate the .yaml file for you tbh, then you just put that in your empty config file
Since you have the EVC04, did already tried to connect your wallbox via modbus tcp? I was wondering, if this might work on your device.
I have the sams problem right now. Running newest evcc in HomeAssistant and trying to add it with the gui. I also have the Problem, if the connection is nit working immediately, i cant retry the connection because it gives the same error
Since you have the EVC04, did already tried to connect your wallbox via modbus tcp? I was wondering, if this might work on your device.
There are several options for the EVC04 and it seems that I have the charger without modbus tcp.
Easiest way is to use the evcc assistant to generate the .yaml file for you tbh, then you just put that in your empty config file
I have tried to add a new config manually after I deinstalled and installed the add on again. Then everything seemed to work till today. I now get uninterrupted timeouts from the charger. So by adding the OCPP charger manually before making any changes via the ui I recieved some data for a small time. So I will deep dive on that
Hi. I have the same situation trying to add an Orbis Viaris (and also the general OCPP charger) using the GUI I get this error:
"cannot create charger type 'template': cannot create charger type 'ocpp': connector already registered: 1"
TL;DR
I found a workaround for this issue with OCPP wallboxes and the Config UI. Follow the steps below to see if it helps! It's not pretty, but hey.
Workaround Instructions
Important: Do not configure the wallbox with OCPP before starting. Correct timing is essential for this workaround.
-
In evcc’s Config UI, add a new charge point:
- Name it however you like.
- Select one of the OCPP chargers.
- Add a dummy
stationid(for example,1) — don’t use the actual one you’ll set in the wallbox.
-
Click
Validate & Save. -
While evcc is still loading, change the
stationidto the real value (for example,amtron).- In many wallboxes, this can be set in the OCPP settings. Sometimes it's named differently, e.g.
Client ID.
- In many wallboxes, this can be set in the OCPP settings. Sometimes it's named differently, e.g.
-
Wait even if it looks like the
Validate & Saveaction was canceled.- The UI won’t show a loading state anymore, but give it about 15 seconds.
-
After 15 seconds, you’ll see an error from the original
Validate & Saverequest.- Notice the button is now just
Save(notValidate & Save).
- Notice the button is now just
-
Configure the OCPP settings in your wallbox as usual, but ensure it doesn’t try to connect yet.
- That means setting the URL & stationID in the wallbox, but not letting it fully initiate a connection.
- For some wallboxes this means don't save the settings yet. For others, it means you can save, but not yet restart!
-
Back in evcc, click
Save. -
Only now let the wallbox connect to evcc. You may have to be quick. If it fails, you will have to try again with a new
stationid.
Done! ✅
How I Discovered This
I ran into the same OCPP connection issue myself. I resolved it by simulating a virtual OCPP wallbox and experimenting with different connection timings using this simulator:
OCPP Virtual Charge Point
Tested Versions
0.202.00.201.0
Using the generic OCPP1.6J charger. Hope it helps! Would be keen to hear if it worked for you.
Hello is this fixed or should I use the workaround ?
Still broken,
Can't test wallbox ocpp capabilities as the workaround does not work for me / my wallboxes
@vincko
Only now let the wallbox connect to evcc. You may have to be quick. If it fails, you will have to try again with a new stationid.
What do you mean with "quick" - I am not able to achieve that, please see how it tried below
If i hit save and directly restart my Box (needs to be done this way and takes about 30 seconds) it does not work - even tried with restarting like 20 seconds earlier (available 10 seconds later) and have not been able to save
On a general note: the workaround is based on my personal experience, not necessarily endorsed by the developers.
@Cheppetto The goal is the following flow:
- You hit
Save(step 7) - Evcc now waits for the wallbox to connect with the station id entered in step 3 (the real value you want to use)
- The wallbox connects to evcc before the check in evcc times out
- You can continue.
It also took me multiple tries to get right with a wallbox that had to be restarted after changes to the OCPP settings.
What do you get in your case? Does an error appear that there was a timeout?
It instantly hits me with the pop up error - already registered - whilst in the background save still seems to be running
Wallbox becomes available whilst saving wheel animation still turns in the background.
Nothing changes (no successful save), afterwards I can just click on the pop up and still have the timeout error in the validation bracket
removed screens due to public accessible domain name shown, sorry
Hi is there any further information that is needed to get to the bottom of this error? I will be happy to provide any missing log files.
The problem is that I'm still unable to add my OCPP charger via UI because of the error: "cannot create charger type 'template': cannot create charger type 'ocpp': connector already registered: 1"
So I find it difficult to troubleshoot another issue I have: https://github.com/evcc-io/evcc/discussions/20903
Can i install a older Version? I dont get the yaml file
Older versions don't support UI config at all.
I asked Copilot if the validation process could be the root cause for this error, and it seem that the validation process actually register the connector, so when the save process would like to save it, then it give this error. Here is the suggestion from Copilot:
`Yes, the error message:
"cannot create charger type 'ocpp': connector already registered:"
can indeed result from the validation process already registering the OCPP charger, so that when you try to save (and thus re-create/register) the same charger, the system detects a duplicate registration and throws this error.
Why does this happen? Validation Process: When you press "Validate," evcc attempts to actually connect to and register the OCPP charger using the provided configuration. This is done to ensure that the settings are correct and the charger is reachable. Registration Side Effect: In the OCPP charger implementation, registering a charger (specifically, the charge point/connector) involves adding it to an internal registry or map. If you do this during validation, the internal state is changed. Save Process: When you then attempt to "Save," the system tries to create/register the same OCPP charger again. Since it was already registered during validation, the code detects this as a duplicate and throws the "already registered" error.
Relevant Code Evidence
From the code (see charger/ocpp.go):
Go
cp, err := ocpp.Instance().RegisterChargepoint(id, ...)
if err != nil {
return nil, err
}
If the RegisterChargepoint function finds that a charge point with the same ID is already registered, it will return an error.
Typical Cause The validation process is not idempotent—it leaves behind a registered charge point. The save process does not "know" this is just a leftover from validation, so it refuses to register again. Solutions Backend Fix: The validation process should clean up any registered charge points after the check, or use a temporary/unique ID for validation. Frontend/UX Guidance: As a user, avoid pressing "Validate" multiple times before saving, or reload the page to clear temporary state if you encounter this error. If you are developing or maintaining the system, consider ensuring that validation does not have persistent side effects, or that it unregisters/cleans up after itself.
Summary: Yes, the error can be caused by the validation process registering the OCPP charger, which then blocks the save process due to the duplicate registration.`
So CoPilot suggest to:
Modify the validation logic so that after a successful validation, the OCPP charger or connector is unregistered and cleaned up.
After you call the registration (e.g., RegisterChargepoint), ensure you also call the corresponding "unregister" or removal function before validation completes or if validation fails.
@andig @naltatis ich habe ein wenig experimentiert und keine echte Lösung gefunden, aber dennoch etwas Erkenntnis gewonnen:
- Jedes "Prüfen" registriert einen neuen ChargePoint mit der angegebenen Station ID per RegisterChargepoint.
- Ist diese leer, führt das bei weiterem "Prüfen" zu "cannot have >1 charge point with empty station id, siehe https://github.com/evcc-io/evcc/blob/2cad067baf6815b8c5eb2aae55edf41ec69fb1a2/charger/ocpp/cs.go#L90"
- Ist die Station ID nicht leer, führt eine weitere Prüfung zu "connector already registered: %d" in registerConnector, siehe https://github.com/evcc-io/evcc/blob/2cad067baf6815b8c5eb2aae55edf41ec69fb1a2/charger/ocpp/cp.go#L63
- Entfernt man diese Prüfung, funktioniert es. Damit verliert man aber die Prüfung für doppelte Anschlussnummern.
- Grundsätzlich funktionieren leere Station IDs mit dem jetzigen Design per UI nicht.
- Konfiguriert man per yaml ohne Station ID, existiert von Anfang an ein anonymer ChargePoint mit leerer station id. Wenn sich die Wallbox dann per ocpp verbindet, schnappt sie sich die leere Struktur, siehe https://github.com/evcc-io/evcc/blob/2cad067baf6815b8c5eb2aae55edf41ec69fb1a2/charger/ocpp/cs.go#L130. Deshalb kann man, wenn man nur einen OCPP Charger hat, die Station ID weglassen, bei mehreren ist sie zwingend notwendig.
- Drückt man aber den "Prüfen" Button in der UI, wird jedes mal ein neuer anonymer ChargePoint registriert. Wenn nun der ChargePoint sich im Hintergrund verbindet, schnappt er sich diesen. Drückt der Benutzer aber wieder auf "Prüfen", wird ein neuer erstellt, deshalb kommt nie eine Verbindung mit dem eigentlich schon verbundenen ChargePoint zustande.
Ich denke aufgrund dieser Erkenntnis, dass hier ist ein größerer Umbau notwendig ist, vor allem in Hinblick auf den letzten Punkt. Ggf. eine Art temporärer OCPP Charger, der nicht auf die Station ID schaut und der nach der Prüfung wieder gelöscht wird. Dafür fehlen mit leider die notwendigen golang skills (bzw. aktuell die Zeit, mir diese zu erarbeiten).
Hi [@mfuchs1984 - your conclusion is precisely the same as my analysis using copilot was showing. The issue seems to be caused by the validation process that actually register the ID during the process, and therefore it is not possible to save the charger later because the ID is already used.
Copilot suggest that the validation process use a clearly-marked temporary ID and the register/unregister function is using this temporary ID during validation. This ensures the real charger registration is never touched during validation.
I don't know go well enough to actually change the code - but copilot suggest a code change like this:
func ValidateOCPPConfig(ctx context.Context, config map[string]interface{}) error {
realId := config["StationId"].(string)
tempId := fmt.Sprintf("validation-%s", realId)
config["StationId"] = tempId // Use temp ID for validation
charger, err := NewOCPPFromConfig(ctx, config)
if err != nil {
return err
}
// ... Perform validation logic ...
// Always unregister the temp ID after validation
ocpp.Instance().UnregisterChargepoint(tempId)
return nil
}
Maybe someone with a deeper knowledge can take a look?
I do thave the same problem. Hoping for a fix :-)
Same problem here,, tried to switch to ui config, but this prevents my from it. Staying with yaml for the time being.
#22115 should do the trick now if the charger is quick to register. We'll look into how to make this more flexible. A test confirmation would still be great.
Will #22115 also help in my situation? I have an OCPP charger with two connectors, and I have always used number 1 and number two - but still get the error "Already registered" So I have not used an anonymous charging point - therefore I'm not sure if the mentioned solution will cover my issue?