return this?.wsConnection?.readyState === OPEN;
}
+ public isInUnknownState(): boolean {
+ return Utils.isNullOrUndefined(this?.bootNotificationResponse?.status);
+ }
+
public isInPendingState(): boolean {
return this?.bootNotificationResponse?.status === RegistrationStatus.PENDING;
}
}
public isRegistered(): boolean {
- return this.isInAcceptedState() || this.isInPendingState();
+ return !this.isInUnknownState() && (this.isInAcceptedState() || this.isInPendingState());
}
public isChargingStationAvailable(): boolean {
}): Promise<JsonType | OCPPError | string> {
if (this.chargingStation.isInRejectedState() || (this.chargingStation.isInPendingState() && !params.triggerMessage)) {
throw new OCPPError(ErrorType.SECURITY_ERROR, 'Cannot send command payload if the charging station is not in accepted state', commandName);
- } else if (this.chargingStation.isInAcceptedState() || (this.chargingStation.isInPendingState() && params.triggerMessage)) {
+ } else if ((this.chargingStation.isInUnknownState() && commandName === RequestCommand.BOOT_NOTIFICATION)
+ || this.chargingStation.isInAcceptedState() || (this.chargingStation.isInPendingState() && params.triggerMessage)) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
// Send a message through wsConnection