} from '../../../types/index.js'
import {
Configuration,
- Constants,
convertToDate,
convertToInt,
formatDurationMilliSeconds,
): Promise<OCPP16ChangeAvailabilityResponse> {
const { connectorId, type } = commandPayload
if (!chargingStation.hasConnector(connectorId)) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestChangeAvailability: Trying to change the availability of a non existing connector id ${connectorId.toString()}`
)
return OCPP16Constants.OCPP_AVAILABILITY_RESPONSE_REJECTED
const { connectorId } = commandPayload
if (connectorId != null) {
if (!chargingStation.hasConnector(connectorId)) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestClearChargingProfile: Trying to clear a charging profile(s) to a non existing connector id ${connectorId.toString()}`
)
return OCPP16Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN
}
const { chargingRateUnit, connectorId, duration } = commandPayload
if (!chargingStation.hasConnector(connectorId)) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestGetCompositeSchedule: Trying to get composite schedule to a non existing connector id ${connectorId.toString()}`
)
return OCPP16Constants.OCPP_RESPONSE_REJECTED
}
if (connectorId === 0) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestGetCompositeSchedule: Get composite schedule on connector id ${connectorId.toString()} is not yet supported`
)
return OCPP16Constants.OCPP_RESPONSE_REJECTED
)!
}
} else {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestGetDiagnostics: Unsupported protocol ${
uri.protocol
} to transfer the diagnostic logs archive`
commandPayload.expiryDate = convertToDate(commandPayload.expiryDate)!
const { connectorId, idTag, reservationId } = commandPayload
if (!chargingStation.hasConnector(connectorId)) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestReserveNow: Trying to reserve a non existing connector id ${connectorId.toString()}`
)
return OCPP16Constants.OCPP_RESERVATION_RESPONSE_REJECTED
commandPayload: ResetRequest
): GenericResponse {
const { type } = commandPayload
- chargingStation
- .reset(`${type}Reset` as OCPP16StopTransactionReason)
- .catch(Constants.EMPTY_FUNCTION)
+ chargingStation.reset(`${type}Reset` as OCPP16StopTransactionReason).catch((error: unknown) => {
+ logger.error(
+ `${chargingStation.logPrefix()} ${moduleName}.handleRequestReset: Reset error:`,
+ error
+ )
+ })
logger.info(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestReset: ${type} reset request received, simulating it. The station will be back online in ${formatDurationMilliSeconds(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
}
const { connectorId, csChargingProfiles } = commandPayload
if (!chargingStation.hasConnector(connectorId)) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestSetChargingProfile: Trying to set charging profile(s) to a non existing connector id ${connectorId.toString()}`
)
return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED
csChargingProfiles.chargingProfilePurpose === OCPP16ChargingProfilePurposeType.TX_PROFILE &&
connectorId === 0
) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestSetChargingProfile: Trying to set transaction charging profile(s) on connector ${connectorId.toString()}`
)
return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED
connectorId > 0 &&
connectorStatus?.transactionStarted === false
) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestSetChargingProfile: Trying to set transaction charging profile(s) on connector ${connectorId.toString()} without a started transaction`
)
return OCPP16Constants.OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED
csChargingProfiles.transactionId != null &&
csChargingProfiles.transactionId !== connectorStatus.transactionId
) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestSetChargingProfile: Trying to set transaction charging profile(s) on connector ${connectorId.toString()} with a different transaction id ${
csChargingProfiles.transactionId.toString()
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
): Promise<UnlockConnectorResponse> {
const { connectorId } = commandPayload
if (!chargingStation.hasConnector(connectorId)) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestUnlockConnector: Trying to unlock a non existing connector id ${connectorId.toString()}`
)
return OCPP16Constants.OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED
}
if (connectorId === 0) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestUnlockConnector: Trying to unlock connector id ${connectorId.toString()}`
)
return OCPP16Constants.OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED
}
const now = Date.now()
if (retrieveDate.getTime() <= now) {
- this.updateFirmwareSimulation(chargingStation).catch(Constants.EMPTY_FUNCTION)
+ this.updateFirmwareSimulation(chargingStation).catch((error: unknown) => {
+ logger.error(
+ `${chargingStation.logPrefix()} ${moduleName}.handleRequestUpdateFirmware: Firmware update simulation error:`,
+ error
+ )
+ })
} else {
setTimeout(() => {
- this.updateFirmwareSimulation(chargingStation).catch(Constants.EMPTY_FUNCTION)
+ this.updateFirmwareSimulation(chargingStation).catch((error: unknown) => {
+ logger.error(
+ `${chargingStation.logPrefix()} ${moduleName}.handleRequestUpdateFirmware: Firmware update simulation error:`,
+ error
+ )
+ })
}, retrieveDate.getTime() - now)
}
return OCPP16Constants.OCPP_RESPONSE_EMPTY
)
}
} else {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseAuthorize: idTag '${
requestPayload.idTag
}' has no authorize request pending`
: logger.info(logMsg)
} else {
delete chargingStation.bootNotificationResponse
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseBootNotification: Charging station boot notification response received: %j with undefined registration status`,
payload
)
): Promise<void> {
const { connectorId } = requestPayload
if (connectorId === 0 || !chargingStation.hasConnector(connectorId)) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStartTransaction: Trying to start a transaction on a non existing connector id ${connectorId.toString()}`
)
return
chargingStation.hasIdTags() &&
connectorStatus.idTagLocalAuthorized === false
) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStartTransaction: Trying to start a transaction with a not local authorized idTag ${
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
connectorStatus.localAuthorizeIdTag
connectorStatus.idTagLocalAuthorized === false &&
connectorStatus.idTagAuthorized === false
) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStartTransaction: Trying to start a transaction with a not authorized idTag ${
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
connectorStatus.authorizeIdTag
connectorStatus.authorizeIdTag != null &&
connectorStatus.authorizeIdTag !== requestPayload.idTag
) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStartTransaction: Trying to start a transaction with an idTag ${
requestPayload.idTag
} different from the authorize request one ${
connectorStatus.localAuthorizeIdTag != null &&
connectorStatus.localAuthorizeIdTag !== requestPayload.idTag
) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStartTransaction: Trying to start a transaction with an idTag ${
requestPayload.idTag
} different from the local authorized one ${
return
}
if (connectorStatus?.transactionStarted === true) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStartTransaction: Trying to start a transaction on an already used connector id ${connectorId.toString()} by idTag ${
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
connectorStatus.transactionIdTag
if (evseStatus.connectors.size > 1) {
for (const [id, status] of evseStatus.connectors) {
if (id !== connectorId && status.transactionStarted === true) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStartTransaction: Trying to start a transaction on an already used evse id ${evseId.toString()} by connector id ${id.toString()} with idTag ${
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
status.transactionIdTag
connectorStatus?.status !== OCPP16ChargePointStatus.Available &&
connectorStatus?.status !== OCPP16ChargePointStatus.Preparing
) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStartTransaction: Trying to start a transaction on connector id ${connectorId.toString()} with status ${
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
connectorStatus?.status
requestPayload.transactionId
)
if (transactionConnectorId == null) {
- logger.error(
+ logger.warn(
`${chargingStation.logPrefix()} ${moduleName}.handleResponseStopTransaction: Trying to stop a non existing transaction with id ${requestPayload.transactionId.toString()}`
)
return