} catch (error) {
// Log
logger.error(
- `${this.logPrefix()} Incoming OCPP '${
+ `${this.logPrefix()} Incoming OCPP command '${
commandName ?? requestCommandName ?? null
}' message '${data.toString()}' matching cached request '${JSON.stringify(
this.requests.get(messageId)
);
if (!(error instanceof OCPPError)) {
logger.warn(
- `${this.logPrefix()} Error thrown at incoming OCPP '${
+ `${this.logPrefix()} Error thrown at incoming OCPP command '${
commandName ?? requestCommandName ?? null
}' message '${data.toString()}' handling is not an OCPPError:`,
error
import type ChargingStation from './ChargingStation';
import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils';
+const moduleName = 'ChargingStationUtils';
+
export class ChargingStationUtils {
private constructor() {
// This is intentional
limit: number;
matchingChargingProfile: ChargingProfile;
} | null {
+ const debugLogMsg = `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Matching charging profile found for power limitation: %j`;
for (const chargingProfile of chargingProfiles) {
// Set helpers
const currentMoment = moment();
limit: schedulePeriod.limit,
matchingChargingProfile: chargingProfile,
};
- logger.debug(
- `${logPrefix} Matching charging profile found for power limitation: %j`,
- result
- );
+ logger.debug(debugLogMsg, result);
return result;
}
// Find the right schedule period
limit: lastButOneSchedule.limit,
matchingChargingProfile: chargingProfile,
};
- logger.debug(
- `${logPrefix} Matching charging profile found for power limitation: %j`,
- result
- );
+ logger.debug(debugLogMsg, result);
return result;
}
// Keep it
limit: lastButOneSchedule.limit,
matchingChargingProfile: chargingProfile,
};
- logger.debug(
- `${logPrefix} Matching charging profile found for power limitation: %j`,
- result
- );
+ logger.debug(debugLogMsg, result);
return result;
}
}
const transactionConnectorId = commandPayload.connectorId;
const connectorStatus = chargingStation.getConnectorStatus(transactionConnectorId);
if (transactionConnectorId) {
+ const remoteStartTransactionLogMsg =
+ chargingStation.logPrefix() +
+ ' Transaction remotely STARTED on ' +
+ chargingStation.stationInfo.chargingStationId +
+ '#' +
+ transactionConnectorId.toString() +
+ " for idTag '" +
+ commandPayload.idTag +
+ "'";
await chargingStation.ocppRequestService.requestHandler<
OCPP16StatusNotificationRequest,
OCPP16StatusNotificationResponse
})
).idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED
) {
- logger.debug(
- chargingStation.logPrefix() +
- ' Transaction remotely STARTED on ' +
- chargingStation.stationInfo.chargingStationId +
- '#' +
- transactionConnectorId.toString() +
- " for idTag '" +
- commandPayload.idTag +
- "'"
- );
+ logger.debug(remoteStartTransactionLogMsg);
return Constants.OCPP_RESPONSE_ACCEPTED;
}
return this.notifyRemoteStartTransactionRejected(
})
).idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED
) {
- logger.debug(
- chargingStation.logPrefix() +
- ' Transaction remotely STARTED on ' +
- chargingStation.stationInfo.chargingStationId +
- '#' +
- transactionConnectorId.toString() +
- " for idTag '" +
- commandPayload.idTag +
- "'"
- );
+ logger.debug(remoteStartTransactionLogMsg);
return Constants.OCPP_RESPONSE_ACCEPTED;
}
return this.notifyRemoteStartTransactionRejected(
chargingStation.logPrefix() +
' Remote starting transaction REJECTED on connector Id ' +
connectorId.toString() +
- ', idTag ' +
+ ", idTag '" +
idTag +
- ', availability ' +
+ "', availability '" +
chargingStation.getConnectorStatus(connectorId).availability +
- ', status ' +
- chargingStation.getConnectorStatus(connectorId).status
+ "', status '" +
+ chargingStation.getConnectorStatus(connectorId).status +
+ "'"
);
return Constants.OCPP_RESPONSE_REJECTED;
}