Remove the car ID from the OCPP args
MODIFY
src/migration/tasks/SetDefaultTagToUserTask.ts
src/migration/tasks/SetDefaultTagToUserTask.ts
@@ -5,7 +5,6 @@ import { ServerAction } from '../../types/Server';
import Tenant from '../../types/Tenant';
import TenantStorage from '../../storage/mongodb/TenantStorage';
import UserStorage from '../../storage/mongodb/UserStorage';
-import global from '../../types/GlobalType';
const MODULE_NAME = 'SetDefaultTagToUserTask';

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1022,10 +1022,17 @@ export default class ChargingStationService {
// Ok: Execute it
result = await this.handleChargingStationCommand(
req.user.tenantID, req.user, chargingStation, action, command, filteredRequest.args);
+ console.log('filteredRequest ====================================');
+ console.log(filteredRequest);
+ console.log('====================================');
if (user && result && result.status === OCPPRemoteStartStopStatus.ACCEPTED) {
- if (filteredRequest.args.carID !== user.lastSelectedCarID) {
- user.lastSelectedCarID = filteredRequest.args.carID;
+ if (filteredRequest.carID !== user.lastSelectedCarID) {
+ user.lastSelectedCarID = filteredRequest.carID;
await UserStorage.saveUser(req.user.tenantID, user);
+ console.log('====================================');
+ console.log('SAVE USER');
+ console.log(user.id);
+ console.log('====================================');
}
}
} else if (command === Command.GET_COMPOSITE_SCHEDULE) {

MODIFY
src/server/rest/v1/service/security/ChargingStationSecurity.ts
src/server/rest/v1/service/security/ChargingStationSecurity.ts
@@ -172,6 +172,9 @@ export default class ChargingStationSecurity {
const filteredRequest: HttpChargingStationCommandRequest = {} as HttpChargingStationCommandRequest;
// Check
filteredRequest.chargeBoxID = sanitize(request.chargeBoxID);
+ if (Utils.objectHasProperty(request, 'carID')) {
+ filteredRequest.carID = sanitize(request.carID);
+ }
// Do not check action?
if (request.args) {
filteredRequest.args = {};
@@ -206,9 +209,6 @@ export default class ChargingStationSecurity {
if (Utils.objectHasProperty(request.args, 'tagID')) {
filteredRequest.args.tagID = sanitize(request.args.tagID);
}
- if (Utils.objectHasProperty(request.args, 'carID')) {
- filteredRequest.args.carID = sanitize(request.args.carID);
- }
if (Utils.objectHasProperty(request.args, 'location')) {
filteredRequest.args.location = sanitize(request.args.location);
}

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
@@ -74,6 +74,7 @@ export interface HttpChargingStationSetMaxIntensitySocketRequest extends HttpCha
export interface HttpChargingStationCommandRequest {
chargeBoxID: string;
+ carID?: string;
args?: any;
}

Remove the car ID from the OCPP args