tesla-fleet-api 0.9.6__py3-none-any.whl → 0.9.8__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.9.6"
6
+ VERSION = "0.9.8"
7
7
  LOGGER = logging.getLogger(__package__)
8
8
  SERVERS = {
9
9
  "na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
@@ -91,15 +91,15 @@ class TeslaFleetApi:
91
91
  method: Method,
92
92
  path: str,
93
93
  params: dict[str, Any] | None = None,
94
- json: dict[str, Any] | None = None,
94
+ json: dict[str, Any] | None = {},
95
95
  ) -> dict[str, Any]:
96
96
  """Send a request to the Tesla Fleet API."""
97
97
 
98
98
  if not self.server:
99
99
  raise ValueError("Server was not set at init. Call find_server() first.")
100
100
 
101
- if method == Method.GET and json is not None:
102
- raise ValueError("GET requests cannot have a body.")
101
+ if method == Method.GET:
102
+ json = None
103
103
 
104
104
  # Call a pre-request hook if provided
105
105
  if self.refresh_hook is not None:
@@ -36,7 +36,6 @@ from .pb2.car_server_pb2 import (
36
36
  Response,
37
37
  Action,
38
38
  MediaPlayAction,
39
- ResultReason,
40
39
  VehicleAction,
41
40
  VehicleControlFlashLightsAction,
42
41
  ChargingStartStopAction,
@@ -95,8 +94,6 @@ from .pb2.signatures_pb2 import (
95
94
  SIGNATURE_TYPE_HMAC_PERSONALIZED,
96
95
  TAG_DOMAIN,
97
96
  TAG_SIGNATURE_TYPE,
98
- KeyIdentity,
99
- SignatureData,
100
97
  SessionInfo,
101
98
  HMAC_Personalized_Signature_Data,
102
99
  TAG_PERSONALIZATION,
@@ -107,7 +104,6 @@ from .pb2.signatures_pb2 import (
107
104
  )
108
105
  from .pb2.common_pb2 import (
109
106
  Void,
110
- LatLong,
111
107
  PreconditioningTimes,
112
108
  OffPeakChargingTimes,
113
109
  # ChargeSchedule,
@@ -152,7 +148,7 @@ class Session:
152
148
 
153
149
  def get(self) -> HMAC_Personalized_Signature_Data:
154
150
  """Sign a command and return session metadata"""
155
- self.counter += 1
151
+ self.counter = self.counter+1
156
152
  return HMAC_Personalized_Signature_Data(
157
153
  epoch=self.epoch,
158
154
  counter=self.counter,
@@ -300,7 +296,7 @@ class VehicleSigned(VehicleSpecific):
300
296
  await sleep(2)
301
297
  return await self._sign(domain, command, attempt)
302
298
 
303
- if resp.HasField("signedMessageStatus"):
299
+ if resp.HasField("protobuf_message_as_bytes"):
304
300
  if(resp.from_destination.domain == DOMAIN_VEHICLE_SECURITY):
305
301
  vcsec = FromVCSECMessage.FromString(resp.protobuf_message_as_bytes)
306
302
  LOGGER.debug("VCSEC Response: %s", vcsec)
@@ -308,10 +304,10 @@ class VehicleSigned(VehicleSpecific):
308
304
  LOGGER.error("Command failed with reason: %s", vcsec.nominalError.genericError)
309
305
  return {
310
306
  "response": {
311
- "result": False,
312
- "reason": GenericError_E.Name(vcsec.nominalError.genericError)
307
+ "result": False,
308
+ "reason": GenericError_E.Name(vcsec.nominalError.genericError)
309
+ }
313
310
  }
314
- }
315
311
  elif vcsec.commandStatus.operationStatus == OPERATIONSTATUS_OK:
316
312
  return {"response": {"result": True, "reason": ""}}
317
313
  elif vcsec.commandStatus.operationStatus == OPERATIONSTATUS_WAIT:
@@ -323,7 +319,7 @@ class VehicleSigned(VehicleSpecific):
323
319
  await sleep(2)
324
320
  return await self._sign(domain, command, attempt)
325
321
  elif vcsec.commandStatus.operationStatus == OPERATIONSTATUS_ERROR:
326
- if(vcsec.commandStatus.signedMessageStatus):
322
+ if(resp.HasField("signedMessageStatus")):
327
323
  raise SIGNED_MESSAGE_INFORMATION_FAULTS[vcsec.commandStatus.signedMessageStatus.signedMessageInformation]
328
324
 
329
325
  elif(resp.from_destination.domain == DOMAIN_INFOTAINMENT):
@@ -345,7 +341,7 @@ class VehicleSigned(VehicleSpecific):
345
341
  }
346
342
  }
347
343
 
348
- return {"response": {"result": None, "reason": "No Response"}}
344
+ return {"response": {"result": True, "reason": ""}}
349
345
 
350
346
  async def actuate_trunk(self, which_trunk: Trunk | str) -> dict[str, Any]:
351
347
  """Controls the front or rear trunk."""
@@ -1023,6 +1019,7 @@ class VehicleSigned(VehicleSpecific):
1023
1019
  """Controls the panoramic sunroof on the Model S."""
1024
1020
  if isinstance(state, SunRoofCommand):
1025
1021
  state = state.value
1022
+ action = VehicleControlSunroofOpenCloseAction()
1026
1023
  match state:
1027
1024
  case "vent":
1028
1025
  action = VehicleControlSunroofOpenCloseAction(vent=Void())
@@ -1034,9 +1031,7 @@ class VehicleSigned(VehicleSpecific):
1034
1031
  return await self._sendInfotainment(
1035
1032
  Action(
1036
1033
  vehicleAction=VehicleAction(
1037
- vehicleControlSunroofOpenCloseAction=VehicleControlSunroofOpenCloseAction(
1038
- state=state
1039
- )
1034
+ vehicleControlSunroofOpenCloseAction=action
1040
1035
  )
1041
1036
  )
1042
1037
  )
@@ -1052,10 +1047,8 @@ class VehicleSigned(VehicleSpecific):
1052
1047
  """Turns on HomeLink (used to open and close garage doors)."""
1053
1048
  action = VehicleControlTriggerHomelinkAction()
1054
1049
  if lat is not None and lon is not None:
1055
- location = LatLong()
1056
- location.latitude = lat
1057
- location.longitude = lon
1058
- action.location = location
1050
+ action.location.latitude = lat
1051
+ action.location.longitude = lon
1059
1052
  if token is not None:
1060
1053
  action.token = token
1061
1054
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tesla_fleet_api
3
- Version: 0.9.6
3
+ Version: 0.9.8
4
4
  Summary: Tesla Fleet API library for Python
5
5
  Home-page: https://github.com/Teslemetry/python-tesla-fleet-api
6
6
  Author: Brett Adams
@@ -1,19 +1,19 @@
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=UdgXLx2blO4ByR3oY0YP2V0LjBCYbhsmWuMkBr3gwV0,12888
3
+ tesla_fleet_api/const.py,sha256=zQXR2XN7Y66UkbYcJyhCLXfdYEma8tLKPWsk_SR-LAE,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=qnRWqPJ_5gia4-j3o4mP5OwUuBRtC3SAbZKo-_XSRiI,29729
7
7
  tesla_fleet_api/partner.py,sha256=1vIBUaxKLIfqcC0X6VXZN0dMAzj_CLNPUMjA6QVqZ1k,1223
8
8
  tesla_fleet_api/ratecalculator.py,sha256=4lz8yruUeouHXh_3ezsXX-CTpIegp1T1J4VuRV_qdHA,1791
9
- tesla_fleet_api/teslafleetapi.py,sha256=8j-kvV6_oCuIlDdS5kWlCbo9chWsT48Gn2iKt3uOAjg,7409
9
+ tesla_fleet_api/teslafleetapi.py,sha256=39g52Q7C__ijOOgGy2EHvvNKwqCTu7zn9MIdTRCHmak,7345
10
10
  tesla_fleet_api/teslafleetoauth.py,sha256=NmzycAeg68sWASjiWan3B5LdIgrfmoLTDqLHYCmoKKg,4108
11
11
  tesla_fleet_api/teslafleetopensource.py,sha256=TJfVPcqJlA1b3kMoGuLr-g5Gn8UDyYsTZhjvGY1MtIk,2007
12
12
  tesla_fleet_api/teslemetry.py,sha256=_n59RQvJKl82ylLe09bLY_8iyfjz_DHqCdRVsWeif4s,3308
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=mSFJG-bLBNh_iSJnruk9EZSypZUxMpKwMgKA9_8CPDc,32146
16
- tesla_fleet_api/vehiclesigned.py,sha256=N06Evfo5_AwkOjNg0cpCHYV7SH-5zjzHsYnMmYpCKZY,42001
16
+ tesla_fleet_api/vehiclesigned.py,sha256=uwfX3MwPAtn5Otf5jUwSGuKWDVbswd3dDnNjPoxoYrM,41863
17
17
  tesla_fleet_api/vehiclespecific.py,sha256=P7KI8MqUbAyM2cfDC8NqbJXzGL2ZsOIx3IBeqB8xYQY,20656
18
18
  tesla_fleet_api/pb2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  tesla_fleet_api/pb2/__init__.pyi,sha256=qFXWNIgl71wB260u-XPzaAwWAHL6krw21q-aXnBtop0,252
@@ -35,8 +35,8 @@ tesla_fleet_api/pb2/vcsec_pb2.py,sha256=PDv9TfiXnNs6sQ0D5vBrsSSPinSqu3eBUwvTcG8x
35
35
  tesla_fleet_api/pb2/vcsec_pb2.pyi,sha256=cyK1uyRtDjRVqVlyl5uRQYY1RhFlWSJheLg3PGfs-_s,28524
36
36
  tesla_fleet_api/pb2/vehicle_pb2.py,sha256=bqyFJM-1qZ7W9XKREINhYZx8yXAudmq6W8_Pdfkhbkk,44711
37
37
  tesla_fleet_api/pb2/vehicle_pb2.pyi,sha256=sAUW_9aVB8NqJCnhZjXMLfqfePLVZv_7PfSKZKEBaQA,74251
38
- tesla_fleet_api-0.9.6.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
39
- tesla_fleet_api-0.9.6.dist-info/METADATA,sha256=NZZXKNqQjFt6LPS7r8TOsnEH89osm5SqRcVaIvaB5Ck,4022
40
- tesla_fleet_api-0.9.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
41
- tesla_fleet_api-0.9.6.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
42
- tesla_fleet_api-0.9.6.dist-info/RECORD,,
38
+ tesla_fleet_api-0.9.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
39
+ tesla_fleet_api-0.9.8.dist-info/METADATA,sha256=Y7yIGeP9Pb5EidzrtwxIfdxQXFe_5YMyR0zxRkQ_DcQ,4022
40
+ tesla_fleet_api-0.9.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
41
+ tesla_fleet_api-0.9.8.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
42
+ tesla_fleet_api-0.9.8.dist-info/RECORD,,