1 // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved.
3 import type { JSONSchemaType
} from
'ajv';
5 import { type ChargingStation
, ChargingStationConfigurationUtils
} from
'../../../charging-station';
6 import { OCPPError
} from
'../../../exception';
8 type ChangeAvailabilityResponse
,
9 type ChangeConfigurationResponse
,
10 type ClearChargingProfileResponse
,
13 type GetConfigurationResponse
,
14 type GetDiagnosticsResponse
,
17 OCPP16AuthorizationStatus
,
18 type OCPP16AuthorizeRequest
,
19 type OCPP16AuthorizeResponse
,
20 type OCPP16BootNotificationRequest
,
21 type OCPP16BootNotificationResponse
,
22 OCPP16ChargePointErrorCode
,
23 OCPP16ChargePointStatus
,
24 type OCPP16DataTransferResponse
,
25 type OCPP16DiagnosticsStatusNotificationResponse
,
26 type OCPP16FirmwareStatusNotificationResponse
,
27 type OCPP16HeartbeatResponse
,
28 OCPP16IncomingRequestCommand
,
29 type OCPP16MeterValuesRequest
,
30 type OCPP16MeterValuesResponse
,
32 OCPP16StandardParametersKey
,
33 type OCPP16StartTransactionRequest
,
34 type OCPP16StartTransactionResponse
,
35 type OCPP16StatusNotificationRequest
,
36 type OCPP16StatusNotificationResponse
,
37 type OCPP16StopTransactionRequest
,
38 type OCPP16StopTransactionResponse
,
39 type OCPP16TriggerMessageResponse
,
40 type OCPP16UpdateFirmwareResponse
,
42 RegistrationStatusEnumType
,
44 type SetChargingProfileResponse
,
45 type UnlockConnectorResponse
,
46 } from
'../../../types';
47 import { Constants
, Utils
, logger
} from
'../../../utils';
48 import { OCPP16ServiceUtils
, OCPPResponseService
} from
'../internal';
50 const moduleName
= 'OCPP16ResponseService';
52 export class OCPP16ResponseService
extends OCPPResponseService
{
53 public jsonIncomingRequestResponseSchemas
: Map
<
54 OCPP16IncomingRequestCommand
,
55 JSONSchemaType
<JsonObject
>
58 private responseHandlers
: Map
<OCPP16RequestCommand
, ResponseHandler
>;
59 private jsonSchemas
: Map
<OCPP16RequestCommand
, JSONSchemaType
<JsonObject
>>;
61 public constructor() {
62 if (new.target
?.name
=== moduleName
) {
63 throw new TypeError(`Cannot construct ${new.target?.name} instances directly`);
65 super(OCPPVersion
.VERSION_16
);
66 this.responseHandlers
= new Map
<OCPP16RequestCommand
, ResponseHandler
>([
67 [OCPP16RequestCommand
.BOOT_NOTIFICATION
, this.handleResponseBootNotification
.bind(this)],
68 [OCPP16RequestCommand
.HEARTBEAT
, this.emptyResponseHandler
.bind(this)],
69 [OCPP16RequestCommand
.AUTHORIZE
, this.handleResponseAuthorize
.bind(this)],
70 [OCPP16RequestCommand
.START_TRANSACTION
, this.handleResponseStartTransaction
.bind(this)],
71 [OCPP16RequestCommand
.STOP_TRANSACTION
, this.handleResponseStopTransaction
.bind(this)],
72 [OCPP16RequestCommand
.STATUS_NOTIFICATION
, this.emptyResponseHandler
.bind(this)],
73 [OCPP16RequestCommand
.METER_VALUES
, this.emptyResponseHandler
.bind(this)],
74 [OCPP16RequestCommand
.DIAGNOSTICS_STATUS_NOTIFICATION
, this.emptyResponseHandler
.bind(this)],
75 [OCPP16RequestCommand
.DATA_TRANSFER
, this.emptyResponseHandler
.bind(this)],
76 [OCPP16RequestCommand
.FIRMWARE_STATUS_NOTIFICATION
, this.emptyResponseHandler
.bind(this)],
78 this.jsonSchemas
= new Map
<OCPP16RequestCommand
, JSONSchemaType
<JsonObject
>>([
80 OCPP16RequestCommand
.BOOT_NOTIFICATION
,
81 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16BootNotificationResponse
>(
82 '../../../assets/json-schemas/ocpp/1.6/BootNotificationResponse.json',
88 OCPP16RequestCommand
.HEARTBEAT
,
89 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16HeartbeatResponse
>(
90 '../../../assets/json-schemas/ocpp/1.6/HeartbeatResponse.json',
96 OCPP16RequestCommand
.AUTHORIZE
,
97 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16AuthorizeResponse
>(
98 '../../../assets/json-schemas/ocpp/1.6/AuthorizeResponse.json',
104 OCPP16RequestCommand
.START_TRANSACTION
,
105 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16StartTransactionResponse
>(
106 '../../../assets/json-schemas/ocpp/1.6/StartTransactionResponse.json',
112 OCPP16RequestCommand
.STOP_TRANSACTION
,
113 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16StopTransactionResponse
>(
114 '../../../assets/json-schemas/ocpp/1.6/StopTransactionResponse.json',
120 OCPP16RequestCommand
.STATUS_NOTIFICATION
,
121 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16StatusNotificationResponse
>(
122 '../../../assets/json-schemas/ocpp/1.6/StatusNotificationResponse.json',
128 OCPP16RequestCommand
.METER_VALUES
,
129 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16MeterValuesResponse
>(
130 '../../../assets/json-schemas/ocpp/1.6/MeterValuesResponse.json',
136 OCPP16RequestCommand
.DIAGNOSTICS_STATUS_NOTIFICATION
,
137 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16DiagnosticsStatusNotificationResponse
>(
138 '../../../assets/json-schemas/ocpp/1.6/DiagnosticsStatusNotificationResponse.json',
144 OCPP16RequestCommand
.DATA_TRANSFER
,
145 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16DataTransferResponse
>(
146 '../../../assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
152 OCPP16RequestCommand
.FIRMWARE_STATUS_NOTIFICATION
,
153 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16FirmwareStatusNotificationResponse
>(
154 '../../../assets/json-schemas/ocpp/1.6/FirmwareStatusNotificationResponse.json',
160 this.jsonIncomingRequestResponseSchemas
= new Map([
162 OCPP16IncomingRequestCommand
.RESET
,
163 OCPP16ServiceUtils
.parseJsonSchemaFile
<GenericResponse
>(
164 '../../../assets/json-schemas/ocpp/1.6/ResetResponse.json',
170 OCPP16IncomingRequestCommand
.CLEAR_CACHE
,
171 OCPP16ServiceUtils
.parseJsonSchemaFile
<GenericResponse
>(
172 '../../../assets/json-schemas/ocpp/1.6/ClearCacheResponse.json',
178 OCPP16IncomingRequestCommand
.CHANGE_AVAILABILITY
,
179 OCPP16ServiceUtils
.parseJsonSchemaFile
<ChangeAvailabilityResponse
>(
180 '../../../assets/json-schemas/ocpp/1.6/ChangeAvailabilityResponse.json',
186 OCPP16IncomingRequestCommand
.UNLOCK_CONNECTOR
,
187 OCPP16ServiceUtils
.parseJsonSchemaFile
<UnlockConnectorResponse
>(
188 '../../../assets/json-schemas/ocpp/1.6/UnlockConnectorResponse.json',
194 OCPP16IncomingRequestCommand
.GET_CONFIGURATION
,
195 OCPP16ServiceUtils
.parseJsonSchemaFile
<GetConfigurationResponse
>(
196 '../../../assets/json-schemas/ocpp/1.6/GetConfigurationResponse.json',
202 OCPP16IncomingRequestCommand
.CHANGE_CONFIGURATION
,
203 OCPP16ServiceUtils
.parseJsonSchemaFile
<ChangeConfigurationResponse
>(
204 '../../../assets/json-schemas/ocpp/1.6/ChangeConfigurationResponse.json',
210 OCPP16IncomingRequestCommand
.SET_CHARGING_PROFILE
,
211 OCPP16ServiceUtils
.parseJsonSchemaFile
<SetChargingProfileResponse
>(
212 '../../../assets/json-schemas/ocpp/1.6/SetChargingProfileResponse.json',
218 OCPP16IncomingRequestCommand
.CLEAR_CHARGING_PROFILE
,
219 OCPP16ServiceUtils
.parseJsonSchemaFile
<ClearChargingProfileResponse
>(
220 '../../../assets/json-schemas/ocpp/1.6/ClearChargingProfileResponse.json',
226 OCPP16IncomingRequestCommand
.REMOTE_START_TRANSACTION
,
227 OCPP16ServiceUtils
.parseJsonSchemaFile
<GenericResponse
>(
228 '../../../assets/json-schemas/ocpp/1.6/RemoteStartTransactionResponse.json',
234 OCPP16IncomingRequestCommand
.REMOTE_STOP_TRANSACTION
,
235 OCPP16ServiceUtils
.parseJsonSchemaFile
<GenericResponse
>(
236 '../../../assets/json-schemas/ocpp/1.6/RemoteStopTransactionResponse.json',
242 OCPP16IncomingRequestCommand
.GET_DIAGNOSTICS
,
243 OCPP16ServiceUtils
.parseJsonSchemaFile
<GetDiagnosticsResponse
>(
244 '../../../assets/json-schemas/ocpp/1.6/GetDiagnosticsResponse.json',
250 OCPP16IncomingRequestCommand
.TRIGGER_MESSAGE
,
251 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16TriggerMessageResponse
>(
252 '../../../assets/json-schemas/ocpp/1.6/TriggerMessageResponse.json',
258 OCPP16IncomingRequestCommand
.DATA_TRANSFER
,
259 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16DataTransferResponse
>(
260 '../../../assets/json-schemas/ocpp/1.6/DataTransferResponse.json',
266 OCPP16IncomingRequestCommand
.UPDATE_FIRMWARE
,
267 OCPP16ServiceUtils
.parseJsonSchemaFile
<OCPP16UpdateFirmwareResponse
>(
268 '../../../assets/json-schemas/ocpp/1.6/UpdateFirmwareResponse.json',
274 this.validatePayload
.bind(this);
277 public async responseHandler(
278 chargingStation
: ChargingStation
,
279 commandName
: OCPP16RequestCommand
,
281 requestPayload
: JsonType
284 chargingStation
.isRegistered() === true ||
285 commandName
=== OCPP16RequestCommand
.BOOT_NOTIFICATION
288 this.responseHandlers
.has(commandName
) === true &&
289 OCPP16ServiceUtils
.isRequestCommandSupported(chargingStation
, commandName
) === true
292 this.validatePayload(chargingStation
, commandName
, payload
);
293 await this.responseHandlers
.get(commandName
)(chargingStation
, payload
, requestPayload
);
296 `${chargingStation.logPrefix()} ${moduleName}.responseHandler: Handle response error:`,
304 ErrorType
.NOT_IMPLEMENTED
,
305 `${commandName} is not implemented to handle response PDU ${JSON.stringify(
316 ErrorType
.SECURITY_ERROR
,
317 `${commandName} cannot be issued to handle response PDU ${JSON.stringify(
321 )} while the charging station is not registered on the central server.`,
328 private validatePayload(
329 chargingStation
: ChargingStation
,
330 commandName
: OCPP16RequestCommand
,
333 if (this.jsonSchemas
.has(commandName
) === true) {
334 return this.validateResponsePayload(
337 this.jsonSchemas
.get(commandName
),
342 `${chargingStation.logPrefix()} ${moduleName}.validatePayload: No JSON schema found for command '${commandName}' PDU validation`
347 private handleResponseBootNotification(
348 chargingStation
: ChargingStation
,
349 payload
: OCPP16BootNotificationResponse
351 if (payload
.status === RegistrationStatusEnumType
.ACCEPTED
) {
352 ChargingStationConfigurationUtils
.addConfigurationKey(
354 OCPP16StandardParametersKey
.HeartbeatInterval
,
355 payload
.interval
.toString(),
357 { overwrite
: true, save
: true }
359 ChargingStationConfigurationUtils
.addConfigurationKey(
361 OCPP16StandardParametersKey
.HeartBeatInterval
,
362 payload
.interval
.toString(),
364 { overwrite
: true, save
: true }
366 chargingStation
.heartbeatSetInterval
367 ? chargingStation
.restartHeartbeat()
368 : chargingStation
.startHeartbeat();
370 if (Object.values(RegistrationStatusEnumType
).includes(payload
.status)) {
371 const logMsg
= `${chargingStation.logPrefix()} Charging station in '${
373 }' state on the central server`;
374 payload
.status === RegistrationStatusEnumType
.REJECTED
375 ? logger
.warn(logMsg
)
376 : logger
.info(logMsg
);
379 `${chargingStation.logPrefix()} Charging station boot notification response received: %j with undefined registration status`,
385 private handleResponseAuthorize(
386 chargingStation
: ChargingStation
,
387 payload
: OCPP16AuthorizeResponse
,
388 requestPayload
: OCPP16AuthorizeRequest
390 let authorizeConnectorId
: number;
391 for (const connectorId
of chargingStation
.connectors
.keys()) {
394 chargingStation
.getConnectorStatus(connectorId
)?.authorizeIdTag
=== requestPayload
.idTag
396 authorizeConnectorId
= connectorId
;
400 const authorizeConnectorIdDefined
= authorizeConnectorId
!== undefined;
401 if (payload
.idTagInfo
.status === OCPP16AuthorizationStatus
.ACCEPTED
) {
402 authorizeConnectorIdDefined
&&
403 (chargingStation
.getConnectorStatus(authorizeConnectorId
).idTagAuthorized
= true);
405 `${chargingStation.logPrefix()} IdTag '${requestPayload.idTag}' accepted${
406 authorizeConnectorIdDefined ? ` on connector ${authorizeConnectorId}
` : ''
410 if (authorizeConnectorIdDefined
) {
411 chargingStation
.getConnectorStatus(authorizeConnectorId
).idTagAuthorized
= false;
412 delete chargingStation
.getConnectorStatus(authorizeConnectorId
)?.authorizeIdTag
;
415 `${chargingStation.logPrefix()} IdTag '${requestPayload.idTag}' rejected with status '${
416 payload.idTagInfo.status
417 }'${authorizeConnectorIdDefined ? ` on connector ${authorizeConnectorId}` : ''}`
422 private async handleResponseStartTransaction(
423 chargingStation: ChargingStation,
424 payload: OCPP16StartTransactionResponse,
425 requestPayload: OCPP16StartTransactionRequest
427 const connectorId = requestPayload.connectorId;
429 let transactionConnectorId: number;
430 for (const id of chargingStation.connectors.keys()) {
431 if (id > 0 && id === connectorId) {
432 transactionConnectorId = id;
436 if (Utils.isNullOrUndefined(transactionConnectorId)) {
438 `${chargingStation.logPrefix()} Trying to start a transaction on a non existing connector Id ${connectorId.toString()}
`
443 chargingStation.getConnectorStatus(connectorId)?.transactionRemoteStarted === true &&
444 chargingStation.getAuthorizeRemoteTxRequests() === true &&
445 chargingStation.getLocalAuthListEnabled() === true &&
446 chargingStation.hasAuthorizedTags() &&
447 chargingStation.getConnectorStatus(connectorId)?.idTagLocalAuthorized === false
450 `${chargingStation.logPrefix()} Trying to start a transaction
with a not local authorized idTag $
{
451 chargingStation
.getConnectorStatus(connectorId
)?.localAuthorizeIdTag
452 } on connector Id ${connectorId.toString()}
`
454 await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
458 chargingStation.getConnectorStatus(connectorId)?.transactionRemoteStarted === true &&
459 chargingStation.getAuthorizeRemoteTxRequests() === true &&
460 chargingStation.getMustAuthorizeAtRemoteStart() === true &&
461 chargingStation.getConnectorStatus(connectorId)?.idTagLocalAuthorized === false &&
462 chargingStation.getConnectorStatus(connectorId)?.idTagAuthorized === false
465 `${chargingStation.logPrefix()} Trying to start a transaction
with a not authorized idTag $
{
466 chargingStation
.getConnectorStatus(connectorId
)?.authorizeIdTag
467 } on connector Id ${connectorId.toString()}
`
469 await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
473 chargingStation.getConnectorStatus(connectorId)?.idTagAuthorized &&
474 chargingStation.getConnectorStatus(connectorId)?.authorizeIdTag !== requestPayload.idTag
477 `${chargingStation.logPrefix()} Trying to start a transaction
with an idTag $
{
479 } different from the authorize request one $
{
480 chargingStation
.getConnectorStatus(connectorId
)?.authorizeIdTag
481 } on connector Id ${connectorId.toString()}
`
483 await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
487 chargingStation.getConnectorStatus(connectorId)?.idTagLocalAuthorized &&
488 chargingStation.getConnectorStatus(connectorId)?.localAuthorizeIdTag !== requestPayload.idTag
491 `${chargingStation.logPrefix()} Trying to start a transaction
with an idTag $
{
493 } different from the local authorized one $
{
494 chargingStation
.getConnectorStatus(connectorId
)?.localAuthorizeIdTag
495 } on connector Id ${connectorId.toString()}
`
497 await this.resetConnectorOnStartTransactionError(chargingStation, connectorId);
500 if (chargingStation.getConnectorStatus(connectorId)?.transactionStarted === true) {
502 `${chargingStation.logPrefix()} Trying to start a transaction on an already used connector ${connectorId.toString()}
: %j
`,
503 chargingStation.getConnectorStatus(connectorId)
508 chargingStation.getConnectorStatus(connectorId)?.status !==
509 OCPP16ChargePointStatus.AVAILABLE &&
510 chargingStation.getConnectorStatus(connectorId)?.status !== OCPP16ChargePointStatus.PREPARING
513 `${chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()}
with status $
{
514 chargingStation
.getConnectorStatus(connectorId
)?.status
519 // if (!Number.isInteger(payload.transactionId)) {
521 // `${chargingStation.logPrefix()} Trying to start a transaction on connector ${connectorId.toString()}
with a non integer transaction Id $
{
522 // payload.transactionId
523 // }, converting to integer`
525 // payload.transactionId = Utils.convertToInt(payload.transactionId);
528 if (payload
.idTagInfo
?.status === OCPP16AuthorizationStatus
.ACCEPTED
) {
529 chargingStation
.getConnectorStatus(connectorId
).transactionStarted
= true;
530 chargingStation
.getConnectorStatus(connectorId
).transactionId
= payload
.transactionId
;
531 chargingStation
.getConnectorStatus(connectorId
).transactionIdTag
= requestPayload
.idTag
;
532 chargingStation
.getConnectorStatus(
534 ).transactionEnergyActiveImportRegisterValue
= 0;
535 chargingStation
.getConnectorStatus(connectorId
).transactionBeginMeterValue
=
536 OCPP16ServiceUtils
.buildTransactionBeginMeterValue(
539 requestPayload
.meterStart
541 chargingStation
.getBeginEndMeterValues() &&
542 (await chargingStation
.ocppRequestService
.requestHandler
<
543 OCPP16MeterValuesRequest
,
544 OCPP16MeterValuesResponse
545 >(chargingStation
, OCPP16RequestCommand
.METER_VALUES
, {
547 transactionId
: payload
.transactionId
,
548 meterValue
: [chargingStation
.getConnectorStatus(connectorId
).transactionBeginMeterValue
],
550 await chargingStation
.ocppRequestService
.requestHandler
<
551 OCPP16StatusNotificationRequest
,
552 OCPP16StatusNotificationResponse
553 >(chargingStation
, OCPP16RequestCommand
.STATUS_NOTIFICATION
, {
555 status: OCPP16ChargePointStatus
.CHARGING
,
556 errorCode
: OCPP16ChargePointErrorCode
.NO_ERROR
,
558 chargingStation
.getConnectorStatus(connectorId
).status = OCPP16ChargePointStatus
.CHARGING
;
560 `${chargingStation.logPrefix()} Transaction ${payload.transactionId.toString()} STARTED on ${
561 chargingStation.stationInfo.chargingStationId
562 }#${connectorId.toString()} for idTag '${requestPayload.idTag}'`
564 if (chargingStation
.stationInfo
.powerSharedByConnectors
) {
565 chargingStation
.powerDivider
++;
567 const configuredMeterValueSampleInterval
=
568 ChargingStationConfigurationUtils
.getConfigurationKey(
570 OCPP16StandardParametersKey
.MeterValueSampleInterval
572 chargingStation
.startMeterValues(
574 configuredMeterValueSampleInterval
575 ? Utils
.convertToInt(configuredMeterValueSampleInterval
.value
) * 1000
576 : Constants
.DEFAULT_METER_VALUES_INTERVAL
580 `${chargingStation.logPrefix()} Starting transaction id ${payload.transactionId.toString()} REJECTED with status '${
581 payload.idTagInfo?.status
582 }', idTag '${requestPayload.idTag}'`
584 await this.resetConnectorOnStartTransactionError(chargingStation
, connectorId
);
588 private async resetConnectorOnStartTransactionError(
589 chargingStation
: ChargingStation
,
592 chargingStation
.resetConnectorStatus(connectorId
);
594 chargingStation
.getConnectorStatus(connectorId
)?.status !== OCPP16ChargePointStatus
.AVAILABLE
596 await chargingStation
.ocppRequestService
.requestHandler
<
597 OCPP16StatusNotificationRequest
,
598 OCPP16StatusNotificationResponse
599 >(chargingStation
, OCPP16RequestCommand
.STATUS_NOTIFICATION
, {
601 status: OCPP16ChargePointStatus
.AVAILABLE
,
602 errorCode
: OCPP16ChargePointErrorCode
.NO_ERROR
,
604 chargingStation
.getConnectorStatus(connectorId
).status = OCPP16ChargePointStatus
.AVAILABLE
;
608 private async handleResponseStopTransaction(
609 chargingStation
: ChargingStation
,
610 payload
: OCPP16StopTransactionResponse
,
611 requestPayload
: OCPP16StopTransactionRequest
613 const transactionConnectorId
= chargingStation
.getConnectorIdByTransactionId(
614 requestPayload
.transactionId
616 if (Utils
.isNullOrUndefined(transactionConnectorId
)) {
618 `${chargingStation.logPrefix()} Trying to stop a non existing transaction ${requestPayload.transactionId.toString()}`
622 chargingStation
.getBeginEndMeterValues() === true &&
623 chargingStation
.getOcppStrictCompliance() === false &&
624 chargingStation
.getOutOfOrderEndMeterValues() === true &&
625 (await chargingStation
.ocppRequestService
.requestHandler
<
626 OCPP16MeterValuesRequest
,
627 OCPP16MeterValuesResponse
628 >(chargingStation
, OCPP16RequestCommand
.METER_VALUES
, {
629 connectorId
: transactionConnectorId
,
630 transactionId
: requestPayload
.transactionId
,
632 OCPP16ServiceUtils
.buildTransactionEndMeterValue(
634 transactionConnectorId
,
635 requestPayload
.meterStop
640 chargingStation
.isChargingStationAvailable() === false ||
641 chargingStation
.isConnectorAvailable(transactionConnectorId
) === false
643 await chargingStation
.ocppRequestService
.requestHandler
<
644 OCPP16StatusNotificationRequest
,
645 OCPP16StatusNotificationResponse
646 >(chargingStation
, OCPP16RequestCommand
.STATUS_NOTIFICATION
, {
647 connectorId
: transactionConnectorId
,
648 status: OCPP16ChargePointStatus
.UNAVAILABLE
,
649 errorCode
: OCPP16ChargePointErrorCode
.NO_ERROR
,
651 chargingStation
.getConnectorStatus(transactionConnectorId
).status =
652 OCPP16ChargePointStatus
.UNAVAILABLE
;
654 await chargingStation
.ocppRequestService
.requestHandler
<
655 OCPP16BootNotificationRequest
,
656 OCPP16BootNotificationResponse
657 >(chargingStation
, OCPP16RequestCommand
.STATUS_NOTIFICATION
, {
658 connectorId
: transactionConnectorId
,
659 status: OCPP16ChargePointStatus
.AVAILABLE
,
660 errorCode
: OCPP16ChargePointErrorCode
.NO_ERROR
,
662 chargingStation
.getConnectorStatus(transactionConnectorId
).status =
663 OCPP16ChargePointStatus
.AVAILABLE
;
665 if (chargingStation
.stationInfo
.powerSharedByConnectors
) {
666 chargingStation
.powerDivider
--;
668 chargingStation
.resetConnectorStatus(transactionConnectorId
);
669 const logMsg
= `${chargingStation.logPrefix()} Transaction ${requestPayload.transactionId.toString()} STOPPED on ${
670 chargingStation.stationInfo.chargingStationId
671 }#${transactionConnectorId?.toString()} with status '${
672 payload.idTagInfo?.status ?? 'undefined'
675 Utils
.isNullOrUndefined(payload
.idTagInfo
) ||
676 payload
.idTagInfo
?.status === OCPP16AuthorizationStatus
.ACCEPTED