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