this.bootNotificationResponse = await this.ocppRequestService.requestHandler<
BootNotificationRequest,
BootNotificationResponse
- >(
- this,
- RequestCommand.BOOT_NOTIFICATION,
- {
- chargePointModel: this.bootNotificationRequest.chargePointModel,
- chargePointVendor: this.bootNotificationRequest.chargePointVendor,
- chargeBoxSerialNumber: this.bootNotificationRequest.chargeBoxSerialNumber,
- firmwareVersion: this.bootNotificationRequest.firmwareVersion,
- chargePointSerialNumber: this.bootNotificationRequest.chargePointSerialNumber,
- iccid: this.bootNotificationRequest.iccid,
- imsi: this.bootNotificationRequest.imsi,
- meterSerialNumber: this.bootNotificationRequest.meterSerialNumber,
- meterType: this.bootNotificationRequest.meterType,
- },
- { skipBufferingOnError: true }
- );
+ >(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, {
+ skipBufferingOnError: true,
+ });
if (!this.isRegistered()) {
this.getRegistrationMaxRetries() !== -1 && registrationRetryCount++;
await Utils.sleep(
await this.ocppRequestService.requestHandler<
BootNotificationRequest,
BootNotificationResponse
- >(
- this,
- RequestCommand.BOOT_NOTIFICATION,
- {
- chargePointModel: this.bootNotificationRequest.chargePointModel,
- chargePointVendor: this.bootNotificationRequest.chargePointVendor,
- chargeBoxSerialNumber: this.bootNotificationRequest.chargeBoxSerialNumber,
- firmwareVersion: this.bootNotificationRequest.firmwareVersion,
- chargePointSerialNumber: this.bootNotificationRequest.chargePointSerialNumber,
- iccid: this.bootNotificationRequest.iccid,
- imsi: this.bootNotificationRequest.imsi,
- meterSerialNumber: this.bootNotificationRequest.meterSerialNumber,
- meterType: this.bootNotificationRequest.meterType,
- },
- { skipBufferingOnError: true }
- );
+ >(this, RequestCommand.BOOT_NOTIFICATION, this.bootNotificationRequest, {
+ skipBufferingOnError: true,
+ });
}
// Start WebSocket ping
this.startWebSocketPing();
import type OCPPError from '../exception/OCPPError';
import { StandardParametersKey } from '../types/ocpp/Configuration';
import {
- HeartbeatRequest,
- MeterValuesRequest,
+ type BootNotificationRequest,
+ type HeartbeatRequest,
+ type MeterValuesRequest,
RequestCommand,
type StatusNotificationRequest,
} from '../types/ocpp/Requests';
-import type {
- HeartbeatResponse,
- MeterValuesResponse,
- StatusNotificationResponse,
+import {
+ type BootNotificationResponse,
+ type HeartbeatResponse,
+ type MeterValuesResponse,
+ RegistrationStatus,
+ type StatusNotificationResponse,
} from '../types/ocpp/Responses';
import {
AuthorizationStatus,
- AuthorizeRequest,
- AuthorizeResponse,
- StartTransactionRequest,
- StartTransactionResponse,
- StopTransactionRequest,
- StopTransactionResponse,
+ type AuthorizeRequest,
+ type AuthorizeResponse,
+ type StartTransactionRequest,
+ type StartTransactionResponse,
+ type StopTransactionRequest,
+ type StopTransactionResponse,
} from '../types/ocpp/Transaction';
import {
BroadcastChannelProcedureName,
- BroadcastChannelRequest,
- BroadcastChannelRequestPayload,
- BroadcastChannelResponsePayload,
- MessageEvent,
+ type BroadcastChannelRequest,
+ type BroadcastChannelRequestPayload,
+ type BroadcastChannelResponsePayload,
+ type MessageEvent,
} from '../types/WorkerBroadcastChannel';
import { ResponseStatus } from '../ui/web/src/types/UIProtocol';
import Constants from '../utils/Constants';
| StartTransactionResponse
| StopTransactionResponse
| AuthorizeResponse
+ | BootNotificationResponse
| StatusNotificationResponse
| HeartbeatResponse
| MeterValuesResponse;
StopTransactionRequest,
StartTransactionResponse
>(this.chargingStation, RequestCommand.STOP_TRANSACTION, {
- ...requestPayload,
meterStop:
requestPayload.meterStop ??
this.chargingStation.getEnergyActiveImportRegisterByTransactionId(
requestPayload.transactionId,
true
),
+ ...requestPayload,
}),
],
[
AuthorizeResponse
>(this.chargingStation, RequestCommand.AUTHORIZE, requestPayload),
],
+ [
+ BroadcastChannelProcedureName.BOOT_NOTIFICATION,
+ async (requestPayload?: BroadcastChannelRequestPayload) => {
+ this.chargingStation.bootNotificationResponse =
+ await this.chargingStation.ocppRequestService.requestHandler<
+ BootNotificationRequest,
+ BootNotificationResponse
+ >(
+ this.chargingStation,
+ RequestCommand.BOOT_NOTIFICATION,
+ {
+ ...this.chargingStation.bootNotificationRequest,
+ ...requestPayload,
+ },
+ {
+ skipBufferingOnError: true,
+ }
+ );
+ return this.chargingStation.bootNotificationResponse;
+ },
+ ],
[
BroadcastChannelProcedureName.STATUS_NOTIFICATION,
async (requestPayload?: BroadcastChannelRequestPayload) =>
MeterValuesRequest,
MeterValuesResponse
>(this.chargingStation, RequestCommand.METER_VALUES, {
- ...requestPayload,
- meterValue: requestPayload.meterValue ?? [
+ meterValue: [
OCPP16ServiceUtils.buildMeterValue(
this.chargingStation,
requestPayload.connectorId,
: Constants.DEFAULT_METER_VALUES_INTERVAL
),
],
+ ...requestPayload,
});
},
],
return ResponseStatus.SUCCESS;
}
return ResponseStatus.FAILURE;
+ case BroadcastChannelProcedureName.BOOT_NOTIFICATION:
+ if (commandResponse?.status === RegistrationStatus.ACCEPTED) {
+ return ResponseStatus.SUCCESS;
+ }
+ return ResponseStatus.FAILURE;
case BroadcastChannelProcedureName.STATUS_NOTIFICATION:
case BroadcastChannelProcedureName.METER_VALUES:
if (Utils.isEmptyObject(commandResponse) === true) {
-import { ResponsePayload, ResponseStatus } from '../types/UIProtocol';
+import { type ResponsePayload, ResponseStatus } from '../types/UIProtocol';
import type {
BroadcastChannelResponse,
BroadcastChannelResponsePayload,
.requestHandler<OCPP16BootNotificationRequest, OCPP16BootNotificationResponse>(
chargingStation,
OCPP16RequestCommand.BOOT_NOTIFICATION,
- {
- chargePointModel: chargingStation.bootNotificationRequest.chargePointModel,
- chargePointVendor: chargingStation.bootNotificationRequest.chargePointVendor,
- chargeBoxSerialNumber:
- chargingStation.bootNotificationRequest.chargeBoxSerialNumber,
- firmwareVersion: chargingStation.bootNotificationRequest.firmwareVersion,
- chargePointSerialNumber:
- chargingStation.bootNotificationRequest.chargePointSerialNumber,
- iccid: chargingStation.bootNotificationRequest.iccid,
- imsi: chargingStation.bootNotificationRequest.imsi,
- meterSerialNumber: chargingStation.bootNotificationRequest.meterSerialNumber,
- meterType: chargingStation.bootNotificationRequest.meterType,
- },
+ chargingStation.bootNotificationRequest,
{ skipBufferingOnError: true, triggerMessage: true }
)
- .then((value) => {
- chargingStation.bootNotificationResponse = value;
+ .then((response) => {
+ chargingStation.bootNotificationResponse = response;
})
.catch(() => {
/* This is intentional */
[ProcedureName.START_TRANSACTION]: BroadcastChannelProcedureName.START_TRANSACTION,
[ProcedureName.STOP_TRANSACTION]: BroadcastChannelProcedureName.STOP_TRANSACTION,
[ProcedureName.AUTHORIZE]: BroadcastChannelProcedureName.AUTHORIZE,
+ [ProcedureName.BOOT_NOTIFICATION]: BroadcastChannelProcedureName.BOOT_NOTIFICATION,
[ProcedureName.STATUS_NOTIFICATION]: BroadcastChannelProcedureName.STATUS_NOTIFICATION,
[ProcedureName.HEARTBEAT]: BroadcastChannelProcedureName.HEARTBEAT,
[ProcedureName.METER_VALUES]: BroadcastChannelProcedureName.METER_VALUES,
ProcedureName.AUTHORIZE,
this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
);
+ this.requestHandlers.set(
+ ProcedureName.BOOT_NOTIFICATION,
+ this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
+ );
this.requestHandlers.set(
ProcedureName.STATUS_NOTIFICATION,
this.handleProtocolRequest.bind(this) as ProtocolRequestHandler
START_TRANSACTION = 'startTransaction',
STOP_TRANSACTION = 'stopTransaction',
AUTHORIZE = 'authorize',
+ BOOT_NOTIFICATION = 'bootNotification',
STATUS_NOTIFICATION = 'statusNotification',
HEARTBEAT = 'heartbeat',
METER_VALUES = 'meterValues',
START_TRANSACTION = 'startTransaction',
STOP_TRANSACTION = 'stopTransaction',
AUTHORIZE = 'authorize',
+ BOOT_NOTIFICATION = 'bootNotification',
STATUS_NOTIFICATION = 'statusNotification',
HEARTBEAT = 'heartbeat',
METER_VALUES = 'meterValues',