handleFileException,
isNotEmptyArray,
isNotEmptyString,
- isNullOrUndefined,
- isUndefined,
logPrefix,
logger,
min,
}
public inUnknownState (): boolean {
- return isNullOrUndefined(this?.bootNotificationResponse?.status)
+ return this?.bootNotificationResponse?.status == null
}
public inPendingState (): boolean {
public getConnectorMaximumAvailablePower (connectorId: number): number {
let connectorAmperageLimitationPowerLimit: number | undefined
if (
- !isNullOrUndefined(this.getAmperageLimitation()) &&
+ this.getAmperageLimitation() != null &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.getAmperageLimitation()! < this.stationInfo.maximumAmperage!
) {
return
} else if (
this.getConnectorStatus(connectorId)?.transactionStarted === true &&
- isNullOrUndefined(this.getConnectorStatus(connectorId)?.transactionId)
+ this.getConnectorStatus(connectorId)?.transactionId == null
) {
logger.error(
`${this.logPrefix()} Trying to start MeterValues on connector id ${connectorId} with no transaction id`
if (!checkChargingStation(this, this.logPrefix())) {
return
}
- if (
- !isNullOrUndefined(this.stationInfo.supervisionUser) &&
- !isNullOrUndefined(this.stationInfo.supervisionPassword)
- ) {
+ if (this.stationInfo.supervisionUser != null && this.stationInfo.supervisionPassword != null) {
options.auth = `${this.stationInfo.supervisionUser}:${this.stationInfo.supervisionPassword}`
}
if (params?.closeOpened === true) {
}
public getAutomaticTransactionGeneratorConfiguration (): AutomaticTransactionGeneratorConfiguration {
- if (isNullOrUndefined(this.automaticTransactionGeneratorConfiguration)) {
+ if (this.automaticTransactionGeneratorConfiguration == null) {
let automaticTransactionGeneratorConfiguration:
| AutomaticTransactionGeneratorConfiguration
| undefined
...automaticTransactionGeneratorConfiguration
}
}
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- return this.automaticTransactionGeneratorConfiguration!
+ return this.automaticTransactionGeneratorConfiguration
}
public getAutomaticTransactionGeneratorStatuses (): Status[] | undefined {
transactionId,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
meterStop: this.getEnergyActiveImportRegisterByTransactionId(transactionId!, true),
- ...(isNullOrUndefined(reason) && { reason })
+ ...(reason != null && { reason })
})
}
connectorId?: number
): boolean {
const reservation = this.getReservationBy('reservationId', reservationId)
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const reservationExists = !isUndefined(reservation) && !hasReservationExpired(reservation!)
+ const reservationExists = reservation !== undefined && !hasReservationExpired(reservation)
if (arguments.length === 1) {
return !reservationExists
} else if (arguments.length > 1) {
- const userReservation = !isUndefined(idTag)
- ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.getReservationBy('idTag', idTag!)
- : undefined
+ const userReservation =
+ idTag !== undefined ? this.getReservationBy('idTag', idTag) : undefined
const userReservationExists =
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- !isUndefined(userReservation) && !hasReservationExpired(userReservation!)
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const notConnectorZero = isUndefined(connectorId) ? true : connectorId! > 0
+ userReservation !== undefined && !hasReservationExpired(userReservation)
+ const notConnectorZero = connectorId === undefined ? true : connectorId > 0
const freeConnectorsAvailable = this.getNumberOfReservableConnectors() > 0
return (
!reservationExists && !userReservationExists && notConnectorZero && freeConnectorsAvailable
this.wsConnection?.send(message, (error?: Error) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
isRequest && PerformanceStatistics.endMeasure(commandName!, beginId!)
- if (isNullOrUndefined(error)) {
+ if (error == null) {
logger.debug(
`${this.logPrefix()} >> Buffered ${getMessageTypeString(
messageType
},
stationTemplate?.firmwareUpgrade ?? {}
)
- stationInfo.resetTime = !isNullOrUndefined(stationTemplate?.resetTime)
- ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- secondsToMilliseconds(stationTemplate.resetTime!)
- : Constants.CHARGING_STATION_DEFAULT_RESET_TIME
+ stationInfo.resetTime =
+ stationTemplate?.resetTime != null
+ ? secondsToMilliseconds(stationTemplate.resetTime)
+ : Constants.CHARGING_STATION_DEFAULT_RESET_TIME
return stationInfo
}
const stationConfiguration = this.getConfigurationFromFile()
if (
stationConfiguration?.stationInfo?.templateHash === stationTemplate?.templateHash &&
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
(stationConfiguration?.connectorsStatus != null || stationConfiguration?.evsesStatus != null)
) {
checkConfiguration(stationConfiguration, this.logPrefix(), this.configurationFile)
.exec(this.stationInfo.firmwareVersion!)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
?.slice(1, patternGroup! + 1)
- if (!isNullOrUndefined(match)) {
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const patchLevelIndex = match!.length - 1
- // prettier-ignore
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- match![patchLevelIndex] = (convertToInt(match![patchLevelIndex]) +
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.stationInfo.firmwareUpgrade!.versionUpgrade!.step!).toString()
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- this.stationInfo.firmwareVersion = match!.join('.')
+ if (match != null) {
+ const patchLevelIndex = match.length - 1
+ match[patchLevelIndex] = (
+ convertToInt(match[patchLevelIndex]) +
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ this.stationInfo.firmwareUpgrade!.versionUpgrade!.step!
+ ).toString()
+ this.stationInfo.firmwareVersion = match.join('.')
}
}
this.saveStationInfo()
}
private initializeOcppConfiguration (): void {
- if (isNullOrUndefined(getConfigurationKey(this, StandardParametersKey.HeartbeatInterval))) {
+ if (getConfigurationKey(this, StandardParametersKey.HeartbeatInterval) == null) {
addConfigurationKey(this, StandardParametersKey.HeartbeatInterval, '0')
}
- if (isNullOrUndefined(getConfigurationKey(this, StandardParametersKey.HeartBeatInterval))) {
+ if (getConfigurationKey(this, StandardParametersKey.HeartBeatInterval) == null) {
addConfigurationKey(this, StandardParametersKey.HeartBeatInterval, '0', { visible: false })
}
if (
this.stationInfo?.supervisionUrlOcppConfiguration === true &&
isNotEmptyString(this.stationInfo?.supervisionUrlOcppKey) &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- isNullOrUndefined(getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!))
+ getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!) == null
) {
addConfigurationKey(
this,
this.stationInfo?.supervisionUrlOcppConfiguration === false &&
isNotEmptyString(this.stationInfo?.supervisionUrlOcppKey) &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- !isNullOrUndefined(getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!))
+ getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!) != null
) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
deleteConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!, { save: false })
if (
isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- isNullOrUndefined(getConfigurationKey(this, this.stationInfo.amperageLimitationOcppKey!))
+ getConfigurationKey(this, this.stationInfo.amperageLimitationOcppKey!) == null
) {
addConfigurationKey(
this,
(this.stationInfo.maximumAmperage! * getAmperageLimitationUnitDivider(this.stationInfo)).toString()
)
}
- if (
- isNullOrUndefined(getConfigurationKey(this, StandardParametersKey.SupportedFeatureProfiles))
- ) {
+ if (getConfigurationKey(this, StandardParametersKey.SupportedFeatureProfiles) == null) {
addConfigurationKey(
this,
StandardParametersKey.SupportedFeatureProfiles,
{ readonly: true },
{ overwrite: true }
)
- if (
- isNullOrUndefined(getConfigurationKey(this, StandardParametersKey.MeterValuesSampledData))
- ) {
+ if (getConfigurationKey(this, StandardParametersKey.MeterValuesSampledData) == null) {
addConfigurationKey(
this,
StandardParametersKey.MeterValuesSampledData,
MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
)
}
- if (
- isNullOrUndefined(getConfigurationKey(this, StandardParametersKey.ConnectorPhaseRotation))
- ) {
+ if (getConfigurationKey(this, StandardParametersKey.ConnectorPhaseRotation) == null) {
const connectorsPhaseRotation: string[] = []
if (this.hasEvses) {
for (const evseStatus of this.evses.values()) {
connectorsPhaseRotation.toString()
)
}
- if (
- isNullOrUndefined(getConfigurationKey(this, StandardParametersKey.AuthorizeRemoteTxRequests))
- ) {
+ if (getConfigurationKey(this, StandardParametersKey.AuthorizeRemoteTxRequests) == null) {
addConfigurationKey(this, StandardParametersKey.AuthorizeRemoteTxRequests, 'true')
}
if (
- isNullOrUndefined(getConfigurationKey(this, StandardParametersKey.LocalAuthListEnabled)) &&
+ getConfigurationKey(this, StandardParametersKey.LocalAuthListEnabled) == null &&
hasFeatureProfile(this, SupportedFeatureProfiles.LocalAuthListManagement) === true
) {
addConfigurationKey(this, StandardParametersKey.LocalAuthListEnabled, 'false')
}
- if (isNullOrUndefined(getConfigurationKey(this, StandardParametersKey.ConnectionTimeOut))) {
+ if (getConfigurationKey(this, StandardParametersKey.ConnectionTimeOut) == null) {
addConfigurationKey(
this,
StandardParametersKey.ConnectionTimeOut,