From b02ab2157918aede5b539c6307a6010d97b6ee83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 15 Aug 2021 20:43:30 +0200 Subject: [PATCH] Fix MeterValues JSON payload MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Close https://github.com/sap-labs-france/ev-simulator/issues/17 Signed-off-by: Jérôme Benoit --- src/charging-station/ocpp/1.6/OCPP16RequestService.ts | 6 +++--- src/types/ocpp/1.6/MeterValues.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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 -- 2.34.1