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