Populating siteID, siteAreaID and CompanyID from URL in WSConnection.
MODIFY
src/server/ocpp/json/WSConnection.ts
src/server/ocpp/json/WSConnection.ts
@@ -56,10 +56,20 @@ export default abstract class WSConnection {
// Remove '/'
this.url = this.url.substring(1, this.url.length);
}
- // Parse URL: should be like /OCPPxx/TENANTID/TOKEN/CHARGEBOXID
- // We support previous format for existing charging station without token /OCPPxx/TENANTID/CHARGEBOXID
+ // Parse URL: should be like /OCPPxx/TENANTID/TOKEN/CHARGEBOXID/SITEID/SITEAREAID/COMPANYID
+ // We support previous format like
+ // for existing charging station without siteID, siteAreaID and companyID /OCPPxx/TENANTID/TOKEN/CHARGEBOXID
+ // for existing charging station without token also /OCPPxx/TENANTID/CHARGEBOXID
const splittedURL = this.getURL().split('/');
- if (splittedURL.length === 4) {
+ if (splittedURL.length === 7) {
+ // URL /OCPPxx/TENANTID/TOKEN/CHARGEBOXID/SITEID/SITEAREAID/COMPANYID
+ this.tenantID = splittedURL[1];
+ this.token = splittedURL[2];
+ this.chargingStationID = splittedURL[3];
+ this.siteID = splittedURL[4];
+ this.siteAreaID = splittedURL[5];
+ this.companyID = splittedURL[6];
+ } else if (splittedURL.length === 4) {
// URL /OCPPxx/TENANTID/TOKEN/CHARGEBOXID
this.tenantID = splittedURL[1];
this.token = splittedURL[2];

Populating siteID, siteAreaID and CompanyID from URL in WSConnection.