import { parentPort } from 'node:worker_threads'
import { millisecondsToSeconds, secondsToMilliseconds } from 'date-fns'
import { parentPort } from 'node:worker_threads'
import { millisecondsToSeconds, secondsToMilliseconds } from 'date-fns'
import { type RawData, WebSocket } from 'ws'
import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator.js'
import { type RawData, WebSocket } from 'ws'
import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator.js'
FirmwareStatus,
type FirmwareStatusNotificationRequest,
type FirmwareStatusNotificationResponse,
FirmwareStatus,
type FirmwareStatusNotificationRequest,
type FirmwareStatusNotificationResponse,
stationInfo = this.getConfigurationFromFile()?.stationInfo
if (stationInfo != null) {
delete stationInfo.infoHash
stationInfo = this.getConfigurationFromFile()?.stationInfo
if (stationInfo != null) {
delete stationInfo.infoHash
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (stationInfo.templateIndex == null) {
stationInfo.templateIndex = this.index
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (stationInfo.templateIndex == null) {
stationInfo.templateIndex = this.index
private onClose (code: WebSocketCloseEventStatusCode, reason: Buffer): void {
this.emit(ChargingStationEvents.disconnected)
private onClose (code: WebSocketCloseEventStatusCode, reason: Buffer): void {
this.emit(ChargingStationEvents.disconnected)
- this.reconnect().catch(error =>
- logger.error(`${this.logPrefix()} Error while reconnecting:`, error)
- )
+ this.reconnect()
+ .then(() => {
+ this.emit(ChargingStationEvents.updated)
+ })
+ .catch(error => logger.error(`${this.logPrefix()} Error while reconnecting:`, error))