tesla-fleet-api 0.8.5__py3-none-any.whl → 0.9.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
tesla_fleet_api/const.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from enum import Enum
4
4
  import logging
5
5
 
6
- VERSION = "0.8.5"
6
+ VERSION = "1.0.0"
7
7
  LOGGER = logging.getLogger(__package__)
8
8
  SERVERS = {
9
9
  "na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
@@ -88,11 +88,14 @@ class VehicleDataEndpoint(StrEnum):
88
88
  DRIVE_STATE = "drive_state"
89
89
  GUI_SETTINGS = "gui_settings"
90
90
  LOCATION_DATA = "location_data"
91
+ CHARGE_SCHEDULE_DATA = "charge_schedule_data"
92
+ PRECONDITIONING_SCHEDULE_DATA = "preconditioning_schedule_data"
91
93
  VEHICLE_CONFIG = "vehicle_config"
92
94
  VEHICLE_STATE = "vehicle_state"
93
95
  VEHICLE_DATA_COMBO = "vehicle_data_combo"
94
96
 
95
97
 
98
+
96
99
  class SunRoofCommand(StrEnum):
97
100
  """Sunroof options"""
98
101
 
@@ -1,15 +1,10 @@
1
+ from typing import Any
2
+
1
3
  import aiohttp
2
4
  from aiolimiter import AsyncLimiter
3
- from typing import Any
4
- from .teslafleetapi import TeslaFleetApi
5
- from .charging import Charging
6
- from .energy import Energy
7
- from .partner import Partner
8
- from .user import User
9
- from .vehicle import Vehicle
10
- from .vehiclespecific import VehicleSpecific
11
5
 
12
- from .const import Method, LOGGER, Scope
6
+ from .const import LOGGER, Method, VehicleDataEndpoint
7
+ from .teslafleetapi import TeslaFleetApi
13
8
 
14
9
  # Rate limit should be global, even if multiple instances are created
15
10
  rate_limit = AsyncLimiter(5, 10)
@@ -101,6 +96,22 @@ class Teslemetry(TeslaFleetApi):
101
96
  )
102
97
  ).get("response")
103
98
 
99
+ async def vehicle_force_refresh(self, vin: str) -> dict[str, Any]:
100
+ """Force a refresh of the vehicle data."""
101
+ return await self._request(
102
+ Method.GET,
103
+ f"api/force/{vin}",
104
+ )
105
+
106
+ async def vehicle_data_cached(self, vin: str, endpoints: list[VehicleDataEndpoint | str] | None = None,) -> dict[str, Any]:
107
+ """Get cached vehicle data."""
108
+ endpoint_payload = ";".join(endpoints) if endpoints else None
109
+ return await self._request(
110
+ Method.GET,
111
+ f"api/x/vehicles/{vin}/vehicle_data",
112
+ {"endpoints": endpoint_payload}
113
+ )
114
+
104
115
  async def _request(
105
116
  self,
106
117
  method: Method,
@@ -737,7 +737,7 @@ class Vehicle:
737
737
  async def vehicle_data(
738
738
  self,
739
739
  vehicle_tag: str | int,
740
- endpoints: List[VehicleDataEndpoint | str] | None = None,
740
+ endpoints: list[VehicleDataEndpoint | str] | None = None,
741
741
  ) -> dict[str, Any]:
742
742
  """Makes a live call to the vehicle. This may return cached data if the vehicle is offline. For vehicles running firmware versions 2023.38+, location_data is required to fetch vehicle location. This will result in a location sharing icon to show on the vehicle UI."""
743
743
  endpoint_payload = ";".join(endpoints) if endpoints else None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tesla_fleet_api
3
- Version: 0.8.5
3
+ Version: 0.9.0
4
4
  Summary: Tesla Fleet API library for Python
5
5
  Home-page: https://github.com/Teslemetry/tesla_fleet_api
6
6
  Author: Brett Adams
@@ -1,6 +1,6 @@
1
1
  tesla_fleet_api/__init__.py,sha256=BVZUDsfaxT05tAfcMHHWiyFyXwmDOx_wP_IHZBscgho,729
2
2
  tesla_fleet_api/charging.py,sha256=N_mc8axrXj3iduqLj_jCt4Vx86tHqe3xqQT4R1R7HvU,1689
3
- tesla_fleet_api/const.py,sha256=mLwfvI3OF6PfhXU-Y_Sblix40DuYjgFIPMaiYoJ0CL4,9619
3
+ tesla_fleet_api/const.py,sha256=uPDzAPkLLYOCo0lbYutDvp8WTuVPVz2a3tNc4bDKbT8,9738
4
4
  tesla_fleet_api/energy.py,sha256=S7D75MPuMVsHgkyUcFfMqjGCLZBM5YVFlWLEHbaX-zw,5957
5
5
  tesla_fleet_api/energyspecific.py,sha256=UfeaGE59aoAa8UhpQCXUi0sOrNCA40xZlqwF73BXTVY,4254
6
6
  tesla_fleet_api/exceptions.py,sha256=wteuynQA2OY13IHEsiQHV-WU8BPUCpDDHBaYbRvQlHI,20299
@@ -9,10 +9,10 @@ tesla_fleet_api/ratecalculator.py,sha256=4lz8yruUeouHXh_3ezsXX-CTpIegp1T1J4VuRV_
9
9
  tesla_fleet_api/teslafleetapi.py,sha256=4Rnh_HNZkIw54o9SYAaHsA8vY0pmk_bMncrLuJ8MtSk,7389
10
10
  tesla_fleet_api/teslafleetoauth.py,sha256=ClrVh4_lpatW8w44fWM0PZiVB-ciPHr-9h4yw1Zf9w8,4121
11
11
  tesla_fleet_api/teslafleetopensource.py,sha256=TJfVPcqJlA1b3kMoGuLr-g5Gn8UDyYsTZhjvGY1MtIk,2007
12
- tesla_fleet_api/teslemetry.py,sha256=Rl73BWYYJk1UWIhCPwywcXGRlkATYZrPz3LP-Covppw,3272
12
+ tesla_fleet_api/teslemetry.py,sha256=l404hRZuZonOAp3x4hgiLfJTM84y9A-hCSoe1vo5c2k,3730
13
13
  tesla_fleet_api/tessie.py,sha256=4dBYxe1G2v9JvJGRbb01wXrAmvWT4jOfV4f_VQE_vkE,2302
14
14
  tesla_fleet_api/user.py,sha256=TZE2oh-n5zrhKXmGRuiNL9voKVODD7rBhGE_IObYVGA,1179
15
- tesla_fleet_api/vehicle.py,sha256=W5Y_ok5PK7jtXsenWpMWJTS4RpLhRW-1AlTPv1a6R6A,31765
15
+ tesla_fleet_api/vehicle.py,sha256=rEaLBWK5Vd9K-SFnMy5jFEQK-6wxpVsyY1AJ-nmHm7c,31765
16
16
  tesla_fleet_api/vehiclesigned.py,sha256=kxcR_I5B6I8ZsE336d22QDlVNpfxkdvRnW38XolLBsw,38698
17
17
  tesla_fleet_api/vehiclespecific.py,sha256=Nr4zZzfmIuw3RFYjQEX6c_xtYZgztMsN5ohVn-YEH0I,20600
18
18
  tesla_fleet_api/pb2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -25,8 +25,8 @@ tesla_fleet_api/pb2/signatures_pb2.py,sha256=5mdJUC8EC8kx1UxYrHK5XI3_7M6v7w2POH1
25
25
  tesla_fleet_api/pb2/universal_message_pb2.py,sha256=F6-SkYXSuzWDsBvnGMg9k2pAIZv13v609qCPx7NSrdw,7254
26
26
  tesla_fleet_api/pb2/vcsec_pb2.py,sha256=CMJ97e4Mm4p7NFcgybbCC2KJRcvtrcqmBy_pGycYhMo,26238
27
27
  tesla_fleet_api/pb2/vehicle_pb2.py,sha256=P1V7Dqg3BBGZwODxTpZqtxLP6fGS_FNBqJcz_Fp0crs,2482
28
- tesla_fleet_api-0.8.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
29
- tesla_fleet_api-0.8.5.dist-info/METADATA,sha256=i0wsFXohD4pk1XT1Qmb85nGtuSCe53uvTGFL9vcfcQw,3897
30
- tesla_fleet_api-0.8.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
31
- tesla_fleet_api-0.8.5.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
32
- tesla_fleet_api-0.8.5.dist-info/RECORD,,
28
+ tesla_fleet_api-0.9.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
29
+ tesla_fleet_api-0.9.0.dist-info/METADATA,sha256=K8WV8VASy6Kg6e7WTyspglMEmN5CK-j0YFBc1lzn8As,3897
30
+ tesla_fleet_api-0.9.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
31
+ tesla_fleet_api-0.9.0.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
32
+ tesla_fleet_api-0.9.0.dist-info/RECORD,,