SupportedFeatureProfiles,
VendorDefaultParametersKey,
} from '../types/ocpp/Configuration';
-import { MeterValueMeasurand, MeterValuePhase } from '../types/ocpp/MeterValues';
+import { MeterValue, MeterValueMeasurand, MeterValuePhase } from '../types/ocpp/MeterValues';
import { WSError, WebSocketCloseEventStatusCode } from '../types/WebSocket';
import WebSocket, { ClientOptions, Data, OPEN, RawData } from 'ws';
this.getConnectorStatus(connectorId).transactionSetInterval = setInterval(
// eslint-disable-next-line @typescript-eslint/no-misused-promises
async (): Promise<void> => {
- await this.ocppRequestService.sendMeterValues(
+ // FIXME: Implement OCPP version agnostic helpers
+ const meterValue: MeterValue = OCPP16ServiceUtils.buildMeterValue(
+ this,
connectorId,
this.getConnectorStatus(connectorId).transactionId,
interval
);
+ await this.ocppRequestService.sendMessageHandler(RequestCommand.METER_VALUES, {
+ connectorId,
+ transactionId: this.getConnectorStatus(connectorId).transactionId,
+ meterValue: [meterValue],
+ });
},
interval
);
);
}
- public async sendMeterValues(
- connectorId: number,
- transactionId: number,
- interval: number
- ): Promise<void> {
- const meterValue: OCPP16MeterValue = OCPP16ServiceUtils.buildMeterValue(
- this.chargingStation,
- connectorId,
- transactionId,
- interval
- );
- const payload: MeterValuesRequest = {
- connectorId,
- transactionId,
- meterValue: [meterValue],
- };
- await this.sendMessage(Utils.generateUUID(), payload, OCPP16RequestCommand.METER_VALUES);
- }
-
public async sendTransactionBeginMeterValues(
connectorId: number,
transactionId: number,
ResponseType,
SendParams,
} from '../../types/ocpp/Requests';
-import { StopTransactionReason, StopTransactionResponse } from '../../types/ocpp/Transaction';
import type ChargingStation from '../ChargingStation';
import Constants from '../../utils/Constants';
params?: SendParams
): Promise<ResponseType>;
- public abstract sendMeterValues(
- connectorId: number,
- transactionId: number,
- interval: number
- ): Promise<void>;
-
public abstract sendTransactionBeginMeterValues(
connectorId: number,
transactionId: number,