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