import { parentPort } from 'node:worker_threads'
import { millisecondsToSeconds, secondsToMilliseconds } from 'date-fns'
-import { merge } from 'lodash-es'
+import { mergeDeepRight } from 'rambda'
import { type RawData, WebSocket } from 'ws'
import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator.js'
} does not match firmware version pattern '${stationInfo.firmwareVersionPattern}'`
)
}
- stationInfo.firmwareUpgrade = merge(
+ stationInfo.firmwareUpgrade = mergeDeepRight(
{
versionUpgrade: {
step: 1
} else {
delete configurationData.configurationKey
}
- configurationData = merge(
+ configurationData = mergeDeepRight(
configurationData,
buildChargingStationAutomaticTransactionGeneratorConfiguration(this)
)
private async onOpen (): Promise<void> {
if (this.isWebSocketConnectionOpened()) {
+ this.emit(ChargingStationEvents.updated)
logger.info(
`${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.href} succeeded`
)
private onClose (code: WebSocketCloseEventStatusCode, reason: Buffer): void {
this.emit(ChargingStationEvents.disconnected)
+ this.emit(ChargingStationEvents.updated)
switch (code) {
// Normal close
case WebSocketCloseEventStatusCode.CLOSE_NORMAL:
)}' and reason '${reason.toString()}'`
)
this.started &&
- 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))
break
}
- this.emit(ChargingStationEvents.updated)
}
private getCachedRequest (