lorenzodonini / ocpp-go

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

how do i get message id for CentralSystem commands #197

Closed rafee-eigen closed 1 year ago

rafee-eigen commented 1 year ago

I'm trying to get message id for central system commands. looks like most doesnt really pass the requestId

github.com/lorenzodonini/ocpp-go@v0.16.0/ocpp1.6/central_system.go

Is there any way, i can get message id

lorenzodonini commented 1 year ago

The message ID is currently abstracted away and not visible in the upper layer. To be more precise, unique request identifiers are part of the ocpp-j spec and not the pure ocpp spec. Request IDs are visible in the logs though, if enabled.

What would you need it for, if I may ask?

rafee-eigen commented 1 year ago

Thanks @lorenzodonini for the update.

In OSCP 2.0, (4.4.1. UpdateGroupCapacityForecast & 4.4.3. GroupCapacityComplianceError) :

There is a request to distribute energy to chargers & any request fails or unable to comply, we need to send another error request to energy provider. (GroupCapacityComplianceError X-Correlation-ID is required which is same as X-Request-ID in UpdateGroupCapacityForecast sent in before.)

The way I tried to achieve, is by sending SetChargingProfile (wait for Accepted/Rejected response). chargerId & messageId (OCPP message ID) & X-Request-ID (OSCP) is used to map & accumulate all the energy for Rejected/Offline , compile the GroupCapacityComplianceError request & send.