tesla-fleet-api 0.5.16__tar.gz → 0.6.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {tesla_fleet_api-0.5.16/tesla_fleet_api.egg-info → tesla_fleet_api-0.6.1}/PKG-INFO +1 -5
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/README.md +0 -4
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/setup.py +1 -1
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/const.py +1 -1
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/energy.py +17 -1
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/energyspecific.py +16 -2
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/exceptions.py +5 -3
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/teslafleetapi.py +14 -21
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/teslafleetoauth.py +3 -5
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/teslemetry.py +4 -5
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/tessie.py +0 -2
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/vehicle.py +17 -47
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/vehiclespecific.py +10 -31
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1/tesla_fleet_api.egg-info}/PKG-INFO +1 -5
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/LICENSE +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/setup.cfg +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/__init__.py +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/charging.py +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/partner.py +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api/user.py +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api.egg-info/SOURCES.txt +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api.egg-info/dependency_links.txt +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api.egg-info/requires.txt +0 -0
- {tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tesla_fleet_api
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.6.1
|
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
|
@@ -40,7 +40,6 @@ async def main():
|
|
40
40
|
access_token="<access_token>",
|
41
41
|
session=session,
|
42
42
|
region="na",
|
43
|
-
raise_for_status=True,
|
44
43
|
)
|
45
44
|
|
46
45
|
try:
|
@@ -71,7 +70,6 @@ async def main():
|
|
71
70
|
refresh_token=auth["refresh_token"],
|
72
71
|
expires=auth["expires"],
|
73
72
|
region="na",
|
74
|
-
raise_for_status=True,
|
75
73
|
)
|
76
74
|
try:
|
77
75
|
data = await api.vehicle.list()
|
@@ -108,7 +106,6 @@ async def main():
|
|
108
106
|
api = Teslemetry(
|
109
107
|
access_token="<access_token>",
|
110
108
|
session=session,
|
111
|
-
raise_for_status=True,
|
112
109
|
)
|
113
110
|
|
114
111
|
try:
|
@@ -136,7 +133,6 @@ async def main():
|
|
136
133
|
api = Tessie(
|
137
134
|
access_token="<access_token>",
|
138
135
|
session=session,
|
139
|
-
raise_for_status=True,
|
140
136
|
)
|
141
137
|
|
142
138
|
try:
|
@@ -23,7 +23,6 @@ async def main():
|
|
23
23
|
access_token="<access_token>",
|
24
24
|
session=session,
|
25
25
|
region="na",
|
26
|
-
raise_for_status=True,
|
27
26
|
)
|
28
27
|
|
29
28
|
try:
|
@@ -54,7 +53,6 @@ async def main():
|
|
54
53
|
refresh_token=auth["refresh_token"],
|
55
54
|
expires=auth["expires"],
|
56
55
|
region="na",
|
57
|
-
raise_for_status=True,
|
58
56
|
)
|
59
57
|
try:
|
60
58
|
data = await api.vehicle.list()
|
@@ -91,7 +89,6 @@ async def main():
|
|
91
89
|
api = Teslemetry(
|
92
90
|
access_token="<access_token>",
|
93
91
|
session=session,
|
94
|
-
raise_for_status=True,
|
95
92
|
)
|
96
93
|
|
97
94
|
try:
|
@@ -119,7 +116,6 @@ async def main():
|
|
119
116
|
api = Tessie(
|
120
117
|
access_token="<access_token>",
|
121
118
|
session=session,
|
122
|
-
raise_for_status=True,
|
123
119
|
)
|
124
120
|
|
125
121
|
try:
|
@@ -1,11 +1,17 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import Any, TYPE_CHECKING
|
2
3
|
from .const import Method, EnergyOperationMode, EnergyExportMode
|
3
4
|
from .energyspecific import EnergySpecific
|
4
5
|
|
6
|
+
if TYPE_CHECKING:
|
7
|
+
from .teslafleetapi import TeslaFleetApi
|
8
|
+
|
5
9
|
|
6
10
|
class Energy:
|
7
11
|
"""Class describing the Tesla Fleet API partner endpoints"""
|
8
12
|
|
13
|
+
parent: TeslaFleetApi
|
14
|
+
|
9
15
|
def __init__(self, parent):
|
10
16
|
self._request = parent._request
|
11
17
|
|
@@ -146,3 +152,13 @@ class Energy:
|
|
146
152
|
f"api/1/energy_sites/{energy_site_id}/storm_mode",
|
147
153
|
json={"enabled": enabled},
|
148
154
|
)
|
155
|
+
|
156
|
+
async def time_of_use_settings(
|
157
|
+
self, energy_site_id: int, settings: dict[str, Any]
|
158
|
+
) -> dict[str, Any]:
|
159
|
+
"""Update the time of use settings for the energy site."""
|
160
|
+
return await self._request(
|
161
|
+
Method.POST,
|
162
|
+
f"api/1/energy_sites/{energy_site_id}/time_of_use_settings",
|
163
|
+
json={"tou_settings": {"tariff_content_v2": settings}},
|
164
|
+
)
|
@@ -1,13 +1,20 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import Any, TYPE_CHECKING
|
2
3
|
from .const import EnergyExportMode, EnergyOperationMode
|
3
4
|
|
5
|
+
if TYPE_CHECKING:
|
6
|
+
from .energy import Energy
|
7
|
+
|
4
8
|
|
5
9
|
class EnergySpecific:
|
6
10
|
"""Class describing the Tesla Fleet API partner endpoints"""
|
7
11
|
|
12
|
+
_parent: Energy
|
13
|
+
energy_site_id: int
|
14
|
+
|
8
15
|
def __init__(
|
9
16
|
self,
|
10
|
-
parent,
|
17
|
+
parent: Energy,
|
11
18
|
energy_site_id: int,
|
12
19
|
):
|
13
20
|
self._parent = parent
|
@@ -110,3 +117,10 @@ class EnergySpecific:
|
|
110
117
|
self.energy_site_id,
|
111
118
|
enabled,
|
112
119
|
)
|
120
|
+
|
121
|
+
async def time_of_use_settings(self, settings: dict[str, Any]) -> dict[str, Any]:
|
122
|
+
"""Update the site's time of use settings."""
|
123
|
+
return await self._parent.time_of_use_settings(
|
124
|
+
self.energy_site_id,
|
125
|
+
settings,
|
126
|
+
)
|
@@ -7,9 +7,10 @@ class TeslaFleetError(BaseException):
|
|
7
7
|
|
8
8
|
message: str = "An unknown error has occurred."
|
9
9
|
status: int | None = None
|
10
|
-
data: dict | None = None
|
10
|
+
data: dict | str | None = None
|
11
|
+
key: str | None = None
|
11
12
|
|
12
|
-
def __init__(self, data: dict | None = None, status: int | None = None):
|
13
|
+
def __init__(self, data: dict | str | None = None, status: int | None = None):
|
13
14
|
LOGGER.debug(self.message)
|
14
15
|
self.data = data
|
15
16
|
self.status = status or self.status
|
@@ -20,6 +21,7 @@ class ResponseError(TeslaFleetError):
|
|
20
21
|
"""The response from the server was not JSON."""
|
21
22
|
|
22
23
|
message = "The response from the server was not JSON."
|
24
|
+
data: str | None = None
|
23
25
|
|
24
26
|
|
25
27
|
class InvalidCommand(TeslaFleetError):
|
@@ -375,5 +377,5 @@ async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
|
|
375
377
|
elif resp.status == 540:
|
376
378
|
raise DeviceUnexpectedResponse(data)
|
377
379
|
elif data is None:
|
378
|
-
raise ResponseError(status=resp.status)
|
380
|
+
raise ResponseError(status=resp.status, data=await resp.text())
|
379
381
|
resp.raise_for_status()
|
@@ -1,8 +1,10 @@
|
|
1
|
-
|
1
|
+
"""Tesla Fleet API for Python."""
|
2
2
|
|
3
3
|
from json import dumps
|
4
|
-
from .exceptions import raise_for_status, InvalidRegion, LibraryError, InvalidToken
|
5
4
|
from typing import Any
|
5
|
+
import aiohttp
|
6
|
+
|
7
|
+
from .exceptions import raise_for_status, InvalidRegion, LibraryError, ResponseError
|
6
8
|
from .const import SERVERS, Method, LOGGER, VERSION
|
7
9
|
from .charging import Charging
|
8
10
|
from .energy import Energy
|
@@ -15,10 +17,11 @@ from .vehicle import Vehicle
|
|
15
17
|
class TeslaFleetApi:
|
16
18
|
"""Class describing the Tesla Fleet API."""
|
17
19
|
|
20
|
+
access_token: str | None = None
|
21
|
+
region: str | None = None
|
18
22
|
server: str | None = None
|
19
23
|
session: aiohttp.ClientSession
|
20
24
|
headers: dict[str, str]
|
21
|
-
raise_for_status: bool
|
22
25
|
|
23
26
|
def __init__(
|
24
27
|
self,
|
@@ -26,7 +29,6 @@ class TeslaFleetApi:
|
|
26
29
|
access_token: str | None = None,
|
27
30
|
region: str | None = None,
|
28
31
|
server: str | None = None,
|
29
|
-
raise_for_status: bool = True,
|
30
32
|
charging_scope: bool = True,
|
31
33
|
energy_scope: bool = True,
|
32
34
|
partner_scope: bool = True,
|
@@ -37,7 +39,6 @@ class TeslaFleetApi:
|
|
37
39
|
|
38
40
|
self.session = session
|
39
41
|
self.access_token = access_token
|
40
|
-
self.raise_for_status = raise_for_status
|
41
42
|
|
42
43
|
if server is not None:
|
43
44
|
self.server = server
|
@@ -82,7 +83,7 @@ class TeslaFleetApi:
|
|
82
83
|
path: str,
|
83
84
|
params: dict[str, Any] | None = None,
|
84
85
|
json: dict[str, Any] | None = None,
|
85
|
-
) -> dict[str, Any]
|
86
|
+
) -> dict[str, Any]:
|
86
87
|
"""Send a request to the Tesla Fleet API."""
|
87
88
|
|
88
89
|
if not self.server:
|
@@ -113,22 +114,14 @@ class TeslaFleetApi:
|
|
113
114
|
params=params,
|
114
115
|
) as resp:
|
115
116
|
LOGGER.debug("Response Status: %s", resp.status)
|
116
|
-
if
|
117
|
+
if not resp.ok:
|
117
118
|
await raise_for_status(resp)
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
}
|
125
|
-
if resp.content_type == "application/json":
|
126
|
-
data = await resp.json()
|
127
|
-
LOGGER.debug("Response JSON: %s", data)
|
128
|
-
return data
|
129
|
-
|
130
|
-
data = await resp.text()
|
131
|
-
LOGGER.debug("Response Text: %s", data)
|
119
|
+
if not resp.content_type.lower().startswith("application/json"):
|
120
|
+
LOGGER.debug("Response type is: %s", resp.content_type)
|
121
|
+
raise ResponseError(status=resp.status, data=await resp.text())
|
122
|
+
|
123
|
+
data = await resp.json()
|
124
|
+
LOGGER.debug("Response JSON: %s", data)
|
132
125
|
return data
|
133
126
|
|
134
127
|
async def status(self) -> str:
|
@@ -21,7 +21,6 @@ class TeslaFleetOAuth(TeslaFleetApi):
|
|
21
21
|
expires: int = 0,
|
22
22
|
region: str | None = None,
|
23
23
|
server: str | None = None,
|
24
|
-
raise_for_status: bool = True,
|
25
24
|
):
|
26
25
|
self.client_id = client_id
|
27
26
|
self.access_token = access_token
|
@@ -33,7 +32,6 @@ class TeslaFleetOAuth(TeslaFleetApi):
|
|
33
32
|
access_token="",
|
34
33
|
region=region,
|
35
34
|
server=server,
|
36
|
-
raise_for_status=raise_for_status,
|
37
35
|
)
|
38
36
|
|
39
37
|
def get_login_url(
|
@@ -96,8 +94,8 @@ class TeslaFleetOAuth(TeslaFleetApi):
|
|
96
94
|
method: Method,
|
97
95
|
path: str,
|
98
96
|
params: dict[str, Any] | None = None,
|
99
|
-
|
100
|
-
) ->
|
97
|
+
json: dict[str, Any] | None = None,
|
98
|
+
) -> dict[str, Any]:
|
101
99
|
"""Send a request to the Tesla Fleet API."""
|
102
100
|
await self.check_access_token()
|
103
|
-
return await super()._request(method, path, params,
|
101
|
+
return await super()._request(method, path, params, json)
|
@@ -13,14 +13,12 @@ class Teslemetry(TeslaFleetApi):
|
|
13
13
|
self,
|
14
14
|
session: aiohttp.ClientSession,
|
15
15
|
access_token: str,
|
16
|
-
raise_for_status: bool = True,
|
17
16
|
):
|
18
17
|
"""Initialize the Teslemetry API."""
|
19
18
|
super().__init__(
|
20
19
|
session,
|
21
20
|
access_token,
|
22
21
|
server="https://api.teslemetry.com",
|
23
|
-
raise_for_status=raise_for_status,
|
24
22
|
partner_scope=False,
|
25
23
|
user_scope=False,
|
26
24
|
)
|
@@ -52,10 +50,11 @@ class Teslemetry(TeslaFleetApi):
|
|
52
50
|
LOGGER.debug("Using server %s", self.server)
|
53
51
|
return resp
|
54
52
|
|
55
|
-
|
56
|
-
async def find_server(self) -> None:
|
53
|
+
async def find_server(self) -> str:
|
57
54
|
"""Find the server URL for the Tesla Fleet API."""
|
58
55
|
await self.metadata(True)
|
56
|
+
assert self.region
|
57
|
+
return self.region
|
59
58
|
|
60
59
|
async def _request(
|
61
60
|
self,
|
@@ -63,7 +62,7 @@ class Teslemetry(TeslaFleetApi):
|
|
63
62
|
path: str,
|
64
63
|
params: dict[str, Any] | None = None,
|
65
64
|
json: dict[str, Any] | None = None,
|
66
|
-
) ->
|
65
|
+
) -> dict[str, Any]:
|
67
66
|
"""Send a request to the Teslemetry API."""
|
68
67
|
async with rate_limit:
|
69
68
|
return await super()._request(method, path, params, json)
|
@@ -9,14 +9,12 @@ class Tessie(TeslaFleetApi):
|
|
9
9
|
self,
|
10
10
|
session: aiohttp.ClientSession,
|
11
11
|
access_token: str,
|
12
|
-
raise_for_status: bool = True,
|
13
12
|
):
|
14
13
|
"""Initialize the Tessie API."""
|
15
14
|
super().__init__(
|
16
15
|
session,
|
17
16
|
access_token,
|
18
17
|
server="https://api.tessie.com",
|
19
|
-
raise_for_status=raise_for_status,
|
20
18
|
partner_scope=False,
|
21
19
|
user_scope=False,
|
22
20
|
)
|
@@ -1,4 +1,5 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import Any, List, TYPE_CHECKING
|
2
3
|
from .const import (
|
3
4
|
Method,
|
4
5
|
Trunk,
|
@@ -13,17 +14,22 @@ from .const import (
|
|
13
14
|
)
|
14
15
|
from .vehiclespecific import VehicleSpecific
|
15
16
|
|
17
|
+
if TYPE_CHECKING:
|
18
|
+
from .teslafleetapi import TeslaFleetApi
|
19
|
+
|
16
20
|
|
17
21
|
class Vehicle:
|
18
22
|
"""Class describing the Tesla Fleet API vehicle endpoints and commands."""
|
19
23
|
|
20
|
-
|
24
|
+
_parent: TeslaFleetApi
|
25
|
+
|
26
|
+
def __init__(self, parent: TeslaFleetApi):
|
21
27
|
self._parent = parent
|
22
28
|
self._request = parent._request
|
23
29
|
|
24
|
-
def specific(self,
|
30
|
+
def specific(self, vin: str) -> VehicleSpecific:
|
25
31
|
"""Creates a class for each vehicle."""
|
26
|
-
return VehicleSpecific(self,
|
32
|
+
return VehicleSpecific(self, vin)
|
27
33
|
|
28
34
|
def pre2021(self, vin: str) -> bool:
|
29
35
|
"""Checks if a vehicle is a pre-2021 model S or X."""
|
@@ -716,26 +722,6 @@ class Vehicle:
|
|
716
722
|
{"routable_message": routable_message},
|
717
723
|
)
|
718
724
|
|
719
|
-
async def subscriptions(
|
720
|
-
self, device_token: str, device_type: str
|
721
|
-
) -> dict[str, Any]:
|
722
|
-
"""Returns the list of vehicles for which this mobile device currently subscribes to push notifications."""
|
723
|
-
return await self._request(
|
724
|
-
Method.GET,
|
725
|
-
"api/1/subscriptions",
|
726
|
-
query={"device_token": device_token, "device_type": device_type},
|
727
|
-
)
|
728
|
-
|
729
|
-
async def subscriptions_set(
|
730
|
-
self, device_token: str, device_type: str
|
731
|
-
) -> dict[str, Any]:
|
732
|
-
"""Allows a mobile device to specify which vehicles to receive push notifications from."""
|
733
|
-
return await self._request(
|
734
|
-
Method.POST,
|
735
|
-
"api/1/subscriptions",
|
736
|
-
query={"device_token": device_token, "device_type": device_type},
|
737
|
-
)
|
738
|
-
|
739
725
|
async def vehicle(self, vehicle_tag: str | int) -> dict[str, Any]:
|
740
726
|
"""Returns information about a vehicle."""
|
741
727
|
return await self._request(Method.GET, f"api/1/vehicles/{vehicle_tag}")
|
@@ -743,7 +729,7 @@ class Vehicle:
|
|
743
729
|
async def vehicle_data(
|
744
730
|
self,
|
745
731
|
vehicle_tag: str | int,
|
746
|
-
endpoints: List[VehicleDataEndpoint
|
732
|
+
endpoints: List[VehicleDataEndpoint | str] | None = None,
|
747
733
|
) -> dict[str, Any]:
|
748
734
|
"""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."""
|
749
735
|
endpoint_payload = ";".join(endpoints) if endpoints else None
|
@@ -753,37 +739,21 @@ class Vehicle:
|
|
753
739
|
{"endpoints": endpoint_payload},
|
754
740
|
)
|
755
741
|
|
756
|
-
async def vehicle_subscriptions(
|
757
|
-
self, device_token: str, device_type: DeviceType | str
|
758
|
-
) -> dict[str, Any]:
|
759
|
-
"""Returns the list of vehicles for which this mobile device currently subscribes to push notifications."""
|
760
|
-
return await self._request(
|
761
|
-
Method.GET,
|
762
|
-
"api/1/vehicle_subscriptions",
|
763
|
-
{"device_token": device_token, "device_type": device_type},
|
764
|
-
)
|
765
|
-
|
766
|
-
async def vehicle_subscriptions_set(
|
767
|
-
self, device_token: str, device_type: DeviceType | str
|
768
|
-
) -> dict[str, Any]:
|
769
|
-
"""Allows a mobile device to specify which vehicles to receive push notifications from."""
|
770
|
-
return await self._request(
|
771
|
-
Method.POST,
|
772
|
-
"api/1/vehicle_subscriptions",
|
773
|
-
params={"device_token": device_token, "device_type": device_type},
|
774
|
-
)
|
775
|
-
|
776
742
|
async def wake_up(self, vehicle_tag: str | int) -> dict[str, Any]:
|
777
743
|
"""Wakes the vehicle from sleep, which is a state to minimize idle energy consumption."""
|
778
744
|
return await self._request(Method.POST, f"api/1/vehicles/{vehicle_tag}/wake_up")
|
779
745
|
|
780
746
|
async def warranty_details(self, vin: str | None) -> dict[str, Any]:
|
781
747
|
"""Returns warranty details."""
|
782
|
-
return await self._request(
|
748
|
+
return await self._request(
|
749
|
+
Method.GET, "api/1/dx/warranty/details", {"vin": vin}
|
750
|
+
)
|
783
751
|
|
784
752
|
async def fleet_status(self, vins: List[str]) -> dict[str, Any]:
|
785
753
|
"""Checks whether vehicles can accept Tesla commands protocol for the partner's public key"""
|
786
|
-
return await self._request(
|
754
|
+
return await self._request(
|
755
|
+
Method.GET, "api/1/vehicles/fleet_status", json={"vins": vins}
|
756
|
+
)
|
787
757
|
|
788
758
|
async def fleet_telemetry_config_create(
|
789
759
|
self, config: dict[str, Any]
|
@@ -1,4 +1,5 @@
|
|
1
|
-
from
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import Any, TYPE_CHECKING
|
2
3
|
from .const import (
|
3
4
|
Trunk,
|
4
5
|
ClimateKeeperMode,
|
@@ -9,11 +10,17 @@ from .const import (
|
|
9
10
|
DeviceType,
|
10
11
|
)
|
11
12
|
|
13
|
+
if TYPE_CHECKING:
|
14
|
+
from .vehicle import Vehicle
|
15
|
+
|
12
16
|
|
13
17
|
class VehicleSpecific:
|
14
18
|
"""Class describing the Tesla Fleet API vehicle endpoints and commands for a specific vehicle."""
|
15
19
|
|
16
|
-
|
20
|
+
_parent: Vehicle
|
21
|
+
vin: str
|
22
|
+
|
23
|
+
def __init__(self, parent: Vehicle, vin: str):
|
17
24
|
self._parent = parent
|
18
25
|
self.vin = vin
|
19
26
|
|
@@ -406,45 +413,17 @@ class VehicleSpecific:
|
|
406
413
|
"""Signed Commands is a generic endpoint replacing legacy commands."""
|
407
414
|
return await self._parent.signed_command(self.vin, routable_message)
|
408
415
|
|
409
|
-
async def subscriptions(
|
410
|
-
self, device_token: str, device_type: str
|
411
|
-
) -> dict[str, Any]:
|
412
|
-
"""Returns the list of vehicles for which this mobile device currently subscribes to push notifications."""
|
413
|
-
return await self._parent.subscriptions(self.vin, device_token, device_type)
|
414
|
-
|
415
|
-
async def subscriptions_set(
|
416
|
-
self, device_token: str, device_type: str
|
417
|
-
) -> dict[str, Any]:
|
418
|
-
"""Allows a mobile device to specify which vehicles to receive push notifications from."""
|
419
|
-
return await self._parent.subscriptions_set(self.vin, device_token, device_type)
|
420
|
-
|
421
416
|
async def vehicle(self) -> dict[str, Any]:
|
422
417
|
"""Returns information about a vehicle."""
|
423
418
|
return await self._parent.vehicle(self.vin)
|
424
419
|
|
425
420
|
async def vehicle_data(
|
426
421
|
self,
|
427
|
-
endpoints: list[VehicleDataEndpoint
|
422
|
+
endpoints: list[VehicleDataEndpoint | str] | None = None,
|
428
423
|
) -> dict[str, Any]:
|
429
424
|
"""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."""
|
430
425
|
return await self._parent.vehicle_data(self.vin, endpoints)
|
431
426
|
|
432
|
-
async def vehicle_subscriptions(
|
433
|
-
self, device_token: str, device_type: DeviceType | str
|
434
|
-
) -> dict[str, Any]:
|
435
|
-
"""Returns the list of vehicles for which this mobile device currently subscribes to push notifications."""
|
436
|
-
return await self._parent.vehicle_subscriptions(
|
437
|
-
self.vin, device_token, device_type
|
438
|
-
)
|
439
|
-
|
440
|
-
async def vehicle_subscriptions_set(
|
441
|
-
self, device_token: str, device_type: DeviceType | str
|
442
|
-
) -> dict[str, Any]:
|
443
|
-
"""Allows a mobile device to specify which vehicles to receive push notifications from."""
|
444
|
-
return await self._parent.vehicle_subscriptions_set(
|
445
|
-
self.vin, device_token, device_type
|
446
|
-
)
|
447
|
-
|
448
427
|
async def wake_up(self) -> dict[str, Any]:
|
449
428
|
"""Wakes the vehicle from sleep, which is a state to minimize idle energy consumption."""
|
450
429
|
return await self._parent.wake_up(self.vin)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tesla_fleet_api
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.6.1
|
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
|
@@ -40,7 +40,6 @@ async def main():
|
|
40
40
|
access_token="<access_token>",
|
41
41
|
session=session,
|
42
42
|
region="na",
|
43
|
-
raise_for_status=True,
|
44
43
|
)
|
45
44
|
|
46
45
|
try:
|
@@ -71,7 +70,6 @@ async def main():
|
|
71
70
|
refresh_token=auth["refresh_token"],
|
72
71
|
expires=auth["expires"],
|
73
72
|
region="na",
|
74
|
-
raise_for_status=True,
|
75
73
|
)
|
76
74
|
try:
|
77
75
|
data = await api.vehicle.list()
|
@@ -108,7 +106,6 @@ async def main():
|
|
108
106
|
api = Teslemetry(
|
109
107
|
access_token="<access_token>",
|
110
108
|
session=session,
|
111
|
-
raise_for_status=True,
|
112
109
|
)
|
113
110
|
|
114
111
|
try:
|
@@ -136,7 +133,6 @@ async def main():
|
|
136
133
|
api = Tessie(
|
137
134
|
access_token="<access_token>",
|
138
135
|
session=session,
|
139
|
-
raise_for_status=True,
|
140
136
|
)
|
141
137
|
|
142
138
|
try:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tesla_fleet_api-0.5.16 → tesla_fleet_api-0.6.1}/tesla_fleet_api.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|