lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
275 stars 126 forks source link

Connection URL #195

Open UBT-FJ opened 1 year ago

UBT-FJ commented 1 year ago

Hello,

this might be really stupid but I'm trying to connect through one of the Html simple OCPP 1.6 simulations and can't connect to the central system! with this ws://localhost:8887, I guess I need to pass on the CLIENT_ID but how and where? and my question is how would the real charger connect, do we need to pass the CLIENT_ID via OCPP or how? thanks.

UBT-FJ commented 1 year ago

just an update, I just tested a real charger with a Tesla car with example/1.6/cs/*.go, it connected but couldnt see any meter running! just this:

INFO[2023-05-12T13:08:40+02:00] boot confirmed client=Charger1 message=BootNotification ERRO[2023-05-12T13:08:40+02:00] error on request: ocpp message (352620167): NotSupported - ReserveNow client=Charger1 message=ReserveNow INFO[2023-05-12T13:08:40+02:00] dispatched request 2986398606 for Charger1 logger=ocppj ERRO[2023-05-12T13:08:41+02:00] error on request: ocpp message (2986398606): NotSupported - CancelReservation client=Charger1 message=CancelReservation INFO[2023-05-12T13:08:42+02:00] dispatched request 864392045 for Charger1 logger=ocppj INFO[2023-05-12T13:08:43+02:00] current local list version: 0 client=Charger1 message=GetLocalListVersion INFO[2023-05-12T13:08:47+02:00] dispatched request 1533957119 for Charger1 logger=ocppj WARN[2023-05-12T13:08:48+02:00] couldn't update configuration for readonly key: MeterValueSampleInterval client=Charger1 message=ChangeConfiguration INFO[2023-05-12T13:08:52+02:00] dispatched request 2070092719 for Charger1 logger=ocppj INFO[2023-05-12T13:08:53+02:00] Heartbeat triggered successfully client=Charger1 message=TriggerMessage INFO[2023-05-12T13:08:54+02:00] heartbeat handled client=Charger1 message=Heartbeat

I guess I need to do my own script to read those.

lorenzodonini commented 1 year ago

Hey,

with this ws://localhost:8887, I guess I need to pass on the CLIENT_ID but how and where?

In the simplest case, the server could be started with:

centralSystem.Start(8887, "/ocpp/{ws}"

The CLIENT_ID is appended at the end of the URL by the client so it can connect to the server, e.g. ws://somehost:8887/ocpp/{CLIENT_ID}. That parameter uniquely identifies a charger with the server. Prefixes and host/port combinations depend on the implementation and network configuration.

it connected but couldnt see any meter running

The boot sequence and heartbeat seem to work just fine, so communication was established correctly. The ReserveNow probably fails because it's not supported by the charger (home wallbox?). The meter values should show up once a transaction is started.

The example is very barebones and mostly scripted, so it will be harder to test against a real charger. I'd recommend using the example as a starting point to build your own implementation/script.