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