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