public startHeartbeat(): void {
if (this.getHeartbeatInterval() && this.getHeartbeatInterval() > 0 && !this.heartbeatSetInterval) {
- this.heartbeatSetInterval = setInterval(async () => {
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
+ this.heartbeatSetInterval = setInterval(async (): Promise<void> => {
await this.ocppRequestService.sendHeartbeat();
}, this.getHeartbeatInterval());
logger.info(this.logPrefix() + ' Heartbeat started every ' + Utils.milliSecondsToHHMMSS(this.getHeartbeatInterval()));
return;
}
if (interval > 0) {
- this.getConnector(connectorId).transactionSetInterval = setInterval(async () => {
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
+ this.getConnector(connectorId).transactionSetInterval = setInterval(async (): Promise<void> => {
if (this.getEnableStatistics()) {
const sendMeterValues = performance.timerify(this.ocppRequestService.sendMeterValues);
this.performanceObserver.observe({
}
private startStationTemplateFileMonitoring(): void {
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
fs.watch(this.stationTemplateFile).on('change', async (e): Promise<void> => {
try {
logger.debug(this.logPrefix() + ' Template file ' + this.stationTemplateFile + ' have changed, reload');
// Simulate charging station restart
private handleRequestReset(commandPayload: ResetRequest): DefaultResponse {
- setImmediate(async () => {
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
+ setImmediate(async (): Promise<void> => {
await this.chargingStation.stop(commandPayload.type + 'Reset' as OCPP16StopTransactionReason);
await Utils.sleep(this.chargingStation.stationInfo.resetTime);
- await this.chargingStation.start();
+ this.chargingStation.start();
});
logger.info(`${this.chargingStation.logPrefix()} ${commandPayload.type} reset command received, simulating it. The station will be back online in ${Utils.milliSecondsToHHMMSS(this.chargingStation.stationInfo.resetTime)}`);
return Constants.OCPP_RESPONSE_ACCEPTED;
return Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED;
}
this.chargingStation.setChargingProfile(commandPayload.connectorId, commandPayload.csChargingProfiles);
+ logger.debug(`${this.chargingStation.logPrefix()} Charging profile set, dump their stack: %j`, this.chargingStation.getConnector(commandPayload.connectorId).chargingProfiles);
return Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED;
}
}
if (commandPayload.connectorId && !Utils.isEmptyArray(this.chargingStation.getConnector(commandPayload.connectorId).chargingProfiles)) {
this.chargingStation.getConnector(commandPayload.connectorId).chargingProfiles = [];
+ logger.debug(`${this.chargingStation.logPrefix()} Charging profiles cleared, dump their stack: %j`, this.chargingStation.getConnector(commandPayload.connectorId).chargingProfiles);
return Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED;
}
if (!commandPayload.connectorId) {
}
if (clearCurrentCP) {
this.chargingStation.getConnector(commandPayload.connectorId).chargingProfiles[index] = {} as OCPP16ChargingProfile;
+ logger.debug(`${this.chargingStation.logPrefix()} Charging profiles cleared, dump their stack: %j`, this.chargingStation.getConnector(commandPayload.connectorId).chargingProfiles);
clearedCP = true;
}
});
this.chargingStation.getConnector(transactionConnectorID).status = OCPP16ChargePointStatus.PREPARING;
if (commandPayload.chargingProfile && commandPayload.chargingProfile.chargingProfilePurpose === ChargingProfilePurposeType.TX_PROFILE) {
this.chargingStation.setChargingProfile(transactionConnectorID, commandPayload.chargingProfile);
+ logger.debug(`${this.chargingStation.logPrefix()} Charging profile set at start transaction, dump their stack: %j`, this.chargingStation.getConnector(transactionConnectorID).chargingProfiles);
} else if (commandPayload.chargingProfile && commandPayload.chargingProfile.chargingProfilePurpose !== ChargingProfilePurposeType.TX_PROFILE) {
return Constants.OCPP_RESPONSE_REJECTED;
}
this.chargingStation.getConnector(transactionConnectorID).status = OCPP16ChargePointStatus.PREPARING;
if (commandPayload.chargingProfile && commandPayload.chargingProfile.chargingProfilePurpose === ChargingProfilePurposeType.TX_PROFILE) {
this.chargingStation.setChargingProfile(transactionConnectorID, commandPayload.chargingProfile);
+ logger.debug(`${this.chargingStation.logPrefix()} Charging profile set at start transaction, dump their stack: %j`, this.chargingStation.getConnector(commandPayload.connectorId).chargingProfiles);
} else if (commandPayload.chargingProfile && commandPayload.chargingProfile.chargingProfilePurpose !== ChargingProfilePurposeType.TX_PROFILE) {
return Constants.OCPP_RESPONSE_REJECTED;
}