| 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 | wsState?: |
| 10 | | typeof WebSocket.CONNECTING |
| 11 | | typeof WebSocket.OPEN |
| 12 | | typeof WebSocket.CLOSING |
| 13 | | typeof WebSocket.CLOSED |
| 14 | bootNotificationResponse?: BootNotificationResponse |
| 15 | automaticTransactionGenerator?: Status[] |
| 16 | } |
| 17 | |
| 18 | export enum OCPP16FirmwareStatus { |
| 19 | Downloaded = 'Downloaded', |
| 20 | DownloadFailed = 'DownloadFailed', |
| 21 | Downloading = 'Downloading', |
| 22 | Idle = 'Idle', |
| 23 | InstallationFailed = 'InstallationFailed', |
| 24 | Installing = 'Installing', |
| 25 | Installed = 'Installed' |
| 26 | } |
| 27 | |
| 28 | export const FirmwareStatus = { |
| 29 | ...OCPP16FirmwareStatus |
| 30 | } as const |
| 31 | export type FirmwareStatus = OCPP16FirmwareStatus |
| 32 | |
| 33 | export type ChargingStationInfo = { |
| 34 | hashId: string |
| 35 | templateName: string |
| 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 | } |
| 91 | |
| 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 | |
| 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', |
| 119 | TRIGGER_MESSAGE = 'TriggerMessage' |
| 120 | } |
| 121 | |
| 122 | export const IncomingRequestCommand = { |
| 123 | ...OCPP16IncomingRequestCommand |
| 124 | } as const |
| 125 | export type IncomingRequestCommand = OCPP16IncomingRequestCommand |
| 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', |
| 135 | DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification' |
| 136 | } |
| 137 | |
| 138 | export const RequestCommand = { |
| 139 | ...OCPP16RequestCommand |
| 140 | } as const |
| 141 | export type RequestCommand = OCPP16RequestCommand |
| 142 | |
| 143 | export type BootNotificationResponse = OCPP16BootNotificationResponse |
| 144 | |
| 145 | export enum OCPP16RegistrationStatus { |
| 146 | ACCEPTED = 'Accepted', |
| 147 | PENDING = 'Pending', |
| 148 | REJECTED = 'Rejected' |
| 149 | } |
| 150 | |
| 151 | export interface OCPP16BootNotificationResponse extends JsonObject { |
| 152 | status: OCPP16RegistrationStatus |
| 153 | currentTime: Date |
| 154 | interval: number |
| 155 | } |
| 156 | |
| 157 | export enum OCPP16MessageTrigger { |
| 158 | BootNotification = 'BootNotification', |
| 159 | DiagnosticsStatusNotification = 'DiagnosticsStatusNotification', |
| 160 | FirmwareStatusNotification = 'FirmwareStatusNotification', |
| 161 | Heartbeat = 'Heartbeat', |
| 162 | MeterValues = 'MeterValues', |
| 163 | StatusNotification = 'StatusNotification' |
| 164 | } |
| 165 | |
| 166 | export const MessageTrigger = { |
| 167 | ...OCPP16MessageTrigger |
| 168 | } as const |
| 169 | export type MessageTrigger = OCPP16MessageTrigger |
| 170 | |
| 171 | type CommandsSupport = { |
| 172 | incomingCommands: Record<IncomingRequestCommand, boolean> |
| 173 | outgoingCommands?: Record<RequestCommand, boolean> |
| 174 | } |
| 175 | |
| 176 | export enum OCPPVersion { |
| 177 | VERSION_16 = '1.6', |
| 178 | VERSION_20 = '2.0' |
| 179 | } |
| 180 | |
| 181 | export enum OCPPProtocol { |
| 182 | JSON = 'json' |
| 183 | } |
| 184 | |
| 185 | export enum CurrentType { |
| 186 | AC = 'AC', |
| 187 | DC = 'DC' |
| 188 | } |
| 189 | |
| 190 | export enum Voltage { |
| 191 | VOLTAGE_110 = 110, |
| 192 | VOLTAGE_230 = 230, |
| 193 | VOLTAGE_400 = 400, |
| 194 | VOLTAGE_800 = 800 |
| 195 | } |
| 196 | |
| 197 | export enum AmpereUnits { |
| 198 | MILLI_AMPERE = 'mA', |
| 199 | CENTI_AMPERE = 'cA', |
| 200 | DECI_AMPERE = 'dA', |
| 201 | AMPERE = 'A' |
| 202 | } |
| 203 | |
| 204 | export type ConnectorStatus = { |
| 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 | } |
| 219 | |
| 220 | export type EvseStatus = { |
| 221 | availability: AvailabilityType |
| 222 | connectors?: ConnectorStatus[] |
| 223 | } |
| 224 | |
| 225 | export enum OCPP16AvailabilityType { |
| 226 | INOPERATIVE = 'Inoperative', |
| 227 | OPERATIVE = 'Operative' |
| 228 | } |
| 229 | export type AvailabilityType = OCPP16AvailabilityType |
| 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', |
| 241 | FAULTED = 'Faulted' |
| 242 | } |
| 243 | export type ChargePointStatus = OCPP16ChargePointStatus |
| 244 | |
| 245 | export type Status = { |
| 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 | } |