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