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