X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fbroadcast-channel%2FChargingStationWorkerBroadcastChannel.ts;h=fff823c09b22989f441c6b88968018a6acc933a6;hb=248f70eff6b955b177f0bbd9ca84356c3b99d72e;hp=87ceaca97a0dcece14ce393fd335826018f69c76;hpb=4a3807d16c54137840a60af41877f3b21de12950;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts index 87ceaca9..fff823c0 100644 --- a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts @@ -1,3 +1,5 @@ +import { secondsToMilliseconds } from 'date-fns'; + import { WorkerBroadcastChannel } from './WorkerBroadcastChannel'; import { BaseError, type OCPPError } from '../../exception'; import { @@ -15,6 +17,7 @@ import { DataTransferStatus, type DiagnosticsStatusNotificationRequest, type DiagnosticsStatusNotificationResponse, + type EmptyObject, type FirmwareStatusNotificationRequest, type FirmwareStatusNotificationResponse, type HeartbeatRequest, @@ -36,17 +39,17 @@ import { } from '../../types'; import { Constants, convertToInt, isEmptyObject, isNullOrUndefined, logger } from '../../utils'; import type { ChargingStation } from '../ChargingStation'; -import { getConfigurationKey } from '../ChargingStationConfigurationUtils'; +import { getConfigurationKey } from '../ConfigurationKeyUtils'; import { OCPP16ServiceUtils } from '../ocpp'; const moduleName = 'ChargingStationWorkerBroadcastChannel'; type CommandResponse = + | EmptyObject | StartTransactionResponse | StopTransactionResponse | AuthorizeResponse | BootNotificationResponse - | StatusNotificationResponse | HeartbeatResponse | DataTransferResponse; @@ -192,7 +195,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne this.chargingStation.getConnectorStatus(requestPayload!.connectorId!)! .transactionId!, configuredMeterValueSampleInterval - ? convertToInt(configuredMeterValueSampleInterval.value) * 1000 + ? secondsToMilliseconds(convertToInt(configuredMeterValueSampleInterval.value)) : Constants.DEFAULT_METER_VALUES_INTERVAL, ), ], @@ -314,7 +317,7 @@ export class ChargingStationWorkerBroadcastChannel extends WorkerBroadcastChanne this.cleanRequestPayload(command, requestPayload); return this.commandHandlers.get(command)!(requestPayload); } - throw new BaseError(`Unknown worker broadcast channel command: ${command}`); + throw new BaseError(`Unknown worker broadcast channel command: '${command}'`); } private cleanRequestPayload(