tesla-fleet-api 0.9.1__tar.gz → 0.9.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {tesla_fleet_api-0.9.1/tesla_fleet_api.egg-info → tesla_fleet_api-0.9.2}/PKG-INFO +1 -1
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/setup.py +1 -1
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/const.py +1 -1
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/vehiclesigned.py +14 -3
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2/tesla_fleet_api.egg-info}/PKG-INFO +1 -1
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/LICENSE +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/README.md +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/setup.cfg +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/__init__.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/charging.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/energy.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/energyspecific.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/exceptions.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/partner.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/__init__.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/__init__.pyi +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/car_server_pb2.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/common_pb2.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/errors_pb2.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/keys_pb2.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/signatures_pb2.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/universal_message_pb2.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/vcsec_pb2.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/vehicle_pb2.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/ratecalculator.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/teslafleetapi.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/teslafleetoauth.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/teslafleetopensource.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/teslemetry.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/tessie.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/user.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/vehicle.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/vehiclespecific.py +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api.egg-info/SOURCES.txt +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api.egg-info/dependency_links.txt +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api.egg-info/requires.txt +0 -0
- {tesla_fleet_api-0.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api.egg-info/top_level.txt +0 -0
@@ -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}}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api/pb2/universal_message_pb2.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.9.1 → tesla_fleet_api-0.9.2}/tesla_fleet_api.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|