isEmptyArray,
isNotEmptyArray,
isNotEmptyString,
- isNullOrUndefined,
isUndefined,
logger,
sleep
let compositeSchedule: OCPP16ChargingSchedule | undefined
for (const chargingProfile of chargingProfiles) {
if (
- isNullOrUndefined(chargingProfile.chargingSchedule?.startSchedule) &&
+ chargingProfile.chargingSchedule?.startSchedule == null &&
connectorStatus?.transactionStarted === true
) {
logger.debug(
chargingProfile.chargingSchedule.startSchedule = connectorStatus?.transactionStart
}
if (
- !isNullOrUndefined(chargingProfile.chargingSchedule?.startSchedule) &&
+ chargingProfile.chargingSchedule?.startSchedule != null &&
!isDate(chargingProfile.chargingSchedule?.startSchedule)
) {
logger.warn(
)!
}
if (
- !isNullOrUndefined(chargingProfile.chargingSchedule?.startSchedule) &&
- isNullOrUndefined(chargingProfile.chargingSchedule?.duration)
+ chargingProfile.chargingSchedule?.startSchedule != null &&
+ chargingProfile.chargingSchedule?.duration == null
) {
logger.debug(
`${chargingStation.logPrefix()} ${moduleName}.handleRequestGetCompositeSchedule: Charging profile id ${
// OCPP specifies that if duration is not defined, it should be infinite
chargingProfile.chargingSchedule.duration = differenceInSeconds(
maxTime,
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- chargingProfile.chargingSchedule.startSchedule!
+ chargingProfile.chargingSchedule.startSchedule
)
}
if (
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const connectorStatus = chargingStation.getConnectorStatus(connectorId!)
- if (!isNullOrUndefined(connectorId) && isNotEmptyArray(connectorStatus?.chargingProfiles)) {
+ if (connectorId != null && isNotEmptyArray(connectorStatus?.chargingProfiles)) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
connectorStatus!.chargingProfiles = []
logger.debug(
)
return OCPP16Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED
}
- if (isNullOrUndefined(connectorId)) {
+ if (connectorId == null) {
let clearedCP = false
if (chargingStation.hasEvses) {
for (const evseStatus of chargingStation.evses.values()) {
}
let { retrieveDate } = commandPayload
if (
- !isNullOrUndefined(chargingStation.stationInfo.firmwareStatus) &&
+ chargingStation.stationInfo.firmwareStatus != null &&
chargingStation.stationInfo.firmwareStatus !== OCPP16FirmwareStatus.Installed
) {
logger.warn(
return OCPP16Constants.OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED
case OCPP16MessageTrigger.StatusNotification:
setTimeout(() => {
- if (!isNullOrUndefined(connectorId)) {
+ if (connectorId != null) {
chargingStation.ocppRequestService
.requestHandler<OCPP16StatusNotificationRequest, OCPP16StatusNotificationResponse>(
chargingStation,
{
connectorId,
errorCode: OCPP16ChargePointErrorCode.NO_ERROR,
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- status: chargingStation.getConnectorStatus(connectorId!)?.status
+ status: chargingStation.getConnectorStatus(connectorId)?.status
},
{
triggerMessage: true