Stop Charging
Learn how to successfully stop a charging session in progress.
Prerequisites
- Your application should have saved the Session Id when you created it. See Start Charging. You can also call
GET Sessions
and search for a session on a Connector of interest.
Step 2: Stop the Session
var request = require('request');
var options = {
'method': 'GET',
'url': `api.edrv.io/v1.1/sessions/${session_id}/stop`,
'headers': {
'Authorization': 'Bearer <API_KEY>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
A successful response means that eDRV will now attempt to stop the session.
Under the hood
Successfully calling
/sessions/{id}/stop
kicks off a chain of events on eDRV:
- eDRV attempts to stop charging by sending a RemoteStopTransaction request
- The chargestation will now attempt to gracefully shut down charging and if successful, inform eDRV via a StopTransaction message
Session Stops can be Delayed
In the real world there are many reasons why a stop session request may take a while to complete.
For e.g. some chargestations only query the meter every so often and will wait for a final meter reading before reporting a charging stop to eDRV.
Session Stops can Fail
The most common reason is that the chargestation is having communications issues and is unable to receive the stop message form eDRV or cannot send a confirmation message back after stopping.
Stop 3: Confirm Charging has stopped via Webhooks
The best way to confirm that charging has stopped on the chargestation is via Webhooks . Please monitor your application Webhook for the following event that confirms a charging session has stopped:
Webhook Event session.ended
A confirmation directly from the chargestation that this session has successfully stopped.
Please do not poll the sessions endpoint for a change of status
This is an inefficient use of server resources on both sides. Please use Webhooks instead.
Updated over 1 year ago