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