refactor: rename a template key to a more sensible name
[e-mobility-charging-stations-simulator.git] / ui / web / src / types / ChargingStationType.ts
CommitLineData
6c1761d4 1import type { JsonObject } from './JsonType';
ce7a4fc3 2
32de5a57 3export type ChargingStationData = {
32de5a57 4 stationInfo: ChargingStationInfo;
452a82ca 5 started: boolean;
36999e77
JB
6 wsState?:
7 | typeof WebSocket.CONNECTING
8 | typeof WebSocket.OPEN
9 | typeof WebSocket.CLOSING
10 | typeof WebSocket.CLOSED;
ce7a4fc3 11 bootNotificationResponse: BootNotificationResponse;
32de5a57 12 connectors: ConnectorStatus[];
02cde3b7 13 automaticTransactionGeneratorStatuses?: Status[];
32de5a57
LM
14};
15
16export type ChargingStationInfo = {
51c83d6f 17 hashId: string;
32de5a57
LM
18 chargingStationId?: string;
19 chargePointModel: string;
20 chargePointVendor: string;
b25b8684 21 firmwareVersionPattern?: string;
32de5a57
LM
22 firmwareVersion?: string;
23 numberOfConnectors?: number | number[];
24 baseName: string;
25 infoHash?: string;
26 templateHash?: string;
27 chargeBoxSerialNumber?: string;
28 chargePointSerialNumber?: string;
29 meterSerialNumber?: string;
30 maximumPower?: number; // Always in Watt
31 maximumAmperage?: number; // Always in Ampere
32 supervisionUrls?: string | string[];
33 supervisionUrlOcppConfiguration?: boolean;
34 supervisionUrlOcppKey?: string;
35 supervisionUser?: string;
36 supervisionPassword?: string;
37 ocppVersion?: OCPPVersion;
38 ocppProtocol?: OCPPProtocol;
39 ocppStrictCompliance?: boolean;
40 ocppPersistentConfiguration?: boolean;
41 stationInfoPersistentConfiguration?: boolean;
e302df1d 42 idTagsFile?: string;
32de5a57
LM
43 nameSuffix?: string;
44 fixedName?: boolean;
45 iccid?: string;
46 imsi?: string;
47 meterType?: string;
48 powerSharedByConnectors?: boolean;
49 currentOutType?: CurrentType;
50 voltageOut?: Voltage;
51 numberOfPhases?: number;
52 useConnectorId0?: boolean;
53 randomConnectors?: boolean;
54 resetTime?: number;
55 autoRegister?: boolean;
56 autoReconnectMaxRetries?: number;
57 reconnectExponentialDelay?: boolean;
58 registrationMaxRetries?: number;
59 enableStatistics?: boolean;
03ebf4c1 60 mustAuthorizeAtRemoteStart?: boolean;
32de5a57
LM
61 amperageLimitationOcppKey?: string;
62 amperageLimitationUnit?: AmpereUnits;
63 beginEndMeterValues?: boolean;
64 outOfOrderEndMeterValues?: boolean;
65 meteringPerTransaction?: boolean;
66 transactionDataMeterValues?: boolean;
67 mainVoltageMeterValues?: boolean;
68 phaseLineToLineVoltageMeterValues?: boolean;
69 customValueLimitationMeterValues?: boolean;
70 commandsSupport?: CommandsSupport;
c60ed4b8 71 messageTriggerSupport?: Record<MessageTrigger, boolean>;
32de5a57
LM
72};
73
74export enum OCPP16IncomingRequestCommand {
75 RESET = 'Reset',
76 CLEAR_CACHE = 'ClearCache',
77 CHANGE_AVAILABILITY = 'ChangeAvailability',
78 UNLOCK_CONNECTOR = 'UnlockConnector',
79 GET_CONFIGURATION = 'GetConfiguration',
80 CHANGE_CONFIGURATION = 'ChangeConfiguration',
81 SET_CHARGING_PROFILE = 'SetChargingProfile',
82 CLEAR_CHARGING_PROFILE = 'ClearChargingProfile',
83 REMOTE_START_TRANSACTION = 'RemoteStartTransaction',
84 REMOTE_STOP_TRANSACTION = 'RemoteStopTransaction',
85 GET_DIAGNOSTICS = 'GetDiagnostics',
86 TRIGGER_MESSAGE = 'TriggerMessage',
87}
88
32de5a57
LM
89export const IncomingRequestCommand = {
90 ...OCPP16IncomingRequestCommand,
edd13439
JB
91} as const;
92export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
32de5a57
LM
93
94export enum OCPP16RequestCommand {
95 BOOT_NOTIFICATION = 'BootNotification',
96 HEARTBEAT = 'Heartbeat',
97 STATUS_NOTIFICATION = 'StatusNotification',
98 AUTHORIZE = 'Authorize',
99 START_TRANSACTION = 'StartTransaction',
100 STOP_TRANSACTION = 'StopTransaction',
101 METER_VALUES = 'MeterValues',
102 DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification',
103}
104
32de5a57
LM
105export const RequestCommand = {
106 ...OCPP16RequestCommand,
edd13439
JB
107} as const;
108export type RequestCommand = OCPP16RequestCommand;
32de5a57 109
ce7a4fc3
JB
110export type BootNotificationResponse = OCPP16BootNotificationResponse;
111
112export enum OCPP16RegistrationStatus {
113 ACCEPTED = 'Accepted',
114 PENDING = 'Pending',
115 REJECTED = 'Rejected',
116}
117
118export interface OCPP16BootNotificationResponse extends JsonObject {
119 status: OCPP16RegistrationStatus;
d270cc87 120 currentTime: Date;
ce7a4fc3
JB
121 interval: number;
122}
123
c60ed4b8
JB
124export enum OCPP16MessageTrigger {
125 BootNotification = 'BootNotification',
126 DiagnosticsStatusNotification = 'DiagnosticsStatusNotification',
127 FirmwareStatusNotification = 'FirmwareStatusNotification',
128 Heartbeat = 'Heartbeat',
129 MeterValues = 'MeterValues',
130 StatusNotification = 'StatusNotification',
131}
132
c60ed4b8
JB
133export const MessageTrigger = {
134 ...OCPP16MessageTrigger,
edd13439
JB
135} as const;
136export type MessageTrigger = OCPP16MessageTrigger;
c60ed4b8 137
284900bc 138type CommandsSupport = {
32de5a57
LM
139 incomingCommands: Record<IncomingRequestCommand, boolean>;
140 outgoingCommands?: Record<RequestCommand, boolean>;
284900bc 141};
32de5a57
LM
142
143export enum OCPPVersion {
144 VERSION_16 = '1.6',
145 VERSION_20 = '2.0',
146}
147
148export enum OCPPProtocol {
32de5a57
LM
149 JSON = 'json',
150}
151
152export enum CurrentType {
153 AC = 'AC',
154 DC = 'DC',
155}
156
157export enum Voltage {
158 VOLTAGE_110 = 110,
159 VOLTAGE_230 = 230,
160 VOLTAGE_400 = 400,
161 VOLTAGE_800 = 800,
162}
163
164export enum AmpereUnits {
165 MILLI_AMPERE = 'mA',
166 CENTI_AMPERE = 'cA',
167 DECI_AMPERE = 'dA',
168 AMPERE = 'A',
169}
170
171export type ConnectorStatus = {
172 availability: AvailabilityType;
173 bootStatus?: ChargePointStatus;
174 status?: ChargePointStatus;
175 authorizeIdTag?: string;
176 idTagAuthorized?: boolean;
177 localAuthorizeIdTag?: string;
178 idTagLocalAuthorized?: boolean;
179 transactionRemoteStarted?: boolean;
180 transactionStarted?: boolean;
181 transactionId?: number;
182 transactionIdTag?: string;
183 energyActiveImportRegisterValue?: number; // In Wh
184 transactionEnergyActiveImportRegisterValue?: number; // In Wh
185};
186
187export type AvailabilityType = OCPP16AvailabilityType;
188
189export enum OCPP16AvailabilityType {
190 INOPERATIVE = 'Inoperative',
191 OPERATIVE = 'Operative',
192}
193
194export type ChargePointStatus = OCPP16ChargePointStatus;
195
196export enum OCPP16ChargePointStatus {
197 AVAILABLE = 'Available',
198 PREPARING = 'Preparing',
199 CHARGING = 'Charging',
200 OCCUPIED = 'Occupied',
201 SUSPENDED_EVSE = 'SuspendedEVSE',
202 SUSPENDED_EV = 'SuspendedEV',
203 FINISHING = 'Finishing',
204 RESERVED = 'Reserved',
205 UNAVAILABLE = 'Unavailable',
206 FAULTED = 'Faulted',
207}
02cde3b7
JB
208
209export type Status = {
210 start?: boolean;
211 startDate?: Date;
212 lastRunDate?: Date;
213 stopDate?: Date;
214 stoppedDate?: Date;
215 authorizeRequests?: number;
216 acceptedAuthorizeRequests?: number;
217 rejectedAuthorizeRequests?: number;
218 startTransactionRequests?: number;
219 acceptedStartTransactionRequests?: number;
220 rejectedStartTransactionRequests?: number;
221 stopTransactionRequests?: number;
6d9876e7
JB
222 acceptedStopTransactionRequests?: number;
223 rejectedStopTransactionRequests?: number;
02cde3b7
JB
224 skippedConsecutiveTransactions?: number;
225 skippedTransactions?: number;
226};