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