-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathindex_21.ts
35 lines (32 loc) · 1007 Bytes
/
index_21.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
require("dotenv").config();
import { OcppVersion } from "./src/ocppVersion";
import { bootNotificationOcppOutgoing } from "./src/v21/messages/bootNotification";
import { statusNotificationOcppOutgoing } from "./src/v21/messages/statusNotification";
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_1,
basicAuthPassword: process.env.PASSWORD ?? undefined,
adminPort: Number.parseInt(process.env.ADMIN_WS_PORT ?? "9999"),
});
(async () => {
await vcp.connect();
vcp.send(
bootNotificationOcppOutgoing.request({
reason: "PowerUp",
chargingStation: {
model: "VirtualChargePoint",
vendorName: "Solidstudio",
},
}),
);
vcp.send(
statusNotificationOcppOutgoing.request({
evseId: 1,
connectorId: 1,
connectorStatus: "Available",
timestamp: new Date().toISOString(),
}),
);
})();