@eiannone/tesla-api 1.17.0 → 1.18.0

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.
Files changed (2) hide show
  1. package/TeslaApi.js +13 -4
  2. package/package.json +1 -1
package/TeslaApi.js CHANGED
@@ -34,7 +34,7 @@ class TeslaApi {
34
34
  }
35
35
 
36
36
  #decodeStatus(statusCode) {
37
- switch(statusCode) {
37
+ switch(statusCode) { // https://developer.tesla.com/docs/fleet-api#response-codes
38
38
  case 401: return ApiError.UNAUTHORIZED;
39
39
  case 403: return ApiError.FORBIDDEN;
40
40
  case 404: return ApiError.NO_VEHICLE;
@@ -112,9 +112,18 @@ class TeslaApi {
112
112
  return this.#apiCall((id == null)? this.vid : id);
113
113
  }
114
114
 
115
- async getVehicleData(id = null) {
116
- const vid = (id == null)? this.vid : id;
117
- return this.#apiCall(vid + "/vehicle_data");
115
+ /**
116
+ * https://developer.tesla.com/docs/fleet-api#vehicle_data
117
+ * Starting from firmware update 2023.38+, if you don't specify any endopint, the following ones are returned:
118
+ * charge_state, climate_state, drive_state (without location), gui_settings, vehicle_config, vehicle_state
119
+ * You can ask for the following specific endpoints:
120
+ * charge_state, climate_state, closures_state, drive_state, gui_settings, location_data, vehicle_config, vehicle_state,
121
+ * vehicle_data_combo
122
+ */
123
+ async getVehicleData(endpoints = [], id = null) {
124
+ let path = ((id == null)? this.vid : id) + "/vehicle_data";
125
+ if (endpoints.length > 0) path += "?endpoints="+endpoints.join('%3B');
126
+ return this.#apiCall(path);
118
127
  }
119
128
 
120
129
  async wakeUp(id = null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eiannone/tesla-api",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "Nodejs Tesla API",
5
5
  "type": "module",
6
6
  "main": "index.js",