Commit | Line | Data |
---|---|---|
66a7748d | 1 | import type { JsonObject } from './JsonType' |
ce7a4fc3 | 2 | |
32de5a57 | 3 | export type ChargingStationData = { |
66a7748d JB |
4 | started: boolean |
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 | |
66a7748d JB |
12 | | typeof WebSocket.CLOSED |
13 | bootNotificationResponse?: BootNotificationResponse | |
14 | automaticTransactionGenerator?: Status[] | |
15 | } | |
32de5a57 | 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', | |
a807045b | 24 | Installed = 'Installed', |
2a526157 JB |
25 | } |
26 | ||
27 | export const FirmwareStatus = { | |
a807045b | 28 | ...OCPP16FirmwareStatus, |
66a7748d JB |
29 | } as const |
30 | export type FirmwareStatus = OCPP16FirmwareStatus | |
2a526157 | 31 | |
32de5a57 | 32 | export type ChargingStationInfo = { |
66a7748d JB |
33 | hashId: string |
34 | chargingStationId?: string | |
35 | chargePointModel: string | |
36 | chargePointVendor: string | |
37 | firmwareVersionPattern?: string | |
38 | firmwareVersion?: string | |
39 | firmwareStatus?: FirmwareStatus | |
40 | numberOfConnectors?: number | number[] | |
41 | baseName: string | |
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 | |
58 | idTagsFile?: string | |
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 | |
76 | remoteAuthorization?: boolean | |
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 | |
87 | messageTriggerSupport?: Record<MessageTrigger, boolean> | |
88 | } | |
32de5a57 LM |
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', | |
a807045b | 102 | TRIGGER_MESSAGE = 'TriggerMessage', |
32de5a57 LM |
103 | } |
104 | ||
32de5a57 | 105 | export const IncomingRequestCommand = { |
a807045b | 106 | ...OCPP16IncomingRequestCommand, |
66a7748d 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', | |
a807045b | 118 | DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification', |
32de5a57 LM |
119 | } |
120 | ||
32de5a57 | 121 | export const RequestCommand = { |
a807045b | 122 | ...OCPP16RequestCommand, |
66a7748d JB |
123 | } as const |
124 | export type RequestCommand = OCPP16RequestCommand | |
32de5a57 | 125 | |
66a7748d | 126 | export type BootNotificationResponse = OCPP16BootNotificationResponse |
ce7a4fc3 JB |
127 | |
128 | export enum OCPP16RegistrationStatus { | |
129 | ACCEPTED = 'Accepted', | |
130 | PENDING = 'Pending', | |
a807045b | 131 | REJECTED = 'Rejected', |
ce7a4fc3 JB |
132 | } |
133 | ||
134 | export interface OCPP16BootNotificationResponse extends JsonObject { | |
66a7748d JB |
135 | status: OCPP16RegistrationStatus |
136 | currentTime: Date | |
137 | interval: number | |
ce7a4fc3 JB |
138 | } |
139 | ||
c60ed4b8 JB |
140 | export enum OCPP16MessageTrigger { |
141 | BootNotification = 'BootNotification', | |
142 | DiagnosticsStatusNotification = 'DiagnosticsStatusNotification', | |
143 | FirmwareStatusNotification = 'FirmwareStatusNotification', | |
144 | Heartbeat = 'Heartbeat', | |
145 | MeterValues = 'MeterValues', | |
a807045b | 146 | StatusNotification = 'StatusNotification', |
c60ed4b8 JB |
147 | } |
148 | ||
c60ed4b8 | 149 | export const MessageTrigger = { |
a807045b | 150 | ...OCPP16MessageTrigger, |
66a7748d JB |
151 | } as const |
152 | export type MessageTrigger = OCPP16MessageTrigger | |
c60ed4b8 | 153 | |
284900bc | 154 | type CommandsSupport = { |
66a7748d JB |
155 | incomingCommands: Record<IncomingRequestCommand, boolean> |
156 | outgoingCommands?: Record<RequestCommand, boolean> | |
157 | } | |
32de5a57 LM |
158 | |
159 | export enum OCPPVersion { | |
160 | VERSION_16 = '1.6', | |
a807045b | 161 | VERSION_20 = '2.0', |
32de5a57 LM |
162 | } |
163 | ||
164 | export enum OCPPProtocol { | |
a807045b | 165 | JSON = 'json', |
32de5a57 LM |
166 | } |
167 | ||
168 | export enum CurrentType { | |
169 | AC = 'AC', | |
a807045b | 170 | DC = 'DC', |
32de5a57 LM |
171 | } |
172 | ||
173 | export enum Voltage { | |
174 | VOLTAGE_110 = 110, | |
175 | VOLTAGE_230 = 230, | |
176 | VOLTAGE_400 = 400, | |
a807045b | 177 | VOLTAGE_800 = 800, |
32de5a57 LM |
178 | } |
179 | ||
180 | export enum AmpereUnits { | |
181 | MILLI_AMPERE = 'mA', | |
182 | CENTI_AMPERE = 'cA', | |
183 | DECI_AMPERE = 'dA', | |
a807045b | 184 | AMPERE = 'A', |
32de5a57 LM |
185 | } |
186 | ||
187 | export type ConnectorStatus = { | |
66a7748d JB |
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 | } | |
32de5a57 | 202 | |
52952bf8 | 203 | export type EvseStatus = { |
66a7748d JB |
204 | availability: AvailabilityType |
205 | connectors?: ConnectorStatus[] | |
206 | } | |
52952bf8 | 207 | |
32de5a57 LM |
208 | export enum OCPP16AvailabilityType { |
209 | INOPERATIVE = 'Inoperative', | |
a807045b | 210 | OPERATIVE = 'Operative', |
32de5a57 | 211 | } |
66a7748d | 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', | |
a807045b | 224 | FAULTED = 'Faulted', |
32de5a57 | 225 | } |
66a7748d | 226 | export type ChargePointStatus = OCPP16ChargePointStatus |
02cde3b7 JB |
227 | |
228 | export type Status = { | |
66a7748d JB |
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 | |
241 | acceptedStopTransactionRequests?: number | |
242 | rejectedStopTransactionRequests?: number | |
243 | skippedConsecutiveTransactions?: number | |
244 | skippedTransactions?: number | |
245 | } |