openbyd 0.0.0-stage → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,461 @@
1
+ import type { AcCurrentLimit, AcCurrentLimitOptions, BatteryHeatParams, BookingList, CapabilitiesOptions, CarFeatures, CarScheduleOptions, ChargeChangeResult, ChargePollOptions, ChargingHomepage, ChargingStatus, ClimateOptions, ClimateScheduleParams, ClimateStartParams, CommandAck, CommandAckDiagnostics, CommandOptions, EnergyConsumption, EnergyType, GpsInfo, HvacStatus, JsonObject, NotificationOptions, PollOptions, PushNotificationState, PushStateOptions, RemoteControlResult, SaveScheduleOptions, SeatClimateParams, SeatLevel, SeatMode, SeatPosition, SeedOptions, SessionInfo, SessionTokens, SmartChargingSchedule, Vehicle, VehicleCapabilities, VehicleLatestConfig, VehicleMsgItemInfo, VehicleRealtimeData, VehicleSnapshot, VerifyControlPasswordResponse } from "./models.js";
2
+ /** The client's methods: pyBYD's `BydClient`. `Client` (client.ts) completes it. */
3
+ export declare abstract class ClientMethods {
4
+ #private;
5
+ /** Log in with the password and start MQTT. */
6
+ login(): Promise<void>;
7
+ /** The current session, logging in first when there is none or it expired. */
8
+ ensureSession(): Promise<SessionInfo>;
9
+ /** Forget the session; the next call logs in again. Command access stays verified. */
10
+ invalidateSession(): void;
11
+ /**
12
+ * The session as an application stores it, or null when logged out. Give it to
13
+ * `import_session` to resume without a password login.
14
+ */
15
+ exportSession(): SessionTokens | null;
16
+ /**
17
+ * Use a session from `export_session` as if a login had returned it, and start MQTT.
18
+ *
19
+ * @param session - The saved session.
20
+ */
21
+ importSession(session: SessionTokens): Promise<void>;
22
+ /** Whether remote commands are available: true once `verify_command_access` succeeded. */
23
+ get commandsEnabled(): boolean;
24
+ /** Whether the MQTT push channel is connected or connecting. */
25
+ get mqttIsRunning(): boolean;
26
+ /** Start MQTT for the current session if it is not running, as a login does. */
27
+ startMqtt(): Promise<void>;
28
+ /** Counters of command acknowledgements: pending, matched, expired, uncorrelated. */
29
+ getCommandAckDiagnostics(): CommandAckDiagnostics;
30
+ /** The account's vehicles. */
31
+ getVehicles(): Promise<Vehicle[]>;
32
+ /**
33
+ * Cache a vehicle's metadata as if the vehicle list had returned it, so realtime, energy and
34
+ * AC-limit reads need no vehicle list.
35
+ *
36
+ * @param vin - The vehicle identification number.
37
+ *
38
+ * @param energyType - The powertrain: EV, ICE or hybrid.
39
+ */
40
+ seedVehicleMetadata(vin: string, energyType: EnergyType, options?: SeedOptions): void;
41
+ /**
42
+ * The cached metadata of a vehicle, or null when unknown.
43
+ *
44
+ * @param vin - The vehicle identification number.
45
+ */
46
+ vehicleMetadata(vin: string): Vehicle | null;
47
+ /**
48
+ * The latest config of each VIN the cloud knows, by VIN.
49
+ *
50
+ * @param vins - The vehicles to ask about.
51
+ */
52
+ getLatestConfigs(vins: string[]): Promise<Record<string, VehicleLatestConfig>>;
53
+ /**
54
+ * The latest config of a vehicle. Fails with `BydDataUnavailableError` when the reply has
55
+ * none.
56
+ *
57
+ * @param vin - The vehicle identification number.
58
+ */
59
+ getLatestConfig(vin: string): Promise<VehicleLatestConfig>;
60
+ /**
61
+ * What the vehicle supports, cached. A failed fetch gives unknown capabilities.
62
+ *
63
+ * @param vin - The vehicle identification number.
64
+ */
65
+ getVehicleCapabilities(vin: string, options?: CapabilitiesOptions): Promise<VehicleCapabilities>;
66
+ /**
67
+ * Realtime data: trigger a refresh, wait for the MQTT push, poll over HTTP if it does not
68
+ * come.
69
+ *
70
+ * @param vin - The vehicle identification number.
71
+ */
72
+ getVehicleRealtime(vin: string, options?: PollOptions): Promise<VehicleRealtimeData>;
73
+ /**
74
+ * The vehicle's position: trigger, wait for the push, poll if it does not come.
75
+ *
76
+ * @param vin - The vehicle identification number.
77
+ */
78
+ getGpsInfo(vin: string, options?: PollOptions): Promise<GpsInfo>;
79
+ /**
80
+ * Climate status.
81
+ *
82
+ * @param vin - The vehicle identification number.
83
+ */
84
+ getHvacStatus(vin: string): Promise<HvacStatus>;
85
+ /**
86
+ * Charging status.
87
+ *
88
+ * @param vin - The vehicle identification number.
89
+ */
90
+ getChargingStatus(vin: string): Promise<ChargingStatus>;
91
+ /**
92
+ * The smart-charging schedule.
93
+ *
94
+ * @param vin - The vehicle identification number.
95
+ */
96
+ getChargingSchedule(vin: string): Promise<SmartChargingSchedule>;
97
+ /**
98
+ * Live charging state and the schedule, from one call.
99
+ *
100
+ * @param vin - The vehicle identification number.
101
+ */
102
+ getChargingHomepage(vin: string): Promise<ChargingHomepage>;
103
+ /**
104
+ * The supported and active AC charging current limits.
105
+ *
106
+ * @param vin - The vehicle identification number.
107
+ */
108
+ getAcCurrentLimit(vin: string, options?: AcCurrentLimitOptions): Promise<AcCurrentLimit>;
109
+ /**
110
+ * Energy consumption, asked with the vehicle's energy type and model.
111
+ *
112
+ * @param vin - The vehicle identification number.
113
+ */
114
+ getEnergyConsumption(vin: string): Promise<EnergyConsumption>;
115
+ /**
116
+ * Push notification state.
117
+ *
118
+ * @param vin - The vehicle identification number.
119
+ */
120
+ getPushState(vin: string): Promise<PushNotificationState>;
121
+ /**
122
+ * Turn a push notification type on or off.
123
+ *
124
+ * @param vin - The vehicle identification number.
125
+ *
126
+ * @param enable - On or off.
127
+ */
128
+ setPushState(vin: string, enable: boolean, options?: PushStateOptions): Promise<CommandAck>;
129
+ /** The account's unread inbox messages of one category. */
130
+ getNotifications(options?: NotificationOptions): Promise<VehicleMsgItemInfo[]>;
131
+ /** The unread inbox messages of every category, by category value. */
132
+ getAllNotifications(): Promise<Record<number, VehicleMsgItemInfo[]>>;
133
+ /**
134
+ * Rename the vehicle.
135
+ *
136
+ * @param vin - The vehicle identification number.
137
+ *
138
+ * @param name - The new name.
139
+ */
140
+ renameVehicle(vin: string, name: string): Promise<CommandAck>;
141
+ /**
142
+ * The scheduled-climate timers.
143
+ *
144
+ * @param vin - The vehicle identification number.
145
+ */
146
+ getBookingList(vin: string): Promise<BookingList>;
147
+ /**
148
+ * Check the control PIN once and enable remote commands.
149
+ *
150
+ * @param vin - The vehicle identification number.
151
+ */
152
+ verifyCommandAccess(vin: string, options?: CommandOptions): Promise<VerifyControlPasswordResponse>;
153
+ /**
154
+ * Lock the vehicle.
155
+ *
156
+ * @param vin - The vehicle identification number.
157
+ */
158
+ lock(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
159
+ /**
160
+ * Unlock the vehicle.
161
+ *
162
+ * @param vin - The vehicle identification number.
163
+ */
164
+ unlock(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
165
+ /**
166
+ * Stop climate control.
167
+ *
168
+ * @param vin - The vehicle identification number.
169
+ */
170
+ stopClimate(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
171
+ /**
172
+ * Flash the lights.
173
+ *
174
+ * @param vin - The vehicle identification number.
175
+ */
176
+ flashLights(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
177
+ /**
178
+ * Close all windows.
179
+ *
180
+ * @param vin - The vehicle identification number.
181
+ */
182
+ closeWindows(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
183
+ /**
184
+ * Open the windows to a vent crack of about 10 %.
185
+ *
186
+ * @param vin - The vehicle identification number.
187
+ */
188
+ openWindows(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
189
+ /**
190
+ * Horn and lights.
191
+ *
192
+ * @param vin - The vehicle identification number.
193
+ */
194
+ findCar(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
195
+ /**
196
+ * Release the trunk.
197
+ *
198
+ * @param vin - The vehicle identification number.
199
+ */
200
+ openTrunk(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
201
+ /**
202
+ * Lower the trunk.
203
+ *
204
+ * @param vin - The vehicle identification number.
205
+ */
206
+ closeTrunk(vin: string, options?: CommandOptions): Promise<RemoteControlResult>;
207
+ /**
208
+ * Start climate control.
209
+ *
210
+ * @param vin - The vehicle identification number.
211
+ *
212
+ * @param params - The `ClimateStartParams` fields.
213
+ */
214
+ startClimate(vin: string, params: ClimateStartParams, options?: CommandOptions): Promise<RemoteControlResult>;
215
+ /**
216
+ * Schedule climate control.
217
+ *
218
+ * @param vin - The vehicle identification number.
219
+ *
220
+ * @param params - The `ClimateScheduleParams` fields.
221
+ */
222
+ scheduleClimate(vin: string, params: ClimateScheduleParams, options?: CommandOptions): Promise<RemoteControlResult>;
223
+ /**
224
+ * Set seat heating and ventilation.
225
+ *
226
+ * @param vin - The vehicle identification number.
227
+ *
228
+ * @param params - The `SeatClimateParams` fields.
229
+ */
230
+ setSeatClimate(vin: string, params: SeatClimateParams, options?: CommandOptions): Promise<RemoteControlResult>;
231
+ /**
232
+ * Turn battery heating on or off.
233
+ *
234
+ * @param vin - The vehicle identification number.
235
+ *
236
+ * @param params - The `BatteryHeatParams` fields.
237
+ */
238
+ setBatteryHeat(vin: string, params: BatteryHeatParams, options?: CommandOptions): Promise<RemoteControlResult>;
239
+ /**
240
+ * Save a smart-charging schedule and wait for the change to settle.
241
+ *
242
+ * @param vin - The vehicle identification number.
243
+ *
244
+ * @param startChargeTime - When charging starts, `HH:MM`.
245
+ *
246
+ * @param endChargeTime - When charging ends, `HH:MM`, or `full`.
247
+ *
248
+ * @param chargeWay - `s` (single), `e` (every day) or weekday indices.
249
+ */
250
+ saveChargingSchedule(vin: string, startChargeTime: string, endChargeTime: string, chargeWay: string, options?: SaveScheduleOptions): Promise<ChargeChangeResult>;
251
+ /**
252
+ * Turn smart charging on or off.
253
+ *
254
+ * @param vin - The vehicle identification number.
255
+ *
256
+ * @param enable - On or off.
257
+ */
258
+ toggleSmartCharging(vin: string, enable: boolean): Promise<CommandAck>;
259
+ /**
260
+ * Start charging now and wait for the change to settle.
261
+ *
262
+ * @param vin - The vehicle identification number.
263
+ */
264
+ startCharging(vin: string, options?: ChargePollOptions): Promise<ChargeChangeResult>;
265
+ /**
266
+ * Always fails with `BydEndpointNotSupportedError`: the cloud cannot stop a charge (as pyBYD).
267
+ *
268
+ * @param vin - The vehicle identification number.
269
+ */
270
+ stopCharging(vin: string, options?: ChargePollOptions): Promise<ChargeChangeResult>;
271
+ }
272
+ /** `car.lock`: lock and unlock the doors. */
273
+ export declare class LockFeature {
274
+ #private;
275
+ /** Whether the car supports locking. */
276
+ get available(): boolean;
277
+ /** Lock all doors; the door locks read locked at once. */
278
+ lock(): Promise<void>;
279
+ /** Unlock all doors; the door locks read unlocked at once. */
280
+ unlock(): Promise<void>;
281
+ }
282
+ /** `car.hvac`: start, stop and schedule climate control. */
283
+ export declare class HvacFeature {
284
+ #private;
285
+ /** Whether the car supports remote climate control. */
286
+ get available(): boolean;
287
+ /** °C offset of the car's 1-17 temperature scale, from the last HVAC status. */
288
+ get tempOffset(): number;
289
+ /** The settable temperature range in °C: lowest, highest. */
290
+ get tempRange(): number[];
291
+ /**
292
+ * Start climate control, or change a running session's settings. Without a known HVAC status
293
+ * the status is fetched first, as pyBYD does.
294
+ */
295
+ start(options?: ClimateOptions): Promise<void>;
296
+ /** Stop climate control, including seat and steering wheel heating. */
297
+ stop(): Promise<void>;
298
+ /**
299
+ * Create, change or remove a climate schedule.
300
+ *
301
+ * @param params - The `ClimateScheduleParams` fields.
302
+ */
303
+ schedule(params: ClimateScheduleParams): Promise<void>;
304
+ }
305
+ /** `car.seat`: seat heating and ventilation. */
306
+ export declare class SeatFeature {
307
+ #private;
308
+ /** Whether a seat can be heated or ventilated. */
309
+ isAvailable(position: SeatPosition, mode: SeatMode): boolean;
310
+ /**
311
+ * Set the heating of one seat.
312
+ *
313
+ * @param position - The seat.
314
+ *
315
+ * @param level - Off, low or high.
316
+ */
317
+ heat(position: SeatPosition, level: SeatLevel): Promise<void>;
318
+ /**
319
+ * Set the ventilation of one seat.
320
+ *
321
+ * @param position - The seat.
322
+ *
323
+ * @param level - Off, low or high.
324
+ */
325
+ ventilation(position: SeatPosition, level: SeatLevel): Promise<void>;
326
+ }
327
+ /** `car.steering`: steering wheel heating. */
328
+ export declare class SteeringFeature {
329
+ #private;
330
+ /** Whether the car has steering wheel heating. */
331
+ get available(): boolean;
332
+ /**
333
+ * Turn steering wheel heating on or off.
334
+ *
335
+ * @param on - On or off.
336
+ */
337
+ heat(on: boolean): Promise<void>;
338
+ }
339
+ /** `car.battery`: battery heating. */
340
+ export declare class BatteryFeature {
341
+ #private;
342
+ /** Whether the car supports battery heating. */
343
+ get available(): boolean;
344
+ /**
345
+ * Turn battery heating on or off.
346
+ *
347
+ * @param on - On or off.
348
+ */
349
+ heat(on: boolean): Promise<void>;
350
+ }
351
+ /** `car.finder`: find the car, flash the lights. */
352
+ export declare class FinderFeature {
353
+ #private;
354
+ /** Whether the car supports find-my-car. */
355
+ get findAvailable(): boolean;
356
+ /** Whether the car can flash its lights remotely. */
357
+ get flashAvailable(): boolean;
358
+ /** Horn and lights. */
359
+ find(): Promise<void>;
360
+ /** Flash the lights. */
361
+ flashLights(): Promise<void>;
362
+ }
363
+ /** `car.windows`: close the windows or crack them open. */
364
+ export declare class WindowsFeature {
365
+ #private;
366
+ /** Whether the car can close its windows remotely. */
367
+ get closeAvailable(): boolean;
368
+ /** Whether the car can open its windows remotely (to a vent crack). */
369
+ get openAvailable(): boolean;
370
+ /** Close all windows. */
371
+ close(): Promise<void>;
372
+ /** Open the windows to a vent crack of about 10 %. */
373
+ open(): Promise<void>;
374
+ }
375
+ /** `car.trunk`: open and close the trunk. */
376
+ export declare class TrunkFeature {
377
+ #private;
378
+ /** Whether the trunk can be opened remotely. */
379
+ get openAvailable(): boolean;
380
+ /** Whether the trunk can be closed remotely. */
381
+ get closeAvailable(): boolean;
382
+ /** Release the trunk. */
383
+ open(): Promise<void>;
384
+ /** Lower the trunk. */
385
+ close(): Promise<void>;
386
+ }
387
+ /** A car's methods: pyBYD's `BydCar`. `Car` (car.ts) completes it. */
388
+ export declare abstract class CarMethods {
389
+ #private;
390
+ /** Lock and unlock the doors. */
391
+ readonly lock: LockFeature;
392
+ /** Start, stop and schedule climate control. */
393
+ readonly hvac: HvacFeature;
394
+ /** Seat heating and ventilation. */
395
+ readonly seat: SeatFeature;
396
+ /** Steering wheel heating. */
397
+ readonly steering: SteeringFeature;
398
+ /** Battery heating. */
399
+ readonly battery: BatteryFeature;
400
+ /** Find the car, flash the lights. */
401
+ readonly finder: FinderFeature;
402
+ /** Close the windows or crack them open. */
403
+ readonly windows: WindowsFeature;
404
+ /** Open and close the trunk. */
405
+ readonly trunk: TrunkFeature;
406
+ /** The current state with active projections laid over it, by section. */
407
+ get state(): VehicleSnapshot;
408
+ /** The car's capability flags. */
409
+ get capabilities(): VehicleCapabilities;
410
+ /** Every feature's availability, and the climate scale. */
411
+ get features(): CarFeatures;
412
+ /** Fetch realtime data and merge it; returns the data as fetched. */
413
+ updateRealtime(): Promise<VehicleRealtimeData>;
414
+ /** Fetch the HVAC status and merge it. */
415
+ updateHvac(): Promise<HvacStatus>;
416
+ /** Fetch the location and merge it. */
417
+ updateGps(): Promise<GpsInfo>;
418
+ /**
419
+ * Fetch the charging state and the schedule in one call and merge both; returns the charging
420
+ * state.
421
+ */
422
+ updateCharging(): Promise<ChargingStatus>;
423
+ /** Fetch energy consumption and merge it. */
424
+ updateEnergy(): Promise<EnergyConsumption>;
425
+ /** Start charging now and wait for the change to settle. */
426
+ startCharging(): Promise<ChargeChangeResult>;
427
+ /** Always fails with `BydEndpointNotSupportedError`: the cloud cannot stop a charge. */
428
+ stopCharging(): Promise<ChargeChangeResult>;
429
+ /** The supported and active AC charging current limits. */
430
+ getAcCurrentLimit(): Promise<AcCurrentLimit>;
431
+ /**
432
+ * Save a smart-charging schedule, wait for it to settle, then refresh the charging state.
433
+ *
434
+ * @param startChargeTime - When charging starts, `HH:MM`.
435
+ *
436
+ * @param endChargeTime - When charging ends, `HH:MM`, or `full`.
437
+ *
438
+ * @param chargeWay - `s` (single), `e` (every day) or weekday indices.
439
+ */
440
+ saveChargingSchedule(startChargeTime: string, endChargeTime: string, chargeWay: string, options?: CarScheduleOptions): Promise<ChargeChangeResult>;
441
+ /**
442
+ * Merge a `vehicleInfo` push (its raw `respondData`), after any command in flight.
443
+ *
444
+ * @param data - The push's `respondData`.
445
+ */
446
+ handleMqttRealtime(data: JsonObject): void;
447
+ /**
448
+ * Merge a `smartCharge` push (its raw `respondData`) (live charging state only).
449
+ *
450
+ * @param data - The push's `respondData`.
451
+ */
452
+ handleMqttCharging(data: JsonObject): void;
453
+ /**
454
+ * Merge a `energyConsumption` push (its raw `respondData`).
455
+ *
456
+ * @param data - The push's `respondData`.
457
+ */
458
+ handleMqttEnergy(data: JsonObject): void;
459
+ /** Release the car's resources (nothing yet; pyBYD's lifecycle hook). */
460
+ close(): void;
461
+ }