Refine some templates handling log messages
[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;
42 authorizationFile?: string;
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
89export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
90
91export const IncomingRequestCommand = {
92 ...OCPP16IncomingRequestCommand,
93};
94
95export enum OCPP16RequestCommand {
96 BOOT_NOTIFICATION = 'BootNotification',
97 HEARTBEAT = 'Heartbeat',
98 STATUS_NOTIFICATION = 'StatusNotification',
99 AUTHORIZE = 'Authorize',
100 START_TRANSACTION = 'StartTransaction',
101 STOP_TRANSACTION = 'StopTransaction',
102 METER_VALUES = 'MeterValues',
103 DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification',
104}
105
106export type RequestCommand = OCPP16RequestCommand;
107
108export const RequestCommand = {
109 ...OCPP16RequestCommand,
110};
111
ce7a4fc3
JB
112export type BootNotificationResponse = OCPP16BootNotificationResponse;
113
114export enum OCPP16RegistrationStatus {
115 ACCEPTED = 'Accepted',
116 PENDING = 'Pending',
117 REJECTED = 'Rejected',
118}
119
120export interface OCPP16BootNotificationResponse extends JsonObject {
121 status: OCPP16RegistrationStatus;
122 currentTime: string;
123 interval: number;
124}
125
c60ed4b8
JB
126export enum OCPP16MessageTrigger {
127 BootNotification = 'BootNotification',
128 DiagnosticsStatusNotification = 'DiagnosticsStatusNotification',
129 FirmwareStatusNotification = 'FirmwareStatusNotification',
130 Heartbeat = 'Heartbeat',
131 MeterValues = 'MeterValues',
132 StatusNotification = 'StatusNotification',
133}
134
135export type MessageTrigger = OCPP16MessageTrigger;
136
137export const MessageTrigger = {
138 ...OCPP16MessageTrigger,
139};
140
284900bc 141type CommandsSupport = {
32de5a57
LM
142 incomingCommands: Record<IncomingRequestCommand, boolean>;
143 outgoingCommands?: Record<RequestCommand, boolean>;
284900bc 144};
32de5a57
LM
145
146export enum OCPPVersion {
147 VERSION_16 = '1.6',
148 VERSION_20 = '2.0',
149}
150
151export enum OCPPProtocol {
32de5a57
LM
152 JSON = 'json',
153}
154
155export enum CurrentType {
156 AC = 'AC',
157 DC = 'DC',
158}
159
160export enum Voltage {
161 VOLTAGE_110 = 110,
162 VOLTAGE_230 = 230,
163 VOLTAGE_400 = 400,
164 VOLTAGE_800 = 800,
165}
166
167export enum AmpereUnits {
168 MILLI_AMPERE = 'mA',
169 CENTI_AMPERE = 'cA',
170 DECI_AMPERE = 'dA',
171 AMPERE = 'A',
172}
173
174export type ConnectorStatus = {
175 availability: AvailabilityType;
176 bootStatus?: ChargePointStatus;
177 status?: ChargePointStatus;
178 authorizeIdTag?: string;
179 idTagAuthorized?: boolean;
180 localAuthorizeIdTag?: string;
181 idTagLocalAuthorized?: boolean;
182 transactionRemoteStarted?: boolean;
183 transactionStarted?: boolean;
184 transactionId?: number;
185 transactionIdTag?: string;
186 energyActiveImportRegisterValue?: number; // In Wh
187 transactionEnergyActiveImportRegisterValue?: number; // In Wh
188};
189
190export type AvailabilityType = OCPP16AvailabilityType;
191
192export enum OCPP16AvailabilityType {
193 INOPERATIVE = 'Inoperative',
194 OPERATIVE = 'Operative',
195}
196
197export type ChargePointStatus = OCPP16ChargePointStatus;
198
199export enum OCPP16ChargePointStatus {
200 AVAILABLE = 'Available',
201 PREPARING = 'Preparing',
202 CHARGING = 'Charging',
203 OCCUPIED = 'Occupied',
204 SUSPENDED_EVSE = 'SuspendedEVSE',
205 SUSPENDED_EV = 'SuspendedEV',
206 FINISHING = 'Finishing',
207 RESERVED = 'Reserved',
208 UNAVAILABLE = 'Unavailable',
209 FAULTED = 'Faulted',
210}
02cde3b7
JB
211
212export type Status = {
213 start?: boolean;
214 startDate?: Date;
215 lastRunDate?: Date;
216 stopDate?: Date;
217 stoppedDate?: Date;
218 authorizeRequests?: number;
219 acceptedAuthorizeRequests?: number;
220 rejectedAuthorizeRequests?: number;
221 startTransactionRequests?: number;
222 acceptedStartTransactionRequests?: number;
223 rejectedStartTransactionRequests?: number;
224 stopTransactionRequests?: number;
6d9876e7
JB
225 acceptedStopTransactionRequests?: number;
226 rejectedStopTransactionRequests?: number;
02cde3b7
JB
227 skippedConsecutiveTransactions?: number;
228 skippedTransactions?: number;
229};