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