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