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