OCPP ReserveNow
MODIFY
src/client/ocpp/ChargingStationClient.ts
src/client/ocpp/ChargingStationClient.ts
-import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPDataTransferCommandParam, OCPPDataTransferCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../types/ocpp/OCPPClient';
+import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPDataTransferCommandParam, OCPPDataTransferCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPReserveNowCommandParam, OCPPReserveNowCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../types/ocpp/OCPPClient';
export default abstract class ChargingStationClient {
public abstract reset(params: OCPPResetCommandParam): Promise<OCPPResetCommandResult>;
@@ -28,4 +28,6 @@ export default abstract class ChargingStationClient {
public abstract getDiagnostics(params: OCPPGetDiagnosticsCommandParam): Promise<OCPPGetDiagnosticsCommandResult>;
public abstract updateFirmware(params: OCPPUpdateFirmwareCommandParam): Promise<void>;
+
+ public abstract reserveNow(params: OCPPReserveNowCommandParam): Promise<OCPPReserveNowCommandResult>;
}

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1231,6 +1231,12 @@ export default class ChargingStationService {
result = await ChargingStationService.executeChargingStationCommand(
req.tenant, req.user, chargingStation, action, command, filteredRequest.args);
break;
+ // Reserve Now
+ case Command.RESERVE_NOW:
+ filteredRequest = ChargingStationValidator.getInstance().validateChargingStationActionReserveNowReq(req.body);
+ result = await ChargingStationService.executeChargingStationCommand(
+ req.tenant, req.user, chargingStation, action, command, filteredRequest.args);
+ break;
// Reset
case Command.RESET:
filteredRequest = ChargingStationValidator.getInstance().validateChargingStationActionResetReq(req.body);
@@ -1675,6 +1681,9 @@ export default class ChargingStationService {
case Command.DATA_TRANSFER:
result = await chargingStationClient.dataTransfer(params);
break;
+ case Command.RESERVE_NOW:
+ // TBC result = await ?
+ break;
}
if (result) {
// OCPP Command with status

MODIFY
src/types/ChargingStation.ts
src/types/ChargingStation.ts
@@ -133,6 +133,7 @@ export enum Command {
STOP_TRANSACTION = 'StopTransaction',
METER_VALUES = 'MeterValues',
DATA_TRANSFER = 'DataTransfer',
+ RESERVE_NOW = 'ReserveNow',
}
export enum StaticLimitAmps {

MODIFY
src/types/ocpp/OCPPClient.ts
src/types/ocpp/OCPPClient.ts
@@ -208,3 +208,23 @@ export interface OCPPUpdateFirmwareCommandParam extends OCPPCommandParam {
retrieveDate: Date;
retryInterval?: number;
}
+
+export interface OCPPReserveNowCommandParam extends OCPPCommandParam {
+ connectorId: string;
+ expiryDate: Date;
+ idTag: string;
+ parentIdTag?: string;
+ reservationId: string;
+}
+
+export enum OCPPReserveNowStatus {
+ ACCEPTED = 'Accepted',
+ FAULTED = 'Faulted',
+ OCCUPIED = 'Occupied',
+ REJECTED = 'Rejected',
+ UNAVAILABLE = 'Unavailable'
+}
+
+export interface OCPPReserveNowCommandResult {
+ status: OCPPReserveNowStatus;
+}

OCPP ReserveNow