forked from solidstudiosh/ocpp-virtual-charge-point
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_201.ts
38 lines (35 loc) · 922 Bytes
/
index_201.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_2_0_1,
basicAuthPassword: process.env["PASSWORD"] ?? undefined,
adminWsPort: parseInt(process.env["ADMIN_WS_PORT"] ?? "9999"),
});
(async () => {
await vcp.connect();
vcp.send({
messageId: uuid.v4(),
action: "BootNotification",
payload: {
reason: "PowerUp",
chargingStation: {
model: "VirtualChargePoint",
vendorName: "Solidstudio",
},
},
});
vcp.send({
messageId: uuid.v4(),
action: "StatusNotification",
payload: {
connectorId: 1,
evseId: 1,
connectorStatus: "Available",
timestamp: new Date(),
},
});
})();