- this.chargingStation.addConfigurationKey(OCPP16StandardParametersKey.HeartBeatInterval, payload.interval.toString());
- this.chargingStation.addConfigurationKey(OCPP16StandardParametersKey.HeartbeatInterval, payload.interval.toString(), false, false);
- this.chargingStation.heartbeatSetInterval ? this.chargingStation.restartHeartbeat() : this.chargingStation.startHeartbeat();
- } else if (payload.status === OCPP16RegistrationStatus.PENDING) {
- logger.info(this.chargingStation.logPrefix() + ' Charging station in pending state on the central server');
+ this.chargingStation.addConfigurationKey(
+ OCPP16StandardParametersKey.HeartbeatInterval,
+ payload.interval.toString(),
+ {},
+ { overwrite: true, save: true }
+ );
+ this.chargingStation.addConfigurationKey(
+ OCPP16StandardParametersKey.HeartBeatInterval,
+ payload.interval.toString(),
+ { visible: false },
+ { overwrite: true, save: true }
+ );
+ this.chargingStation.heartbeatSetInterval
+ ? this.chargingStation.restartHeartbeat()
+ : this.chargingStation.startHeartbeat();
+ }
+ if (Object.values(OCPP16RegistrationStatus).includes(payload.status)) {
+ const logMsg = `${this.chargingStation.logPrefix()} Charging station in '${
+ payload.status
+ }' state on the central server`;
+ payload.status === OCPP16RegistrationStatus.REJECTED
+ ? logger.warn(logMsg)
+ : logger.info(logMsg);
+ } else {
+ logger.error(
+ this.chargingStation.logPrefix() +
+ ' Charging station boot notification response received: %j with undefined registration status',
+ payload
+ );
+ }
+ }
+
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
+ private handleResponseHeartbeat(): void {}
+
+ private handleResponseAuthorize(
+ payload: OCPP16AuthorizeResponse,
+ requestPayload: OCPP16AuthorizeRequest
+ ): void {
+ let authorizeConnectorId: number;
+ for (const connectorId of this.chargingStation.connectors.keys()) {
+ if (
+ connectorId > 0 &&
+ this.chargingStation.getConnectorStatus(connectorId)?.authorizeIdTag ===
+ requestPayload.idTag
+ ) {
+ authorizeConnectorId = connectorId;
+ break;
+ }
+ }
+ if (payload.idTagInfo.status === OCPP16AuthorizationStatus.ACCEPTED) {
+ this.chargingStation.getConnectorStatus(authorizeConnectorId).idTagAuthorized = true;
+ logger.debug(
+ `${this.chargingStation.logPrefix()} IdTag ${
+ requestPayload.idTag
+ } authorized on connector ${authorizeConnectorId}`
+ );