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