}
private startConnectors(): void {
+ if (this.connectorsStatus?.size !== 0 && this.connectorsStatus.size !== this.chargingStation.getNumberOfConnectors()) {
+ this.connectorsStatus.clear();
+ }
for (const connectorId of this.chargingStation.connectors.keys()) {
if (connectorId > 0) {
this.startConnector(connectorId);
return this.getConnectorStatus(id).availability === AvailabilityType.OPERATIVE;
}
+ public getNumberOfConnectors(): number {
+ return this.connectors.get(0) ? this.connectors.size - 1 : this.connectors.size;
+ }
+
public getConnectorStatus(id: number): ConnectorStatus {
return this.connectors.get(id);
}
this.stationInfo.randomConnectors = true;
}
const connectorsConfigHash = crypto.createHash('sha256').update(JSON.stringify(this.stationInfo.Connectors) + maxConnectors.toString()).digest('hex');
- const connectorsConfigChanged = this.connectors.size !== 0 && this.connectorsConfigurationHash !== connectorsConfigHash;
- if (!this.connectors || this.connectors.size === 0 || connectorsConfigChanged) {
+ const connectorsConfigChanged = this.connectors?.size !== 0 && this.connectorsConfigurationHash !== connectorsConfigHash;
+ if (this.connectors?.size === 0 || connectorsConfigChanged) {
connectorsConfigChanged && (this.connectors.clear());
this.connectorsConfigurationHash = connectorsConfigHash;
// Add connector Id 0
return maxConnectors;
}
- private getNumberOfConnectors(): number {
- return this.connectors.get(0) ? this.connectors.size - 1 : this.connectors.size;
- }
-
private async startMessageSequence(): Promise<void> {
// Start WebSocket ping
this.startWebSocketPing();