}
private openWSConnection(options?: ClientOptions & ClientRequestArgs, forceCloseOpened = false): void {
- options ?? {};
- options?.handshakeTimeout ?? this.getConnectionTimeout() * 1000;
+ options = options ?? {};
+ options.handshakeTimeout = options?.handshakeTimeout ?? this.getConnectionTimeout() * 1000;
if (!Utils.isNullOrUndefined(this.stationInfo.supervisionUser) && !Utils.isNullOrUndefined(this.stationInfo.supervisionPassword)) {
options.auth = `${this.stationInfo.supervisionUser}:${this.stationInfo.supervisionPassword}`;
}
public async sendError(messageId: string, error: OCPPError, commandName: OCPP16RequestCommand | OCPP16IncomingRequestCommand): Promise<unknown> {
try {
// Send error
- return this.sendMessage(messageId, error, MessageType.CALL_ERROR_MESSAGE, commandName);
+ return await this.sendMessage(messageId, error, MessageType.CALL_ERROR_MESSAGE, commandName);
} catch (err) {
this.handleRequestError(commandName as OCPP16RequestCommand, err);
}
if (Array.isArray(dataSet) && dataSet.length === 1) {
return dataSet[0];
}
- const sortedDataSet = dataSet.slice().sort();
+ const sortedDataSet = dataSet.slice().sort((a, b) => (a - b));
const middleIndex = Math.floor(sortedDataSet.length / 2);
if (sortedDataSet.length % 2) {
return sortedDataSet[middleIndex / 2];
if (Utils.isEmptyArray(dataSet)) {
return 0;
}
- const sortedDataSet = dataSet.slice().sort();
+ const sortedDataSet = dataSet.slice().sort((a, b) => (a - b));
if (percentile === 0) {
return sortedDataSet[0];
}