tesla-fleet-api 1.0.15__py3-none-any.whl → 1.0.17__py3-none-any.whl
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.
- tesla_fleet_api/__init__.py +1 -1
- tesla_fleet_api/tesla/vehicle/bluetooth.py +2 -2
- tesla_fleet_api/tesla/vehicle/commands.py +15 -18
- tesla_fleet_api/tesla/vehicle/signed.py +1 -1
- {tesla_fleet_api-1.0.15.dist-info → tesla_fleet_api-1.0.17.dist-info}/METADATA +6 -15
- {tesla_fleet_api-1.0.15.dist-info → tesla_fleet_api-1.0.17.dist-info}/RECORD +9 -9
- {tesla_fleet_api-1.0.15.dist-info → tesla_fleet_api-1.0.17.dist-info}/WHEEL +1 -1
- {tesla_fleet_api-1.0.15.dist-info → tesla_fleet_api-1.0.17.dist-info/licenses}/LICENSE +0 -0
- {tesla_fleet_api-1.0.15.dist-info → tesla_fleet_api-1.0.17.dist-info}/top_level.txt +0 -0
tesla_fleet_api/__init__.py
CHANGED
@@ -110,7 +110,7 @@ class ReassemblingBuffer:
|
|
110
110
|
if self.expected_length is None and len(self.buffer) >= 2:
|
111
111
|
self.expected_length = struct.unpack(">H", self.buffer[:2])[0] + 2
|
112
112
|
|
113
|
-
LOGGER.
|
113
|
+
LOGGER.debug(f"Buffer length: {len(self.buffer)}, Packet starts: {self.packet_starts}, Expected length: {self.expected_length}")
|
114
114
|
|
115
115
|
if self.expected_length is not None and self.expected_length > 1024:
|
116
116
|
LOGGER.warning(f"Expected length too large: {self.expected_length}")
|
@@ -270,7 +270,7 @@ class VehicleBluetooth(Commands):
|
|
270
270
|
if resp.HasField(requires):
|
271
271
|
return resp
|
272
272
|
else:
|
273
|
-
LOGGER.
|
273
|
+
LOGGER.debug(f"Ignoring message since it does not contain the required field {requires}, {resp.HasField(requires)}")
|
274
274
|
|
275
275
|
async def query_display_name(self, max_attempts=5) -> str | None:
|
276
276
|
"""Read the device name via GATT characteristic if available"""
|
@@ -158,24 +158,20 @@ CopActivationTemps = (
|
|
158
158
|
class Session:
|
159
159
|
"""A connect to a domain"""
|
160
160
|
|
161
|
-
domain: Domain
|
162
|
-
parent: Commands
|
163
|
-
key: bytes
|
164
|
-
counter: int
|
165
|
-
epoch: bytes
|
166
|
-
delta: int
|
167
|
-
sharedKey: bytes
|
168
|
-
hmac: bytes
|
169
|
-
publicKey: bytes
|
170
|
-
lock: Lock
|
171
|
-
ready: bool
|
172
|
-
|
173
161
|
def __init__(self, parent: Commands, domain: Domain):
|
174
|
-
self.parent = parent
|
175
|
-
self.domain = domain
|
162
|
+
self.parent: Commands = parent
|
163
|
+
self.domain: Domain = domain
|
164
|
+
self.counter: int = 0
|
165
|
+
self.epoch: bytes | None = None
|
166
|
+
self.delta: int = 0
|
167
|
+
self.sharedKey: bytes | None = None
|
168
|
+
self.hmac: bytes | None = None
|
169
|
+
self.publicKey: bytes | None = None
|
176
170
|
self.lock = Lock()
|
177
|
-
|
178
|
-
|
171
|
+
|
172
|
+
@property
|
173
|
+
def ready(self) -> bool:
|
174
|
+
return self.epoch is not None and self.hmac is not None and self.delta > 0
|
179
175
|
|
180
176
|
def update(self, sessionInfo: SessionInfo):
|
181
177
|
"""Update the session with new information"""
|
@@ -187,7 +183,6 @@ class Session:
|
|
187
183
|
self.publicKey = sessionInfo.publicKey
|
188
184
|
self.sharedKey = self.parent.shared_key(sessionInfo.publicKey)
|
189
185
|
self.hmac = hmac.new(self.sharedKey, "authenticated command".encode(), hashlib.sha256).digest()
|
190
|
-
self.ready = True
|
191
186
|
|
192
187
|
def hmac_personalized(self) -> HMAC_Personalized_Signature_Data:
|
193
188
|
"""Sign a command and return session metadata"""
|
@@ -195,6 +190,7 @@ class Session:
|
|
195
190
|
return HMAC_Personalized_Signature_Data(
|
196
191
|
epoch=self.epoch,
|
197
192
|
counter=self.counter,
|
193
|
+
# Expire command in 10 seconds
|
198
194
|
expires_at=int(time.time()) - self.delta + 10,
|
199
195
|
)
|
200
196
|
|
@@ -205,7 +201,8 @@ class Session:
|
|
205
201
|
epoch=self.epoch,
|
206
202
|
nonce=randbytes(12),
|
207
203
|
counter=self.counter,
|
208
|
-
|
204
|
+
# Expire command in 30 seconds (BLE can be slow)
|
205
|
+
expires_at=int(time.time()) - self.delta + 30,
|
209
206
|
)
|
210
207
|
|
211
208
|
|
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
|
|
13
13
|
from tesla_fleet_api.tesla.fleet import TeslaFleetApi
|
14
14
|
|
15
15
|
|
16
|
-
class VehicleSigned(
|
16
|
+
class VehicleSigned(Commands, VehicleFleet):
|
17
17
|
"""Class describing the Tesla Fleet API vehicle endpoints and commands for a specific vehicle with command signing."""
|
18
18
|
|
19
19
|
|
@@ -1,13 +1,12 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: tesla_fleet_api
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.17
|
4
4
|
Summary: Tesla Fleet API library for Python
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
Author-email: Brett Adams <hello@teslemetry.com>
|
6
|
+
License-Expression: Apache-2.0
|
7
|
+
Project-URL: Homepage, https://github.com/Teslemetry/python-tesla-fleet-api
|
8
8
|
Classifier: Development Status :: 5 - Production/Stable
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
10
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
11
10
|
Classifier: Operating System :: OS Independent
|
12
11
|
Requires-Python: >=3.10
|
13
12
|
Description-Content-Type: text/markdown
|
@@ -19,15 +18,7 @@ Requires-Dist: cryptography
|
|
19
18
|
Requires-Dist: protobuf
|
20
19
|
Requires-Dist: bleak
|
21
20
|
Requires-Dist: bleak-retry-connector
|
22
|
-
Dynamic:
|
23
|
-
Dynamic: author-email
|
24
|
-
Dynamic: classifier
|
25
|
-
Dynamic: description
|
26
|
-
Dynamic: description-content-type
|
27
|
-
Dynamic: home-page
|
28
|
-
Dynamic: requires-dist
|
29
|
-
Dynamic: requires-python
|
30
|
-
Dynamic: summary
|
21
|
+
Dynamic: license-file
|
31
22
|
|
32
23
|
# Tesla Fleet API
|
33
24
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
tesla_fleet_api/__init__.py,sha256=
|
1
|
+
tesla_fleet_api/__init__.py,sha256=CsFyd_kKg3-5EL2IH5KYMFena3intVDW4mFqeiYtoIA,475
|
2
2
|
tesla_fleet_api/const.py,sha256=cu9jvvFTLOw56bL78lIPWJKlb35T9CYACI5pBT6DBQI,3881
|
3
3
|
tesla_fleet_api/exceptions.py,sha256=GvjJBR77xGt2g3vhiAxcNtysj-e1Me7F-9PwO9dyzOo,35430
|
4
4
|
tesla_fleet_api/tesla/__init__.py,sha256=ahqqQigZbXfysOpo28qUudUfWrQfKRpD_1az368Sjr0,823
|
@@ -11,10 +11,10 @@ tesla_fleet_api/tesla/partner.py,sha256=e-l6sEP6-IupjFEQieSUjhhvRXF3aL4ebPNahcGF
|
|
11
11
|
tesla_fleet_api/tesla/tesla.py,sha256=Gs8-L3OsEMhs1N_vdDx-E46bOHKGowXTBxmRiP8NKh4,2391
|
12
12
|
tesla_fleet_api/tesla/user.py,sha256=w8rwiAOIFjuDus8M0RpZ0wucJtw8kYFKtJfYVk7Ekr0,1194
|
13
13
|
tesla_fleet_api/tesla/vehicle/__init__.py,sha256=DKQA9lIAGcya5cHj4AsNc04pcQSVHn18htTrsvN_fRs,498
|
14
|
-
tesla_fleet_api/tesla/vehicle/bluetooth.py,sha256=
|
15
|
-
tesla_fleet_api/tesla/vehicle/commands.py,sha256=
|
14
|
+
tesla_fleet_api/tesla/vehicle/bluetooth.py,sha256=CSUOx2rTYHM1iCShtZ3vu7kR-_m8E2dvNSLEksFqe6g,21034
|
15
|
+
tesla_fleet_api/tesla/vehicle/commands.py,sha256=CJ_NHJ9bCr5b6mjefxPPHChaUHLB6cVBFgwm6QYl4t4,51470
|
16
16
|
tesla_fleet_api/tesla/vehicle/fleet.py,sha256=K9BVZj6CChJSDSMFroa7Cz0KrsYWj32ILtQumarkLaU,32080
|
17
|
-
tesla_fleet_api/tesla/vehicle/signed.py,sha256=
|
17
|
+
tesla_fleet_api/tesla/vehicle/signed.py,sha256=uZz2cYxzjujWVx7zIG7a1FkDpoNTaUK4_kU2ZCR3Fqs,1339
|
18
18
|
tesla_fleet_api/tesla/vehicle/vehicle.py,sha256=IBvRO6qGkUf4bi-pFongA9fIe9iScvz_wGXtzEJXilY,870
|
19
19
|
tesla_fleet_api/tesla/vehicle/vehicles.py,sha256=c1KFTAYDvuTVNjM5O23KvT54UbNwo3ofFVpfkY-Mq5Y,2640
|
20
20
|
tesla_fleet_api/tesla/vehicle/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -43,8 +43,8 @@ tesla_fleet_api/teslemetry/vehicles.py,sha256=IJMRKb3jrW9ZSdJrCQ5wOYYZGVbFvSVza2
|
|
43
43
|
tesla_fleet_api/tessie/__init__.py,sha256=8HiaMLz1RueRoT5PSF1Y7iRr0-RV6ujgOH2RBSSUFk4,436
|
44
44
|
tesla_fleet_api/tessie/tessie.py,sha256=UByX0BmDcqLPiW8ofNuGmMcjXvaWRn3taC68Ji80Yf8,2666
|
45
45
|
tesla_fleet_api/tessie/vehicles.py,sha256=Cdp0pt2Z8bzK5T9wQ8_KubGSZ3Gevx1Q18kqJqEUxfs,1011
|
46
|
-
tesla_fleet_api-1.0.
|
47
|
-
tesla_fleet_api-1.0.
|
48
|
-
tesla_fleet_api-1.0.
|
49
|
-
tesla_fleet_api-1.0.
|
50
|
-
tesla_fleet_api-1.0.
|
46
|
+
tesla_fleet_api-1.0.17.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
47
|
+
tesla_fleet_api-1.0.17.dist-info/METADATA,sha256=vwqMRhkIKDw0LNSbr3AN4IEaICA1hqUAlnJqnPEB8wk,6759
|
48
|
+
tesla_fleet_api-1.0.17.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
49
|
+
tesla_fleet_api-1.0.17.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
|
50
|
+
tesla_fleet_api-1.0.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|