forked from solidstudiosh/ocpp-virtual-charge-point
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_16.ts
38 lines (35 loc) · 924 Bytes
/
index_16.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import * as uuid from "uuid";
require("dotenv").config();
import { OcppVersion } from "./src/ocppVersion";
import { VCP } from "./src/vcp";
const vcp = new VCP({
endpoint: process.env["WS_URL"] ?? "ws://localhost:3000",
chargePointId: process.env["CP_ID"] ?? "123456",
ocppVersion: OcppVersion.OCPP_1_6,
basicAuthPassword: process.env["PASSWORD"] ?? undefined,
adminWsPort: parseInt(
process.env["ADMIN_PORT"] ?? "9999"
),
});
(async () => {
await vcp.connect();
vcp.send({
messageId: uuid.v4(),
action: "BootNotification",
payload: {
chargePointVendor: "Solidstudio",
chargePointModel: "VirtualChargePoint",
chargePointSerialNumber: "S001",
firmwareVersion: "1.0.0",
},
});
vcp.send({
messageId: uuid.v4(),
action: "StatusNotification",
payload: {
connectorId: 1,
errorCode: "NoError",
status: "Available",
},
});
})();