From: Jérôme Benoit Date: Sun, 15 Aug 2021 18:43:30 +0000 (+0200) Subject: Fix MeterValues JSON payload X-Git-Tag: v1.0.36~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=b02ab2157918aede5b539c6307a6010d97b6ee83;p=e-mobility-charging-stations-simulator.git Fix MeterValues JSON payload Close https://github.com/sap-labs-france/ev-simulator/issues/17 Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index dcd38a81..8bdc37cf 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -332,7 +332,7 @@ export default class OCPP16RequestService extends OCPPRequestService { const payload: MeterValuesRequest = { connectorId, transactionId, - meterValue, + meterValue: [meterValue], }; await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.METER_VALUES); } catch (error) { @@ -345,7 +345,7 @@ export default class OCPP16RequestService extends OCPPRequestService { const payload: MeterValuesRequest = { connectorId, transactionId, - meterValue: beginMeterValue, + meterValue: [beginMeterValue], }; await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.METER_VALUES); } catch (error) { @@ -358,7 +358,7 @@ export default class OCPP16RequestService extends OCPPRequestService { const payload: MeterValuesRequest = { connectorId, transactionId, - meterValue: endMeterValue, + meterValue: [endMeterValue], }; await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.METER_VALUES); } catch (error) { diff --git a/src/types/ocpp/1.6/MeterValues.ts b/src/types/ocpp/1.6/MeterValues.ts index 2f069538..ec200b19 100644 --- a/src/types/ocpp/1.6/MeterValues.ts +++ b/src/types/ocpp/1.6/MeterValues.ts @@ -97,7 +97,7 @@ export interface OCPP16MeterValue { export interface MeterValuesRequest { connectorId: number; transactionId?: number; - meterValue: OCPP16MeterValue | OCPP16MeterValue[]; + meterValue: OCPP16MeterValue[]; } // eslint-disable-next-line @typescript-eslint/no-empty-interface