| 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 const FirmwareStatus = { |
| 30 | ...OCPP16FirmwareStatus |
| 31 | } as const |
| 32 | export type FirmwareStatus = OCPP16FirmwareStatus |
| 33 | |
| 34 | export type ChargingStationInfo = { |
| 35 | hashId: string |
| 36 | templateIndex: number |
| 37 | templateName: string |
| 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 | } |
| 93 | |
| 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 | |
| 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', |
| 121 | TRIGGER_MESSAGE = 'TriggerMessage' |
| 122 | } |
| 123 | |
| 124 | export const IncomingRequestCommand = { |
| 125 | ...OCPP16IncomingRequestCommand |
| 126 | } as const |
| 127 | export type IncomingRequestCommand = OCPP16IncomingRequestCommand |
| 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', |
| 137 | DIAGNOSTICS_STATUS_NOTIFICATION = 'DiagnosticsStatusNotification' |
| 138 | } |
| 139 | |
| 140 | export const RequestCommand = { |
| 141 | ...OCPP16RequestCommand |
| 142 | } as const |
| 143 | export type RequestCommand = OCPP16RequestCommand |
| 144 | |
| 145 | export type BootNotificationResponse = OCPP16BootNotificationResponse |
| 146 | |
| 147 | export enum OCPP16RegistrationStatus { |
| 148 | ACCEPTED = 'Accepted', |
| 149 | PENDING = 'Pending', |
| 150 | REJECTED = 'Rejected' |
| 151 | } |
| 152 | |
| 153 | export interface OCPP16BootNotificationResponse extends JsonObject { |
| 154 | status: OCPP16RegistrationStatus |
| 155 | currentTime: Date |
| 156 | interval: number |
| 157 | } |
| 158 | |
| 159 | export enum OCPP16MessageTrigger { |
| 160 | BootNotification = 'BootNotification', |
| 161 | DiagnosticsStatusNotification = 'DiagnosticsStatusNotification', |
| 162 | FirmwareStatusNotification = 'FirmwareStatusNotification', |
| 163 | Heartbeat = 'Heartbeat', |
| 164 | MeterValues = 'MeterValues', |
| 165 | StatusNotification = 'StatusNotification' |
| 166 | } |
| 167 | |
| 168 | export const MessageTrigger = { |
| 169 | ...OCPP16MessageTrigger |
| 170 | } as const |
| 171 | export type MessageTrigger = OCPP16MessageTrigger |
| 172 | |
| 173 | type CommandsSupport = { |
| 174 | incomingCommands: Record<IncomingRequestCommand, boolean> |
| 175 | outgoingCommands?: Record<RequestCommand, boolean> |
| 176 | } |
| 177 | |
| 178 | export enum OCPPVersion { |
| 179 | VERSION_16 = '1.6', |
| 180 | VERSION_20 = '2.0' |
| 181 | } |
| 182 | |
| 183 | export enum OCPPProtocol { |
| 184 | JSON = 'json' |
| 185 | } |
| 186 | |
| 187 | export enum CurrentType { |
| 188 | AC = 'AC', |
| 189 | DC = 'DC' |
| 190 | } |
| 191 | |
| 192 | export enum Voltage { |
| 193 | VOLTAGE_110 = 110, |
| 194 | VOLTAGE_230 = 230, |
| 195 | VOLTAGE_400 = 400, |
| 196 | VOLTAGE_800 = 800 |
| 197 | } |
| 198 | |
| 199 | export enum AmpereUnits { |
| 200 | MILLI_AMPERE = 'mA', |
| 201 | CENTI_AMPERE = 'cA', |
| 202 | DECI_AMPERE = 'dA', |
| 203 | AMPERE = 'A' |
| 204 | } |
| 205 | |
| 206 | export type ConnectorStatus = { |
| 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 | } |
| 221 | |
| 222 | export type EvseStatus = { |
| 223 | availability: AvailabilityType |
| 224 | connectors?: ConnectorStatus[] |
| 225 | } |
| 226 | |
| 227 | export enum OCPP16AvailabilityType { |
| 228 | INOPERATIVE = 'Inoperative', |
| 229 | OPERATIVE = 'Operative' |
| 230 | } |
| 231 | export type AvailabilityType = OCPP16AvailabilityType |
| 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', |
| 243 | FAULTED = 'Faulted' |
| 244 | } |
| 245 | export type ChargePointStatus = OCPP16ChargePointStatus |
| 246 | |
| 247 | export type Status = { |
| 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 | } |