.husky
.editorconfig
.vscode
+*.code-workspace
.clinic
*.clinic-*
.tscache
*tags-template.*
*config-template.*
*cf-template.*
+manifest-*.yml
*.tar.gz
*.mta
rollup.config.js
rollup.config.mjs
+mikro-orm.config.ts
mta.yaml
mta_archives
docker
public getEnergyActiveImportRegisterByTransactionId(
transactionId: number,
- meterStop = false
+ rounded = false
): number {
return this.getEnergyActiveImportRegister(
this.getConnectorStatus(this.getConnectorIdByTransactionId(transactionId)),
- meterStop
+ rounded
);
}
- public getEnergyActiveImportRegisterByConnectorId(connectorId: number): number {
- return this.getEnergyActiveImportRegister(this.getConnectorStatus(connectorId));
+ public getEnergyActiveImportRegisterByConnectorId(connectorId: number, rounded = false): number {
+ return this.getEnergyActiveImportRegister(this.getConnectorStatus(connectorId), rounded);
}
public getAuthorizeRemoteTxRequests(): boolean {
logger.error(this.logPrefix() + ' WebSocket error:', error);
}
- private getEnergyActiveImportRegister(
- connectorStatus: ConnectorStatus,
- meterStop = false
- ): number {
+ private getEnergyActiveImportRegister(connectorStatus: ConnectorStatus, rounded = false): number {
if (this.getMeteringPerTransaction() === true) {
return (
- (meterStop === true
+ (rounded === true
? Math.round(connectorStatus?.transactionEnergyActiveImportRegisterValue)
: connectorStatus?.transactionEnergyActiveImportRegisterValue) ?? 0
);
}
return (
- (meterStop === true
+ (rounded === true
? Math.round(connectorStatus?.energyActiveImportRegisterValue)
: connectorStatus?.energyActiveImportRegisterValue) ?? 0
);
params?: RequestParams
): Promise<ResponseType> {
if (OCPP16ServiceUtils.isRequestCommandSupported(chargingStation, commandName) === true) {
- const requestPayload = this.buildRequestPayload<RequestType>(
- chargingStation,
- commandName,
- commandParams
- );
return (await this.sendMessage(
chargingStation,
Utils.generateUUID(),
- requestPayload,
+ this.buildRequestPayload<RequestType>(chargingStation, commandName, commandParams),
commandName,
params
)) as unknown as ResponseType;
return {
idTag: Constants.DEFAULT_IDTAG,
meterStart: chargingStation.getEnergyActiveImportRegisterByConnectorId(
- commandParams?.connectorId as number
+ commandParams?.connectorId as number,
+ true
),
timestamp: new Date(),
...commandParams,
params?: RequestParams
): Promise<ResponseType> {
if (OCPP20ServiceUtils.isRequestCommandSupported(chargingStation, commandName) === true) {
- const requestPayload = this.buildRequestPayload<RequestType>(
- chargingStation,
- commandName,
- commandParams
- );
return (await this.sendMessage(
chargingStation,
Utils.generateUUID(),
- requestPayload,
+ this.buildRequestPayload<RequestType>(chargingStation, commandName, commandParams),
commandName,
params
)) as unknown as ResponseType;
const beginId = PerformanceStatistics.beginMeasure(commandName as string);
try {
chargingStation.wsConnection.send(messageToSend);
+ logger.debug(
+ `${chargingStation.logPrefix()} >> Command '${commandName}' sent ${this.getMessageTypeString(
+ messageType
+ )} payload: ${messageToSend}`
+ );
} catch (error) {
+ logger.error(
+ `${chargingStation.logPrefix()} >> Command '${commandName}' failed to send ${this.getMessageTypeString(
+ messageType
+ )} payload: ${messageToSend}:`,
+ error
+ );
sendError = true;
}
PerformanceStatistics.endMeasure(commandName as string, beginId);
- logger.debug(
- `${chargingStation.logPrefix()} >> Command '${commandName}' sent ${this.getMessageTypeString(
- messageType
- )} payload: ${messageToSend}`
- );
}
const wsClosedOrErrored =
chargingStation.isWebSocketConnectionOpened() === false || sendError === true;