"cross-env": "^7.0.3",
"eslint": "^8.5.0",
"eslint-plugin-import": "^2.25.3",
- "eslint-plugin-jsdoc": "^37.3.0",
+ "eslint-plugin-jsdoc": "^37.4.0",
"eslint-plugin-node": "^11.1.0",
"expect": "^27.4.2",
"mocha": "^9.1.3",
}
},
"node_modules/eslint-plugin-jsdoc": {
- "version": "37.3.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.3.0.tgz",
- "integrity": "sha512-76fXAjqrfcqLpa3JjnDIXYHM8zlrNJYEXv6xvTyMcgbQ/gl0OmoEmPAGV9HxbhbJ9hhcW5fTVemRIwhGUwqJcw==",
+ "version": "37.4.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.4.0.tgz",
+ "integrity": "sha512-XWKMMHFq7eUdC8XMzuQSskevJvlHTDSAJm/2qtEZ7+qhZTZ0YjeqWaUn7KGdrmxLNqtWwtJ67LdIPgrYUZ5EoA==",
"dev": true,
"dependencies": {
"@es-joy/jsdoccomment": "0.13.0",
}
},
"eslint-plugin-jsdoc": {
- "version": "37.3.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.3.0.tgz",
- "integrity": "sha512-76fXAjqrfcqLpa3JjnDIXYHM8zlrNJYEXv6xvTyMcgbQ/gl0OmoEmPAGV9HxbhbJ9hhcW5fTVemRIwhGUwqJcw==",
+ "version": "37.4.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.4.0.tgz",
+ "integrity": "sha512-XWKMMHFq7eUdC8XMzuQSskevJvlHTDSAJm/2qtEZ7+qhZTZ0YjeqWaUn7KGdrmxLNqtWwtJ67LdIPgrYUZ5EoA==",
"dev": true,
"requires": {
"@es-joy/jsdoccomment": "0.13.0",
"cross-env": "^7.0.3",
"eslint": "^8.5.0",
"eslint-plugin-import": "^2.25.3",
- "eslint-plugin-jsdoc": "^37.3.0",
+ "eslint-plugin-jsdoc": "^37.4.0",
"eslint-plugin-node": "^11.1.0",
"expect": "^27.4.2",
"mocha": "^9.1.3",
import OCPP16IncomingRequestService from './ocpp/1.6/OCPP16IncomingRequestService';
import OCPP16RequestService from './ocpp/1.6/OCPP16RequestService';
import OCPP16ResponseService from './ocpp/1.6/OCPP16ResponseService';
-import OCPPError from './ocpp/OCPPError';
+import OCPPError from '../exception/OCPPError';
import OCPPIncomingRequestService from './ocpp/OCPPIncomingRequestService';
import OCPPRequestService from './ocpp/OCPPRequestService';
import { OCPPVersion } from '../types/ocpp/OCPPVersion';
}
public isWebSocketConnectionOpened(): boolean {
- return this.wsConnection?.readyState === OPEN;
+ return this?.wsConnection?.readyState === OPEN;
}
public isRegistered(): boolean {
- return this.bootNotificationResponse?.status === RegistrationStatus.ACCEPTED;
+ return this?.bootNotificationResponse?.status === RegistrationStatus.ACCEPTED;
}
public isChargingStationAvailable(): boolean {
}
} while (!this.isRegistered() && (registrationRetryCount <= this.getRegistrationMaxRetries() || this.getRegistrationMaxRetries() === -1));
}
+ if (this.isRegistered() && this.stationInfo.autoRegister) {
+ await this.ocppRequestService.sendBootNotification(this.bootNotificationRequest.chargePointModel,
+ this.bootNotificationRequest.chargePointVendor, this.bootNotificationRequest.chargeBoxSerialNumber, this.bootNotificationRequest.firmwareVersion);
+ }
if (this.isRegistered()) {
await this.startMessageSequence();
this.stopped && (this.stopped = false);
}
private getMaxNumberOfConnectors(): number {
- let maxConnectors = 0;
+ let maxConnectors: number;
if (!Utils.isEmptyArray(this.stationInfo.numberOfConnectors)) {
const numberOfConnectors = this.stationInfo.numberOfConnectors as number[];
// Distribute evenly the number of connectors
import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus';
import { OCPP16StandardParametersKey } from '../../../types/ocpp/1.6/Configuration';
import { OCPPConfigurationKey } from '../../../types/ocpp/Configuration';
-import OCPPError from '../OCPPError';
+import OCPPError from '../../../exception/OCPPError';
import OCPPIncomingRequestService from '../OCPPIncomingRequestService';
import { URL } from 'url';
import Utils from '../../../utils/Utils';
import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus';
import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus';
import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
-import OCPPError from '../OCPPError';
+import OCPPError from '../../../exception/OCPPError';
import OCPPRequestService from '../OCPPRequestService';
import Utils from '../../../utils/Utils';
import logger from '../../../utils/Logger';
import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus';
import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
import { OCPP16StandardParametersKey } from '../../../types/ocpp/1.6/Configuration';
-import OCPPError from '../OCPPError';
+import OCPPError from '../../../exception/OCPPError';
import OCPPResponseService from '../OCPPResponseService';
import { ResponseHandler } from '../../../types/ocpp/Responses';
import Utils from '../../../utils/Utils';
import ChargingStation from '../../ChargingStation';
import { ErrorType } from '../../../types/ocpp/ErrorType';
-import OCPPError from '../OCPPError';
+import OCPPError from '../../../exception/OCPPError';
import { RequestCommand } from '../../../types/ocpp/Requests';
import { SampledValueTemplate } from '../../../types/Connectors';
import Utils from '../../../utils/Utils';
import { ErrorType } from '../../types/ocpp/ErrorType';
import { MessageType } from '../../types/ocpp/MessageType';
import { MeterValue } from '../../types/ocpp/MeterValues';
-import OCPPError from './OCPPError';
+import OCPPError from '../../exception/OCPPError';
import OCPPResponseService from './OCPPResponseService';
import PerformanceStatistics from '../../performance/PerformanceStatistics';
import Utils from '../../utils/Utils';
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
-import { IncomingRequestCommand, RequestCommand } from '../../types/ocpp/Requests';
+import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests';
-import BaseError from '../../exception/BaseError';
-import { ErrorType } from '../../types/ocpp/ErrorType';
+import BaseError from './BaseError';
+import { ErrorType } from '../types/ocpp/ErrorType';
export default class OCPPError extends BaseError {
code: ErrorType | IncomingRequestCommand;
import { MessageType } from './MessageType';
import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus';
-import OCPPError from '../../charging-station/ocpp/OCPPError';
+import OCPPError from '../../exception/OCPPError';
export type IncomingRequestHandler = (commandPayload: Record<string, unknown>) => Record<string, unknown> | Promise<Record<string, unknown>>;
GetDiagnostics:
curl -d '[2,"123456789","GetDiagnostics",{"location":"ftp://localhost"}]' -H "Content-Type: application/json" -X POST http://localhost:3000/message
+TriggerMessage:
+ curl -d '[2,"123456789","TriggerMessage",{"requestedMessage":"BootNotification"}]' -H "Content-Type: application/json" -X POST http://localhost:3000/message
+ curl -d '[2,"123456789","TriggerMessage",{"requestedMessage":"HeartBeat"}]' -H "Content-Type: application/json" -X POST http://localhost:3000/message