tesla-fleet-api 0.9.1__py3-none-any.whl → 0.9.2__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/const.py +1 -1
- tesla_fleet_api/vehiclesigned.py +14 -3
- {tesla_fleet_api-0.9.1.dist-info → tesla_fleet_api-0.9.2.dist-info}/METADATA +1 -1
- {tesla_fleet_api-0.9.1.dist-info → tesla_fleet_api-0.9.2.dist-info}/RECORD +7 -7
- {tesla_fleet_api-0.9.1.dist-info → tesla_fleet_api-0.9.2.dist-info}/LICENSE +0 -0
- {tesla_fleet_api-0.9.1.dist-info → tesla_fleet_api-0.9.2.dist-info}/WHEEL +0 -0
- {tesla_fleet_api-0.9.1.dist-info → tesla_fleet_api-0.9.2.dist-info}/top_level.txt +0 -0
tesla_fleet_api/const.py
CHANGED
tesla_fleet_api/vehiclesigned.py
CHANGED
@@ -9,7 +9,7 @@ import hashlib
|
|
9
9
|
from cryptography.hazmat.primitives.asymmetric import ec
|
10
10
|
from cryptography.hazmat.primitives.serialization import PublicFormat, Encoding
|
11
11
|
|
12
|
-
from .exceptions import MESSAGE_FAULTS
|
12
|
+
from .exceptions import MESSAGE_FAULTS, TeslaFleetMessageFaultIncorrectEpoch
|
13
13
|
|
14
14
|
from .const import (
|
15
15
|
LOGGER,
|
@@ -23,6 +23,7 @@ from .vehiclespecific import VehicleSpecific
|
|
23
23
|
|
24
24
|
from .pb2.universal_message_pb2 import (
|
25
25
|
# OPERATIONSTATUS_OK,
|
26
|
+
MESSAGEFAULT_ERROR_INCORRECT_EPOCH,
|
26
27
|
OPERATIONSTATUS_WAIT,
|
27
28
|
OPERATIONSTATUS_ERROR,
|
28
29
|
DOMAIN_VEHICLE_SECURITY,
|
@@ -233,7 +234,7 @@ class VehicleSigned(VehicleSpecific):
|
|
233
234
|
await self._handshake(DOMAIN_INFOTAINMENT)
|
234
235
|
return await self._send(DOMAIN_INFOTAINMENT, command.SerializeToString())
|
235
236
|
|
236
|
-
async def _send(self, domain: int, command: bytes) -> dict[str, Any]:
|
237
|
+
async def _send(self, domain: int, command: bytes, attempt: int = 1) -> dict[str, Any]:
|
237
238
|
"""Send a signed message to the vehicle."""
|
238
239
|
LOGGER.debug(f"Sending to domain {Domain.Name(domain)}")
|
239
240
|
msg = RoutableMessage()
|
@@ -273,7 +274,17 @@ class VehicleSigned(VehicleSpecific):
|
|
273
274
|
|
274
275
|
msg.signature_data.CopyFrom(signature)
|
275
276
|
|
276
|
-
|
277
|
+
try:
|
278
|
+
resp = await self._signed_message(msg)
|
279
|
+
except TeslaFleetMessageFaultIncorrectEpoch as e:
|
280
|
+
attempt += 1
|
281
|
+
if attempt > 3:
|
282
|
+
# We tried 3 times, give up, raise the error
|
283
|
+
raise e
|
284
|
+
LOGGER.info(f"Session expired, starting new handshake with {Domain.Name(domain)}")
|
285
|
+
await self._handshake(domain)
|
286
|
+
LOGGER.info(f"Handshake complete, retrying message to {Domain.Name(domain)}")
|
287
|
+
return await self._send(domain, command, attempt)
|
277
288
|
|
278
289
|
if resp.signedMessageStatus.operation_status == OPERATIONSTATUS_WAIT:
|
279
290
|
return {"response": {"result": False}}
|
@@ -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=
|
3
|
+
tesla_fleet_api/const.py,sha256=W-OuOboGuDn_txs7Y2eiVZOf8N_3K59hhWynVYEy1HM,12888
|
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
|
@@ -13,7 +13,7 @@ tesla_fleet_api/teslemetry.py,sha256=l404hRZuZonOAp3x4hgiLfJTM84y9A-hCSoe1vo5c2k
|
|
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
15
|
tesla_fleet_api/vehicle.py,sha256=rEaLBWK5Vd9K-SFnMy5jFEQK-6wxpVsyY1AJ-nmHm7c,31765
|
16
|
-
tesla_fleet_api/vehiclesigned.py,sha256=
|
16
|
+
tesla_fleet_api/vehiclesigned.py,sha256=_U0z6X1PTvZdCWblXRrEwUUexi4eUPVXGZzxrmTqA1I,39296
|
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
|
19
19
|
tesla_fleet_api/pb2/__init__.pyi,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.9.
|
29
|
-
tesla_fleet_api-0.9.
|
30
|
-
tesla_fleet_api-0.9.
|
31
|
-
tesla_fleet_api-0.9.
|
32
|
-
tesla_fleet_api-0.9.
|
28
|
+
tesla_fleet_api-0.9.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
29
|
+
tesla_fleet_api-0.9.2.dist-info/METADATA,sha256=dfS0s3a2F8n8QmnEDHsxLrZuH2dXvMUsrPVHLZ2L0Xc,3897
|
30
|
+
tesla_fleet_api-0.9.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
31
|
+
tesla_fleet_api-0.9.2.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
|
32
|
+
tesla_fleet_api-0.9.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|