refactor: cleanup RFID tags authorization code
[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 = {
452a82ca 4 started: boolean;
52952bf8
JB
5 stationInfo: ChargingStationInfo;
6 connectors: ConnectorStatus[];
7 evses: EvseStatus[];
36999e77
JB
8 wsState?:
9 | typeof WebSocket.CONNECTING
10 | typeof WebSocket.OPEN
11 | typeof WebSocket.CLOSING
12 | typeof WebSocket.CLOSED;
52952bf8
JB
13 bootNotificationResponse?: BootNotificationResponse;
14 automaticTransactionGenerator?: Status[];
32de5a57
LM
15};
16
17export type ChargingStationInfo = {
51c83d6f 18 hashId: string;
32de5a57
LM
19 chargingStationId?: string;
20 chargePointModel: string;
21 chargePointVendor: string;
b25b8684 22 firmwareVersionPattern?: string;
32de5a57
LM
23 firmwareVersion?: string;
24 numberOfConnectors?: number | number[];
25 baseName: string;
32de5a57
LM
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;
cfdf901d 60 remoteAuthorization?: 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
52952bf8
JB
187export type EvseStatus = {
188 availability: AvailabilityType;
189 connectors?: ConnectorStatus[];
190};
191
32de5a57
LM
192export type AvailabilityType = OCPP16AvailabilityType;
193
194export enum OCPP16AvailabilityType {
195 INOPERATIVE = 'Inoperative',
196 OPERATIVE = 'Operative',
197}
198
199export type ChargePointStatus = OCPP16ChargePointStatus;
200
201export enum OCPP16ChargePointStatus {
202 AVAILABLE = 'Available',
203 PREPARING = 'Preparing',
204 CHARGING = 'Charging',
205 OCCUPIED = 'Occupied',
206 SUSPENDED_EVSE = 'SuspendedEVSE',
207 SUSPENDED_EV = 'SuspendedEV',
208 FINISHING = 'Finishing',
209 RESERVED = 'Reserved',
210 UNAVAILABLE = 'Unavailable',
211 FAULTED = 'Faulted',
212}
02cde3b7
JB
213
214export type Status = {
215 start?: boolean;
216 startDate?: Date;
217 lastRunDate?: Date;
218 stopDate?: Date;
219 stoppedDate?: Date;
220 authorizeRequests?: number;
221 acceptedAuthorizeRequests?: number;
222 rejectedAuthorizeRequests?: number;
223 startTransactionRequests?: number;
224 acceptedStartTransactionRequests?: number;
225 rejectedStartTransactionRequests?: number;
226 stopTransactionRequests?: number;
6d9876e7
JB
227 acceptedStopTransactionRequests?: number;
228 rejectedStopTransactionRequests?: number;
02cde3b7
JB
229 skippedConsecutiveTransactions?: number;
230 skippedTransactions?: number;
231};