>(this.chargingStation, RequestCommand.METER_VALUES, {
connectorId,
transactionId,
- meterValue: transactionEndMeterValue,
+ meterValue: [transactionEndMeterValue],
});
}
stopResponse = await this.chargingStation.ocppRequestService.requestHandler<
}
logger.debug(
`${this.logPrefix()} << Command '${
- requestCommandName ?? ''
+ requestCommandName ?? 'unknown'
}' received response payload: ${JSON.stringify(request)}`
);
responseCallback(commandPayload, requestPayload);
}
logger.debug(
`${this.logPrefix()} << Command '${
- requestCommandName ?? ''
+ requestCommandName ?? 'unknown'
}' received error payload: ${JSON.stringify(request)}`
);
errorCallback(new OCPPError(errorType, errorMessage, requestCommandName, errorDetails));
{
connectorId,
transactionId,
- meterValue: transactionEndMeterValue,
+ meterValue: [transactionEndMeterValue],
}
);
}
null,
2
)} while the charging station is in pending state on the central server`,
- commandName
+ commandName,
+ commandPayload
);
}
if (
null,
2
)}`,
- commandName
+ commandName,
+ commandPayload
);
}
} else {
null,
2
)} while the charging station is not registered on the central server.`,
- commandName
+ commandName,
+ commandPayload
);
}
// Send the built response
>(chargingStation, OCPP16RequestCommand.METER_VALUES, {
connectorId,
transactionId,
- meterValue: transactionEndMeterValue,
+ meterValue: [transactionEndMeterValue],
});
}
const stopResponse = await chargingStation.ocppRequestService.requestHandler<
>(chargingStation, OCPP16RequestCommand.METER_VALUES, {
connectorId,
transactionId,
- meterValue: transactionEndMeterValue,
+ meterValue: [transactionEndMeterValue],
});
}
await chargingStation.ocppRequestService.requestHandler<
ErrorType.NOT_SUPPORTED,
`${moduleName}.requestHandler: Unsupported OCPP command ${commandName}`,
commandName,
- { commandName }
+ commandParams
);
}
case OCPP16RequestCommand.HEARTBEAT:
return {} as unknown as Request;
case OCPP16RequestCommand.METER_VALUES:
+ // Sanity check
+ if (!Array.isArray(commandParams?.meterValue)) {
+ throw new OCPPError(
+ ErrorType.TYPERAINT_VIOLATION,
+ `${moduleName}.buildRequestPayload ${commandName}: Invalid array type for meterValue payload field`,
+ commandName,
+ commandParams
+ );
+ }
return {
connectorId: commandParams?.connectorId,
transactionId: commandParams?.transactionId,
- meterValue: Array.isArray(commandParams?.meterValue)
- ? commandParams?.meterValue
- : [commandParams?.meterValue],
+ meterValue: commandParams?.meterValue,
} as unknown as Request;
case OCPP16RequestCommand.STATUS_NOTIFICATION:
return {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`${moduleName}.buildRequestPayload: Unsupported OCPP command: ${commandName}`,
commandName,
- { commandName }
+ commandParams
);
}
}
null,
2
)}`,
- commandName
+ commandName,
+ payload
);
}
} else {
null,
2
)} while the charging station is not registered on the central server. `,
- commandName
+ commandName,
+ payload
);
}
}
>(chargingStation, OCPP16RequestCommand.METER_VALUES, {
connectorId,
transactionId: payload.transactionId,
- meterValue: chargingStation.getConnectorStatus(connectorId).transactionBeginMeterValue,
+ meterValue: [chargingStation.getConnectorStatus(connectorId).transactionBeginMeterValue],
}));
await chargingStation.ocppRequestService.requestHandler<
OCPP16StatusNotificationRequest,
>(chargingStation, OCPP16RequestCommand.METER_VALUES, {
connectorId: transactionConnectorId,
transactionId: requestPayload.transactionId,
- meterValue: OCPP16ServiceUtils.buildTransactionEndMeterValue(
- chargingStation,
- transactionConnectorId,
- requestPayload.meterStop
- ),
+ meterValue: [
+ OCPP16ServiceUtils.buildTransactionEndMeterValue(
+ chargingStation,
+ transactionConnectorId,
+ requestPayload.meterStop
+ ),
+ ],
}));
if (
!chargingStation.isChargingStationAvailable() ||