switch (chargingStation.stationInfo.ocppVersion) {
case OCPPVersion.VERSION_16:
if (
- connectorId === 0 &&
- OCPP16Constants.ChargePointStatusChargingStationTransitions.findIndex(
- (transition) => transition.from === fromStatus && transition.to === status
- ) !== -1
- ) {
- transitionAllowed = true;
- } else if (
- OCPP16Constants.ChargePointStatusConnectorTransitions.findIndex(
- (transition) => transition.from === fromStatus && transition.to === status
- ) !== -1
+ (connectorId === 0 &&
+ OCPP16Constants.ChargePointStatusChargingStationTransitions.findIndex(
+ (transition) => transition.from === fromStatus && transition.to === status
+ ) !== -1) ||
+ (connectorId > 0 &&
+ OCPP16Constants.ChargePointStatusConnectorTransitions.findIndex(
+ (transition) => transition.from === fromStatus && transition.to === status
+ ) !== -1)
) {
transitionAllowed = true;
}
case OCPPVersion.VERSION_20:
case OCPPVersion.VERSION_201:
if (
- connectorId === 0 &&
- OCPP20Constants.ChargingStationStatusTransitions.findIndex(
- (transition) => transition.from === fromStatus && transition.to === status
- ) !== -1
- ) {
- transitionAllowed = true;
- } else if (
- OCPP20Constants.ConnectorStatusTransitions.findIndex(
- (transition) => transition.from === fromStatus && transition.to === status
- ) !== -1
+ (connectorId === 0 &&
+ OCPP20Constants.ChargingStationStatusTransitions.findIndex(
+ (transition) => transition.from === fromStatus && transition.to === status
+ ) !== -1) ||
+ (connectorId > 0 &&
+ OCPP20Constants.ConnectorStatusTransitions.findIndex(
+ (transition) => transition.from === fromStatus && transition.to === status
+ ) !== -1)
) {
transitionAllowed = true;
}