@teslemetry/api 0.6.7 → 0.6.9

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.
package/dist/index.cjs CHANGED
@@ -3043,7 +3043,7 @@ var TeslemetryVehicleStream = class extends events.EventEmitter {
3043
3043
  this._pendingFields = {};
3044
3044
  } else this.logger.error(`Error updating streaming config for ${this.vin}`, data);
3045
3045
  this._debounceTimeout = null;
3046
- }, 100);
3046
+ }, 1e3);
3047
3047
  }
3048
3048
  /** Modify the field configuration of the vehicle */
3049
3049
  async patchConfig(fields) {
@@ -3359,6 +3359,22 @@ function formatDate(date) {
3359
3359
  return date.toISOString().replace(/\.\d{3}Z$/, "Z");
3360
3360
  }
3361
3361
  /**
3362
+ * Gets the start of today (midnight) in local timezone
3363
+ * @returns Date object set to today at 00:00:00.000
3364
+ */
3365
+ function getStartOfToday() {
3366
+ const now = /* @__PURE__ */ new Date();
3367
+ return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0);
3368
+ }
3369
+ /**
3370
+ * Gets the end of today (23:59:59.999) in local timezone
3371
+ * @returns Date object set to today at 23:59:59.999
3372
+ */
3373
+ function getEndOfToday() {
3374
+ const now = /* @__PURE__ */ new Date();
3375
+ return new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0, 0);
3376
+ }
3377
+ /**
3362
3378
  * Processes start_date and end_date inputs for API calls.
3363
3379
  * Handles string (taken as-is), Date (formatted), or undefined (defaults to today).
3364
3380
  *
@@ -3597,7 +3613,7 @@ var TeslemetryEnergyApi = class extends events.EventEmitter {
3597
3613
  const { data } = await getApi1EnergySitesByIdTelemetryHistory({
3598
3614
  query: {
3599
3615
  kind: "charge",
3600
- ...processDateRange(start_date, end_date),
3616
+ ...processDateRange(start_date ?? getStartOfToday(), end_date ?? getEndOfToday()),
3601
3617
  time_zone
3602
3618
  },
3603
3619
  path: { id: this.siteId },
@@ -5204,7 +5220,7 @@ const consoleLogger = {
5204
5220
 
5205
5221
  //#endregion
5206
5222
  //#region package.json
5207
- var version = "0.6.7";
5223
+ var version = "0.6.9";
5208
5224
 
5209
5225
  //#endregion
5210
5226
  //#region src/Teslemetry.ts
package/dist/index.d.cts CHANGED
@@ -2,6 +2,17 @@ import { EventEmitter } from "events";
2
2
 
3
3
  //#region src/client/types.gen.d.ts
4
4
 
5
+ /**
6
+ * errorResponse
7
+ *
8
+ * Error response
9
+ */
10
+ type Def0 = {
11
+ response?: null;
12
+ error: string;
13
+ error_description?: string;
14
+ [key: string]: unknown | null | string | undefined;
15
+ };
5
16
  type GetApiMetadataResponses = {
6
17
  /**
7
18
  * Default Response
@@ -1106,14 +1117,14 @@ type GetApiConfigByVinResponses = {
1106
1117
  resend_interval_seconds?: number;
1107
1118
  };
1108
1119
  /**
1109
- * If the vehicle is located at the active driver profiles saved home location. (Requires 2024.44.32)
1120
+ * If the vehicle is located at the active driver profile's saved home location. (Requires 2024.44.32)
1110
1121
  */
1111
1122
  LocatedAtHome?: {
1112
1123
  interval_seconds: number;
1113
1124
  resend_interval_seconds?: number;
1114
1125
  };
1115
1126
  /**
1116
- * If the vehicle is located at the active driver profiles saved work location. (Requires 2024.44.32)
1127
+ * If the vehicle is located at the active driver profile's saved work location. (Requires 2024.44.32)
1117
1128
  */
1118
1129
  LocatedAtWork?: {
1119
1130
  interval_seconds: number;
@@ -2925,14 +2936,14 @@ type PatchApiConfigByVinData = {
2925
2936
  resend_interval_seconds?: number;
2926
2937
  } | null;
2927
2938
  /**
2928
- * If the vehicle is located at the active driver profiles saved home location. (Requires 2024.44.32)
2939
+ * If the vehicle is located at the active driver profile's saved home location. (Requires 2024.44.32)
2929
2940
  */
2930
2941
  LocatedAtHome?: {
2931
2942
  interval_seconds: number;
2932
2943
  resend_interval_seconds?: number;
2933
2944
  } | null;
2934
2945
  /**
2935
- * If the vehicle is located at the active driver profiles saved work location. (Requires 2024.44.32)
2946
+ * If the vehicle is located at the active driver profile's saved work location. (Requires 2024.44.32)
2936
2947
  */
2937
2948
  LocatedAtWork?: {
2938
2949
  interval_seconds: number;
@@ -4749,14 +4760,14 @@ type PostApiConfigByVinData = {
4749
4760
  resend_interval_seconds?: number;
4750
4761
  } | null;
4751
4762
  /**
4752
- * If the vehicle is located at the active driver profiles saved home location. (Requires 2024.44.32)
4763
+ * If the vehicle is located at the active driver profile's saved home location. (Requires 2024.44.32)
4753
4764
  */
4754
4765
  LocatedAtHome?: {
4755
4766
  interval_seconds: number;
4756
4767
  resend_interval_seconds?: number;
4757
4768
  } | null;
4758
4769
  /**
4759
- * If the vehicle is located at the active driver profiles saved work location. (Requires 2024.44.32)
4770
+ * If the vehicle is located at the active driver profile's saved work location. (Requires 2024.44.32)
4760
4771
  */
4761
4772
  LocatedAtWork?: {
4762
4773
  interval_seconds: number;
@@ -6664,14 +6675,14 @@ type GetApi1VehiclesByVinFleetTelemetryConfigResponses = {
6664
6675
  resend_interval_seconds?: number;
6665
6676
  };
6666
6677
  /**
6667
- * If the vehicle is located at the active driver profiles saved home location. (Requires 2024.44.32)
6678
+ * If the vehicle is located at the active driver profile's saved home location. (Requires 2024.44.32)
6668
6679
  */
6669
6680
  LocatedAtHome?: {
6670
6681
  interval_seconds: number;
6671
6682
  resend_interval_seconds?: number;
6672
6683
  };
6673
6684
  /**
6674
- * If the vehicle is located at the active driver profiles saved work location. (Requires 2024.44.32)
6685
+ * If the vehicle is located at the active driver profile's saved work location. (Requires 2024.44.32)
6675
6686
  */
6676
6687
  LocatedAtWork?: {
6677
6688
  interval_seconds: number;
@@ -8003,8 +8014,7 @@ type GetApi1EnergySitesByIdTelemetryHistoryResponses = {
8003
8014
  */
8004
8015
  200: {
8005
8016
  response?: {
8006
- period?: string;
8007
- time_series?: Array<{
8017
+ charge_history?: Array<{
8008
8018
  charge_start_time?: {
8009
8019
  seconds?: number;
8010
8020
  };
@@ -8012,6 +8022,10 @@ type GetApi1EnergySitesByIdTelemetryHistoryResponses = {
8012
8022
  seconds?: number;
8013
8023
  };
8014
8024
  energy_added_wh?: number;
8025
+ target_id?: {
8026
+ text?: string;
8027
+ };
8028
+ din?: string;
8015
8029
  }>;
8016
8030
  };
8017
8031
  };
@@ -8408,8 +8422,8 @@ type GetSseByVin_Responses = {
8408
8422
  ChargeAmps?: number | null;
8409
8423
  ChargeCurrentRequest?: number | null;
8410
8424
  ChargeCurrentRequestMax?: number | null;
8411
- ChargeEnableRequest?: number | null;
8412
- ChargeLimitSoc?: boolean | null;
8425
+ ChargeEnableRequest?: boolean | null;
8426
+ ChargeLimitSoc?: number | null;
8413
8427
  ChargePort?: 'ChargePortUnknown' | 'ChargePortUS' | 'ChargePortEU' | 'ChargePortGB' | 'ChargePortCCS' | null;
8414
8428
  ChargePortColdWeatherMode?: boolean | null;
8415
8429
  ChargePortDoorOpen?: boolean | null;
@@ -8428,7 +8442,7 @@ type GetSseByVin_Responses = {
8428
8442
  DCChargingEnergyIn?: number | null;
8429
8443
  DCChargingPower?: number | null;
8430
8444
  DCDCEnable?: boolean | null;
8431
- DefrostForPreconditioning?: number | null;
8445
+ DefrostForPreconditioning?: boolean | null;
8432
8446
  DefrostMode?: 'DefrostModeStateUnknown' | 'DefrostModeStateOff' | 'DefrostModeStateNormal' | 'DefrostModeStateMax' | 'DefrostModeStateAutoDefog' | null;
8433
8447
  DestinationLocation?: {
8434
8448
  latitude: number;
@@ -8478,15 +8492,15 @@ type GetSseByVin_Responses = {
8478
8492
  TrunkFront: boolean;
8479
8493
  TrunkRear: boolean;
8480
8494
  } | null;
8481
- DriveRail?: number | null;
8495
+ DriveRail?: boolean | null;
8482
8496
  DriverSeatBelt?: 'BuckleStatusUnknown' | 'BuckleStatusUnlatched' | 'BuckleStatusLatched' | 'BuckleStatusFaulted' | null;
8483
8497
  DriverSeatOccupied?: boolean | null;
8484
- EfficiencyPackage?: number | null;
8485
- EmergencyLaneDepartureAvoidance?: number | null;
8498
+ EfficiencyPackage?: string | null;
8499
+ EmergencyLaneDepartureAvoidance?: boolean | null;
8486
8500
  EnergyRemaining?: number | null;
8487
8501
  EstBatteryRange?: number | null;
8488
8502
  EstimatedHoursToChargeTermination?: number | null;
8489
- EuropeVehicle?: number | null;
8503
+ EuropeVehicle?: boolean | null;
8490
8504
  ExpectedEnergyPercentAtTripArrival?: number | null;
8491
8505
  ExteriorColor?: string | null;
8492
8506
  FastChargerPresent?: boolean | null;
@@ -8508,7 +8522,7 @@ type GetSseByVin_Responses = {
8508
8522
  HvacLeftTemperatureRequest?: number | null;
8509
8523
  HvacPower?: 'HvacPowerStateUnknown' | 'HvacPowerStateOff' | 'HvacPowerStateOn' | 'HvacPowerStatePrecondition' | 'HvacPowerStateOverheatProtect' | null;
8510
8524
  HvacRightTemperatureRequest?: number | null;
8511
- HvacSteeringWheelHeatAuto?: number | null;
8525
+ HvacSteeringWheelHeatAuto?: boolean | null;
8512
8526
  HvacSteeringWheelHeatLevel?: number | null;
8513
8527
  Hvil?: 'HvilStatusUnknown' | 'HvilStatusFault' | 'HvilStatusOK' | null;
8514
8528
  IdealBatteryRange?: number | null;
@@ -8522,9 +8536,9 @@ type GetSseByVin_Responses = {
8522
8536
  LightsHazardsActive?: boolean | null;
8523
8537
  LightsHighBeams?: boolean | null;
8524
8538
  LightsTurnSignal?: 'TurnSignalStateUnknown' | 'TurnSignalStateOff' | 'TurnSignalStateLeft' | 'TurnSignalStateRight' | 'TurnSignalStateBoth' | null;
8525
- LocatedAtFavorite?: number | null;
8526
- LocatedAtHome?: number | null;
8527
- LocatedAtWork?: number | null;
8539
+ LocatedAtFavorite?: boolean | null;
8540
+ LocatedAtHome?: boolean | null;
8541
+ LocatedAtWork?: boolean | null;
8528
8542
  Location?: {
8529
8543
  latitude: number;
8530
8544
  longitude: number;
@@ -8547,7 +8561,7 @@ type GetSseByVin_Responses = {
8547
8561
  MinutesToArrival?: number | null;
8548
8562
  ModuleTempMax?: number | null;
8549
8563
  ModuleTempMin?: number | null;
8550
- NotEnoughPowerToHeat?: number | null;
8564
+ NotEnoughPowerToHeat?: boolean | null;
8551
8565
  NumBrickVoltageMax?: number | null;
8552
8566
  NumBrickVoltageMin?: number | null;
8553
8567
  NumModuleTempMax?: number | null;
@@ -8575,7 +8589,7 @@ type GetSseByVin_Responses = {
8575
8589
  RdWindow?: 'WindowStateUnknown' | 'WindowStateClosed' | 'WindowStatePartiallyOpen' | 'WindowStateOpened' | null;
8576
8590
  RearDefrostEnabled?: boolean | null;
8577
8591
  RearDisplayHvacEnabled?: boolean | null;
8578
- RearSeatHeaters?: number | null;
8592
+ RearSeatHeaters?: string | null;
8579
8593
  RemoteStartEnabled?: boolean | null;
8580
8594
  RightHandDrive?: boolean | null;
8581
8595
  RoofColor?: string | null;
@@ -8584,7 +8598,7 @@ type GetSseByVin_Responses = {
8584
8598
  RouteTrafficMinutesDelay?: number | null;
8585
8599
  RpWindow?: 'WindowStateUnknown' | 'WindowStateClosed' | 'WindowStatePartiallyOpen' | 'WindowStateOpened' | null;
8586
8600
  ScheduledChargingMode?: 'ScheduledChargingModeUnknown' | 'ScheduledChargingModeOff' | 'ScheduledChargingModeStartAt' | 'ScheduledChargingModeDepartBy' | null;
8587
- ScheduledChargingPending?: number | null;
8601
+ ScheduledChargingPending?: boolean | null;
8588
8602
  ScheduledChargingStartTime?: number | null;
8589
8603
  ScheduledDepartureTime?: number | null;
8590
8604
  SeatHeaterLeft?: number | null;
@@ -10590,8 +10604,7 @@ declare class TeslemetryEnergyApi extends EventEmitter {
10590
10604
  */
10591
10605
  getTelemetryHistory(start_date?: DateInput, end_date?: DateInput, time_zone?: string): Promise<{
10592
10606
  response?: {
10593
- period?: string;
10594
- time_series?: Array<{
10607
+ charge_history?: Array<{
10595
10608
  charge_start_time?: {
10596
10609
  seconds?: number;
10597
10610
  };
@@ -10599,6 +10612,10 @@ declare class TeslemetryEnergyApi extends EventEmitter {
10599
10612
  seconds?: number;
10600
10613
  };
10601
10614
  energy_added_wh?: number;
10615
+ target_id?: {
10616
+ text?: string;
10617
+ };
10618
+ din?: string;
10602
10619
  }>;
10603
10620
  };
10604
10621
  }>;
@@ -10756,7 +10773,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10756
10773
  * Refresh the cached vehicle data immediately. Consumes 2 command credits.
10757
10774
  * @return Promise to an object with response containing confirmation of refresh
10758
10775
  */
10759
- refreshData(): Promise<unknown>;
10776
+ refreshData(): Promise<Def0>;
10760
10777
  /**
10761
10778
  * Get the saved vehicle config.
10762
10779
  * @return Promise to an object with response containing the vehicle configuration
@@ -10827,11 +10844,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10827
10844
  BrakePedalPos?: {
10828
10845
  interval_seconds: number;
10829
10846
  resend_interval_seconds?: number;
10830
- minimum_delta
10831
- /**
10832
- * Stops climate preconditioning.
10833
- * @return Promise to an object with response containing auto conditioning stop result
10834
- */?: number;
10847
+ minimum_delta?: number;
10835
10848
  };
10836
10849
  BrickVoltageMax?: {
10837
10850
  interval_seconds: number;
@@ -10876,12 +10889,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10876
10889
  };
10877
10890
  ChargeEnableRequest?: {
10878
10891
  interval_seconds: number;
10879
- resend_interval_seconds?
10880
- /**
10881
- * Skips to the next track in media playback.
10882
- * @return Promise to an object with response containing media next track result
10883
- */
10884
- : number;
10892
+ resend_interval_seconds?: number;
10885
10893
  };
10886
10894
  ChargeLimitSoc?: {
10887
10895
  interval_seconds: number;
@@ -10890,7 +10898,18 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10890
10898
  };
10891
10899
  ChargePort?: {
10892
10900
  interval_seconds: number;
10893
- resend_interval_seconds?: number;
10901
+ resend_interval_seconds
10902
+ /**
10903
+ * Enable/disable guest mode.
10904
+ * @param enable Whether to enable guest mode
10905
+ * @return Promise to an object with response containing guest mode set result
10906
+ */?
10907
+ /**
10908
+ * Enable/disable guest mode.
10909
+ * @param enable Whether to enable guest mode
10910
+ * @return Promise to an object with response containing guest mode set result
10911
+ */
10912
+ : number;
10894
10913
  };
10895
10914
  ChargePortColdWeatherMode?: {
10896
10915
  interval_seconds: number;
@@ -10931,7 +10950,11 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10931
10950
  interval_seconds: number;
10932
10951
  resend_interval_seconds?: number;
10933
10952
  };
10934
- ClimateSeatCoolingFrontLeft?: {
10953
+ ClimateSeatCoolingFrontLeft
10954
+ /**
10955
+ * Starts the vehicle remotely.
10956
+ * @return Promise to an object with response containing remote start result
10957
+ */?: {
10935
10958
  interval_seconds: number;
10936
10959
  resend_interval_seconds?: number;
10937
10960
  minimum_delta?: number;
@@ -10941,21 +10964,9 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10941
10964
  resend_interval_seconds?: number;
10942
10965
  minimum_delta?: number;
10943
10966
  };
10944
- CruiseFollowDistance
10945
- /**
10946
- * Sets the target temperature for the driver and passenger.
10947
- * @param driver_temp Driver temperature in Celsius
10948
- * @param passenger_temp Passenger temperature in Celsius
10949
- * @return Promise to an object with response containing temperature set result
10950
- */?: {
10967
+ CruiseFollowDistance?: {
10951
10968
  interval_seconds: number;
10952
- resend_interval_seconds
10953
- /**
10954
- * Sets the target temperature for the driver and passenger.
10955
- * @param driver_temp Driver temperature in Celsius
10956
- * @param passenger_temp Passenger temperature in Celsius
10957
- * @return Promise to an object with response containing temperature set result
10958
- */?: number;
10969
+ resend_interval_seconds?: number;
10959
10970
  };
10960
10971
  CruiseSetSpeed?: {
10961
10972
  interval_seconds: number;
@@ -11054,16 +11065,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
11054
11065
  DiInverterTREL?: {
11055
11066
  interval_seconds: number;
11056
11067
  resend_interval_seconds?: number;
11057
- minimum_delta
11058
- /**
11059
- * Opens the charge port door.
11060
- * @return Promise to an object with response containing charge port open result
11061
- */?
11062
- /**
11063
- * Opens the charge port door.
11064
- * @return Promise to an object with response containing charge port open result
11065
- */
11066
- : number;
11068
+ minimum_delta?: number;
11067
11069
  };
11068
11070
  DiInverterTRER?: {
11069
11071
  interval_seconds: number;
@@ -11325,26 +11327,12 @@ declare class TeslemetryVehicleApi extends EventEmitter {
11325
11327
  };
11326
11328
  IdealBatteryRange?: {
11327
11329
  interval_seconds: number;
11328
- resend_interval_seconds?
11329
- /**
11330
- * Revokes a share invitation.
11331
- * @param id The invitation ID to revoke
11332
- * @return Promise to an object with response containing invitation revocation result
11333
- */
11334
- : number;
11330
+ resend_interval_seconds?: number;
11335
11331
  minimum_delta?: number;
11336
11332
  };
11337
- InsideTemp
11338
- /**
11339
- * Sends a ping command to the vehicle.
11340
- * @return Promise to an object with response containing ping result
11341
- */?: {
11333
+ InsideTemp?: {
11342
11334
  interval_seconds: number;
11343
- resend_interval_seconds
11344
- /**
11345
- * Sends a ping command to the vehicle.
11346
- * @return Promise to an object with response containing ping result
11347
- */?: number;
11335
+ resend_interval_seconds?: number;
11348
11336
  minimum_delta?: number;
11349
11337
  };
11350
11338
  IsolationResistance?: {
@@ -12033,7 +12021,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
12033
12021
  * Returns the charge history for the vehicle.
12034
12022
  * @return Promise to an object with response containing charge history
12035
12023
  */
12036
- chargeHistory(): Promise<unknown>;
12024
+ chargeHistory(): Promise<Def0>;
12037
12025
  /**
12038
12026
  * Wakes the vehicle from sleep. This command costs 20 command credits
12039
12027
  * @return Promise to an object with response containing wake up confirmation
@@ -14345,13 +14333,13 @@ declare class TeslemetryChargingApi extends EventEmitter {
14345
14333
  * @param query.vin Vehicle Identification Number (VIN) of the selected vehicle
14346
14334
  * @return Promise to an object with response containing paginated charging history records
14347
14335
  */
14348
- getChargingHistory(query: GetApi1DxChargingHistoryData["query"]): Promise<unknown>;
14336
+ getChargingHistory(query: GetApi1DxChargingHistoryData["query"]): Promise<Def0>;
14349
14337
  /**
14350
14338
  * Returns a charging invoice pdf for an event from charging history.
14351
14339
  * @param id The charging session ID
14352
14340
  * @return Promise to an object with response containing charging invoice PDF URL
14353
14341
  */
14354
- getInvoice(id: string): Promise<unknown>;
14342
+ getInvoice(id: string): Promise<Def0>;
14355
14343
  /**
14356
14344
  * Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.
14357
14345
  * @param query Query parameters for filtering charging sessions
@@ -14362,7 +14350,7 @@ declare class TeslemetryChargingApi extends EventEmitter {
14362
14350
  * @param query.vin Vehicle Identification Number (VIN) of the selected vehicle
14363
14351
  * @return Promise to an object with response containing charging session information with pricing and energy data
14364
14352
  */
14365
- getChargingSessions(query?: GetApi1DxChargingSessionsData["query"]): Promise<unknown>;
14353
+ getChargingSessions(query?: GetApi1DxChargingSessionsData["query"]): Promise<Def0>;
14366
14354
  }
14367
14355
  //#endregion
14368
14356
  //#region src/TeslemetryUserApi.d.ts
package/dist/index.d.mts CHANGED
@@ -2,6 +2,17 @@ import { EventEmitter } from "events";
2
2
 
3
3
  //#region src/client/types.gen.d.ts
4
4
 
5
+ /**
6
+ * errorResponse
7
+ *
8
+ * Error response
9
+ */
10
+ type Def0 = {
11
+ response?: null;
12
+ error: string;
13
+ error_description?: string;
14
+ [key: string]: unknown | null | string | undefined;
15
+ };
5
16
  type GetApiMetadataResponses = {
6
17
  /**
7
18
  * Default Response
@@ -1106,14 +1117,14 @@ type GetApiConfigByVinResponses = {
1106
1117
  resend_interval_seconds?: number;
1107
1118
  };
1108
1119
  /**
1109
- * If the vehicle is located at the active driver profiles saved home location. (Requires 2024.44.32)
1120
+ * If the vehicle is located at the active driver profile's saved home location. (Requires 2024.44.32)
1110
1121
  */
1111
1122
  LocatedAtHome?: {
1112
1123
  interval_seconds: number;
1113
1124
  resend_interval_seconds?: number;
1114
1125
  };
1115
1126
  /**
1116
- * If the vehicle is located at the active driver profiles saved work location. (Requires 2024.44.32)
1127
+ * If the vehicle is located at the active driver profile's saved work location. (Requires 2024.44.32)
1117
1128
  */
1118
1129
  LocatedAtWork?: {
1119
1130
  interval_seconds: number;
@@ -2925,14 +2936,14 @@ type PatchApiConfigByVinData = {
2925
2936
  resend_interval_seconds?: number;
2926
2937
  } | null;
2927
2938
  /**
2928
- * If the vehicle is located at the active driver profiles saved home location. (Requires 2024.44.32)
2939
+ * If the vehicle is located at the active driver profile's saved home location. (Requires 2024.44.32)
2929
2940
  */
2930
2941
  LocatedAtHome?: {
2931
2942
  interval_seconds: number;
2932
2943
  resend_interval_seconds?: number;
2933
2944
  } | null;
2934
2945
  /**
2935
- * If the vehicle is located at the active driver profiles saved work location. (Requires 2024.44.32)
2946
+ * If the vehicle is located at the active driver profile's saved work location. (Requires 2024.44.32)
2936
2947
  */
2937
2948
  LocatedAtWork?: {
2938
2949
  interval_seconds: number;
@@ -4749,14 +4760,14 @@ type PostApiConfigByVinData = {
4749
4760
  resend_interval_seconds?: number;
4750
4761
  } | null;
4751
4762
  /**
4752
- * If the vehicle is located at the active driver profiles saved home location. (Requires 2024.44.32)
4763
+ * If the vehicle is located at the active driver profile's saved home location. (Requires 2024.44.32)
4753
4764
  */
4754
4765
  LocatedAtHome?: {
4755
4766
  interval_seconds: number;
4756
4767
  resend_interval_seconds?: number;
4757
4768
  } | null;
4758
4769
  /**
4759
- * If the vehicle is located at the active driver profiles saved work location. (Requires 2024.44.32)
4770
+ * If the vehicle is located at the active driver profile's saved work location. (Requires 2024.44.32)
4760
4771
  */
4761
4772
  LocatedAtWork?: {
4762
4773
  interval_seconds: number;
@@ -6664,14 +6675,14 @@ type GetApi1VehiclesByVinFleetTelemetryConfigResponses = {
6664
6675
  resend_interval_seconds?: number;
6665
6676
  };
6666
6677
  /**
6667
- * If the vehicle is located at the active driver profiles saved home location. (Requires 2024.44.32)
6678
+ * If the vehicle is located at the active driver profile's saved home location. (Requires 2024.44.32)
6668
6679
  */
6669
6680
  LocatedAtHome?: {
6670
6681
  interval_seconds: number;
6671
6682
  resend_interval_seconds?: number;
6672
6683
  };
6673
6684
  /**
6674
- * If the vehicle is located at the active driver profiles saved work location. (Requires 2024.44.32)
6685
+ * If the vehicle is located at the active driver profile's saved work location. (Requires 2024.44.32)
6675
6686
  */
6676
6687
  LocatedAtWork?: {
6677
6688
  interval_seconds: number;
@@ -8003,8 +8014,7 @@ type GetApi1EnergySitesByIdTelemetryHistoryResponses = {
8003
8014
  */
8004
8015
  200: {
8005
8016
  response?: {
8006
- period?: string;
8007
- time_series?: Array<{
8017
+ charge_history?: Array<{
8008
8018
  charge_start_time?: {
8009
8019
  seconds?: number;
8010
8020
  };
@@ -8012,6 +8022,10 @@ type GetApi1EnergySitesByIdTelemetryHistoryResponses = {
8012
8022
  seconds?: number;
8013
8023
  };
8014
8024
  energy_added_wh?: number;
8025
+ target_id?: {
8026
+ text?: string;
8027
+ };
8028
+ din?: string;
8015
8029
  }>;
8016
8030
  };
8017
8031
  };
@@ -8408,8 +8422,8 @@ type GetSseByVin_Responses = {
8408
8422
  ChargeAmps?: number | null;
8409
8423
  ChargeCurrentRequest?: number | null;
8410
8424
  ChargeCurrentRequestMax?: number | null;
8411
- ChargeEnableRequest?: number | null;
8412
- ChargeLimitSoc?: boolean | null;
8425
+ ChargeEnableRequest?: boolean | null;
8426
+ ChargeLimitSoc?: number | null;
8413
8427
  ChargePort?: 'ChargePortUnknown' | 'ChargePortUS' | 'ChargePortEU' | 'ChargePortGB' | 'ChargePortCCS' | null;
8414
8428
  ChargePortColdWeatherMode?: boolean | null;
8415
8429
  ChargePortDoorOpen?: boolean | null;
@@ -8428,7 +8442,7 @@ type GetSseByVin_Responses = {
8428
8442
  DCChargingEnergyIn?: number | null;
8429
8443
  DCChargingPower?: number | null;
8430
8444
  DCDCEnable?: boolean | null;
8431
- DefrostForPreconditioning?: number | null;
8445
+ DefrostForPreconditioning?: boolean | null;
8432
8446
  DefrostMode?: 'DefrostModeStateUnknown' | 'DefrostModeStateOff' | 'DefrostModeStateNormal' | 'DefrostModeStateMax' | 'DefrostModeStateAutoDefog' | null;
8433
8447
  DestinationLocation?: {
8434
8448
  latitude: number;
@@ -8478,15 +8492,15 @@ type GetSseByVin_Responses = {
8478
8492
  TrunkFront: boolean;
8479
8493
  TrunkRear: boolean;
8480
8494
  } | null;
8481
- DriveRail?: number | null;
8495
+ DriveRail?: boolean | null;
8482
8496
  DriverSeatBelt?: 'BuckleStatusUnknown' | 'BuckleStatusUnlatched' | 'BuckleStatusLatched' | 'BuckleStatusFaulted' | null;
8483
8497
  DriverSeatOccupied?: boolean | null;
8484
- EfficiencyPackage?: number | null;
8485
- EmergencyLaneDepartureAvoidance?: number | null;
8498
+ EfficiencyPackage?: string | null;
8499
+ EmergencyLaneDepartureAvoidance?: boolean | null;
8486
8500
  EnergyRemaining?: number | null;
8487
8501
  EstBatteryRange?: number | null;
8488
8502
  EstimatedHoursToChargeTermination?: number | null;
8489
- EuropeVehicle?: number | null;
8503
+ EuropeVehicle?: boolean | null;
8490
8504
  ExpectedEnergyPercentAtTripArrival?: number | null;
8491
8505
  ExteriorColor?: string | null;
8492
8506
  FastChargerPresent?: boolean | null;
@@ -8508,7 +8522,7 @@ type GetSseByVin_Responses = {
8508
8522
  HvacLeftTemperatureRequest?: number | null;
8509
8523
  HvacPower?: 'HvacPowerStateUnknown' | 'HvacPowerStateOff' | 'HvacPowerStateOn' | 'HvacPowerStatePrecondition' | 'HvacPowerStateOverheatProtect' | null;
8510
8524
  HvacRightTemperatureRequest?: number | null;
8511
- HvacSteeringWheelHeatAuto?: number | null;
8525
+ HvacSteeringWheelHeatAuto?: boolean | null;
8512
8526
  HvacSteeringWheelHeatLevel?: number | null;
8513
8527
  Hvil?: 'HvilStatusUnknown' | 'HvilStatusFault' | 'HvilStatusOK' | null;
8514
8528
  IdealBatteryRange?: number | null;
@@ -8522,9 +8536,9 @@ type GetSseByVin_Responses = {
8522
8536
  LightsHazardsActive?: boolean | null;
8523
8537
  LightsHighBeams?: boolean | null;
8524
8538
  LightsTurnSignal?: 'TurnSignalStateUnknown' | 'TurnSignalStateOff' | 'TurnSignalStateLeft' | 'TurnSignalStateRight' | 'TurnSignalStateBoth' | null;
8525
- LocatedAtFavorite?: number | null;
8526
- LocatedAtHome?: number | null;
8527
- LocatedAtWork?: number | null;
8539
+ LocatedAtFavorite?: boolean | null;
8540
+ LocatedAtHome?: boolean | null;
8541
+ LocatedAtWork?: boolean | null;
8528
8542
  Location?: {
8529
8543
  latitude: number;
8530
8544
  longitude: number;
@@ -8547,7 +8561,7 @@ type GetSseByVin_Responses = {
8547
8561
  MinutesToArrival?: number | null;
8548
8562
  ModuleTempMax?: number | null;
8549
8563
  ModuleTempMin?: number | null;
8550
- NotEnoughPowerToHeat?: number | null;
8564
+ NotEnoughPowerToHeat?: boolean | null;
8551
8565
  NumBrickVoltageMax?: number | null;
8552
8566
  NumBrickVoltageMin?: number | null;
8553
8567
  NumModuleTempMax?: number | null;
@@ -8575,7 +8589,7 @@ type GetSseByVin_Responses = {
8575
8589
  RdWindow?: 'WindowStateUnknown' | 'WindowStateClosed' | 'WindowStatePartiallyOpen' | 'WindowStateOpened' | null;
8576
8590
  RearDefrostEnabled?: boolean | null;
8577
8591
  RearDisplayHvacEnabled?: boolean | null;
8578
- RearSeatHeaters?: number | null;
8592
+ RearSeatHeaters?: string | null;
8579
8593
  RemoteStartEnabled?: boolean | null;
8580
8594
  RightHandDrive?: boolean | null;
8581
8595
  RoofColor?: string | null;
@@ -8584,7 +8598,7 @@ type GetSseByVin_Responses = {
8584
8598
  RouteTrafficMinutesDelay?: number | null;
8585
8599
  RpWindow?: 'WindowStateUnknown' | 'WindowStateClosed' | 'WindowStatePartiallyOpen' | 'WindowStateOpened' | null;
8586
8600
  ScheduledChargingMode?: 'ScheduledChargingModeUnknown' | 'ScheduledChargingModeOff' | 'ScheduledChargingModeStartAt' | 'ScheduledChargingModeDepartBy' | null;
8587
- ScheduledChargingPending?: number | null;
8601
+ ScheduledChargingPending?: boolean | null;
8588
8602
  ScheduledChargingStartTime?: number | null;
8589
8603
  ScheduledDepartureTime?: number | null;
8590
8604
  SeatHeaterLeft?: number | null;
@@ -10590,8 +10604,7 @@ declare class TeslemetryEnergyApi extends EventEmitter {
10590
10604
  */
10591
10605
  getTelemetryHistory(start_date?: DateInput, end_date?: DateInput, time_zone?: string): Promise<{
10592
10606
  response?: {
10593
- period?: string;
10594
- time_series?: Array<{
10607
+ charge_history?: Array<{
10595
10608
  charge_start_time?: {
10596
10609
  seconds?: number;
10597
10610
  };
@@ -10599,6 +10612,10 @@ declare class TeslemetryEnergyApi extends EventEmitter {
10599
10612
  seconds?: number;
10600
10613
  };
10601
10614
  energy_added_wh?: number;
10615
+ target_id?: {
10616
+ text?: string;
10617
+ };
10618
+ din?: string;
10602
10619
  }>;
10603
10620
  };
10604
10621
  }>;
@@ -10756,7 +10773,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10756
10773
  * Refresh the cached vehicle data immediately. Consumes 2 command credits.
10757
10774
  * @return Promise to an object with response containing confirmation of refresh
10758
10775
  */
10759
- refreshData(): Promise<unknown>;
10776
+ refreshData(): Promise<Def0>;
10760
10777
  /**
10761
10778
  * Get the saved vehicle config.
10762
10779
  * @return Promise to an object with response containing the vehicle configuration
@@ -10827,11 +10844,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10827
10844
  BrakePedalPos?: {
10828
10845
  interval_seconds: number;
10829
10846
  resend_interval_seconds?: number;
10830
- minimum_delta
10831
- /**
10832
- * Stops climate preconditioning.
10833
- * @return Promise to an object with response containing auto conditioning stop result
10834
- */?: number;
10847
+ minimum_delta?: number;
10835
10848
  };
10836
10849
  BrickVoltageMax?: {
10837
10850
  interval_seconds: number;
@@ -10876,12 +10889,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10876
10889
  };
10877
10890
  ChargeEnableRequest?: {
10878
10891
  interval_seconds: number;
10879
- resend_interval_seconds?
10880
- /**
10881
- * Skips to the next track in media playback.
10882
- * @return Promise to an object with response containing media next track result
10883
- */
10884
- : number;
10892
+ resend_interval_seconds?: number;
10885
10893
  };
10886
10894
  ChargeLimitSoc?: {
10887
10895
  interval_seconds: number;
@@ -10890,7 +10898,18 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10890
10898
  };
10891
10899
  ChargePort?: {
10892
10900
  interval_seconds: number;
10893
- resend_interval_seconds?: number;
10901
+ resend_interval_seconds
10902
+ /**
10903
+ * Enable/disable guest mode.
10904
+ * @param enable Whether to enable guest mode
10905
+ * @return Promise to an object with response containing guest mode set result
10906
+ */?
10907
+ /**
10908
+ * Enable/disable guest mode.
10909
+ * @param enable Whether to enable guest mode
10910
+ * @return Promise to an object with response containing guest mode set result
10911
+ */
10912
+ : number;
10894
10913
  };
10895
10914
  ChargePortColdWeatherMode?: {
10896
10915
  interval_seconds: number;
@@ -10931,7 +10950,11 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10931
10950
  interval_seconds: number;
10932
10951
  resend_interval_seconds?: number;
10933
10952
  };
10934
- ClimateSeatCoolingFrontLeft?: {
10953
+ ClimateSeatCoolingFrontLeft
10954
+ /**
10955
+ * Starts the vehicle remotely.
10956
+ * @return Promise to an object with response containing remote start result
10957
+ */?: {
10935
10958
  interval_seconds: number;
10936
10959
  resend_interval_seconds?: number;
10937
10960
  minimum_delta?: number;
@@ -10941,21 +10964,9 @@ declare class TeslemetryVehicleApi extends EventEmitter {
10941
10964
  resend_interval_seconds?: number;
10942
10965
  minimum_delta?: number;
10943
10966
  };
10944
- CruiseFollowDistance
10945
- /**
10946
- * Sets the target temperature for the driver and passenger.
10947
- * @param driver_temp Driver temperature in Celsius
10948
- * @param passenger_temp Passenger temperature in Celsius
10949
- * @return Promise to an object with response containing temperature set result
10950
- */?: {
10967
+ CruiseFollowDistance?: {
10951
10968
  interval_seconds: number;
10952
- resend_interval_seconds
10953
- /**
10954
- * Sets the target temperature for the driver and passenger.
10955
- * @param driver_temp Driver temperature in Celsius
10956
- * @param passenger_temp Passenger temperature in Celsius
10957
- * @return Promise to an object with response containing temperature set result
10958
- */?: number;
10969
+ resend_interval_seconds?: number;
10959
10970
  };
10960
10971
  CruiseSetSpeed?: {
10961
10972
  interval_seconds: number;
@@ -11054,16 +11065,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
11054
11065
  DiInverterTREL?: {
11055
11066
  interval_seconds: number;
11056
11067
  resend_interval_seconds?: number;
11057
- minimum_delta
11058
- /**
11059
- * Opens the charge port door.
11060
- * @return Promise to an object with response containing charge port open result
11061
- */?
11062
- /**
11063
- * Opens the charge port door.
11064
- * @return Promise to an object with response containing charge port open result
11065
- */
11066
- : number;
11068
+ minimum_delta?: number;
11067
11069
  };
11068
11070
  DiInverterTRER?: {
11069
11071
  interval_seconds: number;
@@ -11325,26 +11327,12 @@ declare class TeslemetryVehicleApi extends EventEmitter {
11325
11327
  };
11326
11328
  IdealBatteryRange?: {
11327
11329
  interval_seconds: number;
11328
- resend_interval_seconds?
11329
- /**
11330
- * Revokes a share invitation.
11331
- * @param id The invitation ID to revoke
11332
- * @return Promise to an object with response containing invitation revocation result
11333
- */
11334
- : number;
11330
+ resend_interval_seconds?: number;
11335
11331
  minimum_delta?: number;
11336
11332
  };
11337
- InsideTemp
11338
- /**
11339
- * Sends a ping command to the vehicle.
11340
- * @return Promise to an object with response containing ping result
11341
- */?: {
11333
+ InsideTemp?: {
11342
11334
  interval_seconds: number;
11343
- resend_interval_seconds
11344
- /**
11345
- * Sends a ping command to the vehicle.
11346
- * @return Promise to an object with response containing ping result
11347
- */?: number;
11335
+ resend_interval_seconds?: number;
11348
11336
  minimum_delta?: number;
11349
11337
  };
11350
11338
  IsolationResistance?: {
@@ -12033,7 +12021,7 @@ declare class TeslemetryVehicleApi extends EventEmitter {
12033
12021
  * Returns the charge history for the vehicle.
12034
12022
  * @return Promise to an object with response containing charge history
12035
12023
  */
12036
- chargeHistory(): Promise<unknown>;
12024
+ chargeHistory(): Promise<Def0>;
12037
12025
  /**
12038
12026
  * Wakes the vehicle from sleep. This command costs 20 command credits
12039
12027
  * @return Promise to an object with response containing wake up confirmation
@@ -14345,13 +14333,13 @@ declare class TeslemetryChargingApi extends EventEmitter {
14345
14333
  * @param query.vin Vehicle Identification Number (VIN) of the selected vehicle
14346
14334
  * @return Promise to an object with response containing paginated charging history records
14347
14335
  */
14348
- getChargingHistory(query: GetApi1DxChargingHistoryData["query"]): Promise<unknown>;
14336
+ getChargingHistory(query: GetApi1DxChargingHistoryData["query"]): Promise<Def0>;
14349
14337
  /**
14350
14338
  * Returns a charging invoice pdf for an event from charging history.
14351
14339
  * @param id The charging session ID
14352
14340
  * @return Promise to an object with response containing charging invoice PDF URL
14353
14341
  */
14354
- getInvoice(id: string): Promise<unknown>;
14342
+ getInvoice(id: string): Promise<Def0>;
14355
14343
  /**
14356
14344
  * Returns the charging session information including pricing and energy data. This endpoint is only available for business accounts that own a fleet of vehicles.
14357
14345
  * @param query Query parameters for filtering charging sessions
@@ -14362,7 +14350,7 @@ declare class TeslemetryChargingApi extends EventEmitter {
14362
14350
  * @param query.vin Vehicle Identification Number (VIN) of the selected vehicle
14363
14351
  * @return Promise to an object with response containing charging session information with pricing and energy data
14364
14352
  */
14365
- getChargingSessions(query?: GetApi1DxChargingSessionsData["query"]): Promise<unknown>;
14353
+ getChargingSessions(query?: GetApi1DxChargingSessionsData["query"]): Promise<Def0>;
14366
14354
  }
14367
14355
  //#endregion
14368
14356
  //#region src/TeslemetryUserApi.d.ts
package/dist/index.mjs CHANGED
@@ -3043,7 +3043,7 @@ var TeslemetryVehicleStream = class extends EventEmitter {
3043
3043
  this._pendingFields = {};
3044
3044
  } else this.logger.error(`Error updating streaming config for ${this.vin}`, data);
3045
3045
  this._debounceTimeout = null;
3046
- }, 100);
3046
+ }, 1e3);
3047
3047
  }
3048
3048
  /** Modify the field configuration of the vehicle */
3049
3049
  async patchConfig(fields) {
@@ -3359,6 +3359,22 @@ function formatDate(date) {
3359
3359
  return date.toISOString().replace(/\.\d{3}Z$/, "Z");
3360
3360
  }
3361
3361
  /**
3362
+ * Gets the start of today (midnight) in local timezone
3363
+ * @returns Date object set to today at 00:00:00.000
3364
+ */
3365
+ function getStartOfToday() {
3366
+ const now = /* @__PURE__ */ new Date();
3367
+ return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0, 0);
3368
+ }
3369
+ /**
3370
+ * Gets the end of today (23:59:59.999) in local timezone
3371
+ * @returns Date object set to today at 23:59:59.999
3372
+ */
3373
+ function getEndOfToday() {
3374
+ const now = /* @__PURE__ */ new Date();
3375
+ return new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0, 0);
3376
+ }
3377
+ /**
3362
3378
  * Processes start_date and end_date inputs for API calls.
3363
3379
  * Handles string (taken as-is), Date (formatted), or undefined (defaults to today).
3364
3380
  *
@@ -3597,7 +3613,7 @@ var TeslemetryEnergyApi = class extends EventEmitter {
3597
3613
  const { data } = await getApi1EnergySitesByIdTelemetryHistory({
3598
3614
  query: {
3599
3615
  kind: "charge",
3600
- ...processDateRange(start_date, end_date),
3616
+ ...processDateRange(start_date ?? getStartOfToday(), end_date ?? getEndOfToday()),
3601
3617
  time_zone
3602
3618
  },
3603
3619
  path: { id: this.siteId },
@@ -5204,7 +5220,7 @@ const consoleLogger = {
5204
5220
 
5205
5221
  //#endregion
5206
5222
  //#region package.json
5207
- var version = "0.6.7";
5223
+ var version = "0.6.9";
5208
5224
 
5209
5225
  //#endregion
5210
5226
  //#region src/Teslemetry.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teslemetry/api",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "API client for Teslemetry",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",