tesla-fleet-api 0.7.7__tar.gz → 0.8.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. {tesla_fleet_api-0.7.7/tesla_fleet_api.egg-info → tesla_fleet_api-0.8.0}/PKG-INFO +1 -1
  2. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/setup.py +1 -1
  3. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/const.py +1 -1
  4. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/energy.py +9 -9
  5. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/energyspecific.py +9 -9
  6. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/exceptions.py +163 -0
  7. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/__init__.py +0 -0
  8. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/__init__.pyi +0 -0
  9. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/car_server_pb2.py +332 -0
  10. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/common_pb2.py +47 -0
  11. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/errors_pb2.py +29 -0
  12. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/keys_pb2.py +23 -0
  13. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/signatures_pb2.py +74 -0
  14. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/universal_message_pb2.py +80 -0
  15. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/vcsec_pb2.py +245 -0
  16. tesla_fleet_api-0.8.0/tesla_fleet_api/pb2/vehicle_pb2.py +28 -0
  17. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/teslafleetapi.py +40 -1
  18. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/teslemetry.py +22 -13
  19. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/vehicle.py +9 -1
  20. tesla_fleet_api-0.8.0/tesla_fleet_api/vehiclesigned.py +1074 -0
  21. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0/tesla_fleet_api.egg-info}/PKG-INFO +1 -1
  22. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api.egg-info/SOURCES.txt +12 -1
  23. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/LICENSE +0 -0
  24. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/README.md +0 -0
  25. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/setup.cfg +0 -0
  26. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/__init__.py +0 -0
  27. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/charging.py +0 -0
  28. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/partner.py +0 -0
  29. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/ratecalculator.py +0 -0
  30. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/teslafleetoauth.py +0 -0
  31. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/teslafleetopensource.py +0 -0
  32. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/tessie.py +0 -0
  33. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/user.py +0 -0
  34. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api/vehiclespecific.py +0 -0
  35. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api.egg-info/dependency_links.txt +0 -0
  36. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/tesla_fleet_api.egg-info/requires.txt +0 -0
  37. {tesla_fleet_api-0.7.7 → tesla_fleet_api-0.8.0}/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.7.7
3
+ Version: 0.8.0
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
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="tesla_fleet_api",
8
- version="0.7.7",
8
+ version="0.8.0",
9
9
  author="Brett Adams",
10
10
  author_email="hello@teslemetry.com",
11
11
  description="Tesla Fleet API library for Python",
@@ -3,7 +3,7 @@
3
3
  from enum import Enum
4
4
  import logging
5
5
 
6
- VERSION = "0.7.7"
6
+ VERSION = "0.8.0"
7
7
  LOGGER = logging.getLogger(__package__)
8
8
  SERVERS = {
9
9
  "na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
@@ -32,10 +32,10 @@ class Energy:
32
32
  async def backup_history(
33
33
  self,
34
34
  energy_site_id: int,
35
- start_date: str,
36
- end_date: str,
37
- period: TeslaEnergyPeriod | str,
38
- time_zone: str,
35
+ period: TeslaEnergyPeriod | str | None,
36
+ start_date: str | None = None,
37
+ end_date: str | None = None,
38
+ time_zone: str | None = None,
39
39
  ) -> dict[str, Any]:
40
40
  """Returns the backup (off-grid) event history of the site in duration of seconds."""
41
41
  return await self._request(
@@ -55,7 +55,7 @@ class Energy:
55
55
  energy_site_id: int,
56
56
  start_date: str,
57
57
  end_date: str,
58
- time_zone: str,
58
+ time_zone: str | None = None,
59
59
  ) -> dict[str, Any]:
60
60
  """Returns the charging history of a wall connector."""
61
61
  return await self._request(
@@ -72,10 +72,10 @@ class Energy:
72
72
  async def energy_history(
73
73
  self,
74
74
  energy_site_id: int,
75
- start_date: str,
76
- end_date: str,
77
- period: TeslaEnergyPeriod | str,
78
- time_zone: str,
75
+ period: TeslaEnergyPeriod | str | None,
76
+ start_date: str | None = None,
77
+ end_date: str | None = None,
78
+ time_zone: str | None = None,
79
79
  ) -> dict[str, Any]:
80
80
  """Returns the energy measurements of the site, aggregated to the requested period."""
81
81
  return await self._request(
@@ -29,17 +29,17 @@ class EnergySpecific:
29
29
 
30
30
  async def backup_history(
31
31
  self,
32
- start_date: str,
33
- end_date: str,
34
32
  period: TeslaEnergyPeriod | str,
35
- time_zone: str,
33
+ start_date: str | None = None,
34
+ end_date: str | None = None,
35
+ time_zone: str | None = None,
36
36
  ) -> dict[str, Any]:
37
37
  """Returns the backup (off-grid) event history of the site in duration of seconds."""
38
38
  return await self._parent.backup_history(
39
39
  self.energy_site_id,
40
+ period,
40
41
  start_date,
41
42
  end_date,
42
- period,
43
43
  time_zone,
44
44
  )
45
45
 
@@ -47,7 +47,7 @@ class EnergySpecific:
47
47
  self,
48
48
  start_date: str,
49
49
  end_date: str,
50
- time_zone: str,
50
+ time_zone: str | None = None,
51
51
  ) -> dict[str, Any]:
52
52
  """Returns the charging history of a wall connector."""
53
53
  return await self._parent.charge_history(
@@ -59,17 +59,17 @@ class EnergySpecific:
59
59
 
60
60
  async def energy_history(
61
61
  self,
62
- start_date: str,
63
- end_date: str,
64
62
  period: TeslaEnergyPeriod | str,
65
- time_zone: str,
63
+ start_date: str | None = None,
64
+ end_date: str | None = None,
65
+ time_zone: str | None = None,
66
66
  ) -> dict[str, Any]:
67
67
  """Returns the energy measurements of the site, aggregated to the requested period."""
68
68
  return await self._parent.energy_history(
69
69
  self.energy_site_id,
70
+ period,
70
71
  start_date,
71
72
  end_date,
72
- period,
73
73
  time_zone,
74
74
  )
75
75
 
@@ -293,6 +293,169 @@ class LibraryError(Exception):
293
293
  """Errors related to this library."""
294
294
 
295
295
 
296
+ class TeslaFleetSigningError(TeslaFleetError):
297
+ """Vehicle has responded with an error when sending a signed command"""
298
+
299
+ message = "Vehicle has responded with an error when sending a signed command"
300
+
301
+
302
+ class UnknownFault(TeslaFleetSigningError):
303
+ """Unknown fault on signed command."""
304
+
305
+ message = "Unknown fault on signed command."
306
+ code = 1
307
+
308
+
309
+ class NotOnWhitelistFault(TeslaFleetSigningError):
310
+ """Not on whitelist fault on signed command."""
311
+
312
+ message = "Not on whitelist fault on signed command."
313
+ code = 2
314
+
315
+
316
+ class IVSmallerThanExpectedFault(TeslaFleetSigningError):
317
+ """IV smaller than expected fault on signed command."""
318
+
319
+ message = "IV smaller than expected fault on signed command."
320
+ code = 3
321
+
322
+
323
+ class InvalidTokenFault(TeslaFleetSigningError):
324
+ """Invalid token fault on signed command."""
325
+
326
+ message = "Invalid token fault on signed command."
327
+ code = 4
328
+
329
+
330
+ class TokenAndCounterInvalidFault(TeslaFleetSigningError):
331
+ """Token and counter invalid fault on signed command."""
332
+
333
+ message = "Token and counter invalid fault on signed command."
334
+ code = 5
335
+
336
+
337
+ class AESDecryptAuthFault(TeslaFleetSigningError):
338
+ """AES decrypt auth fault on signed command."""
339
+
340
+ message = "AES decrypt auth fault on signed command."
341
+ code = 6
342
+
343
+
344
+ class ECDSAInputFault(TeslaFleetSigningError):
345
+ """ECDSA input fault on signed command."""
346
+
347
+ message = "ECDSA input fault on signed command."
348
+ code = 7
349
+
350
+
351
+ class ECDSASignatureFault(TeslaFleetSigningError):
352
+ """ECDSA signature fault on signed command."""
353
+
354
+ message = "ECDSA signature fault on signed command."
355
+ code = 8
356
+
357
+
358
+ class LocalEntityStartFault(TeslaFleetSigningError):
359
+ """Local entity start fault on signed command."""
360
+
361
+ message = "Local entity start fault on signed command."
362
+ code = 9
363
+
364
+
365
+ class LocalEntityResultFault(TeslaFleetSigningError):
366
+ """Local entity result fault on signed command."""
367
+
368
+ message = "Local entity result fault on signed command."
369
+ code = 10
370
+
371
+
372
+ class CouldNotRetrieveKeyFault(TeslaFleetSigningError):
373
+ """Could not retrieve key fault on signed command."""
374
+
375
+ message = "Could not retrieve key fault on signed command."
376
+ code = 11
377
+
378
+
379
+ class CouldNotRetrieveTokenFault(TeslaFleetSigningError):
380
+ """Could not retrieve token fault on signed command."""
381
+
382
+ message = "Could not retrieve token fault on signed command."
383
+ code = 12
384
+
385
+
386
+ class SignatureTooShortFault(TeslaFleetSigningError):
387
+ """Signature too short fault on signed command."""
388
+
389
+ message = "Signature too short fault on signed command."
390
+ code = 13
391
+
392
+
393
+ class TokenIsIncorrectLengthFault(TeslaFleetSigningError):
394
+ """Token is incorrect length fault on signed command."""
395
+
396
+ message = "Token is incorrect length fault on signed command."
397
+ code = 14
398
+
399
+
400
+ class IncorrectEpochFault(TeslaFleetSigningError):
401
+ """Incorrect epoch fault on signed command."""
402
+
403
+ message = "Incorrect epoch fault on signed command."
404
+ code = 15
405
+
406
+
407
+ class IVIncorrectLengthFault(TeslaFleetSigningError):
408
+ """IV incorrect length fault on signed command."""
409
+
410
+ message = "IV incorrect length fault on signed command."
411
+ code = 16
412
+
413
+
414
+ class TimeExpiredFault(TeslaFleetSigningError):
415
+ """Time expired fault on signed command."""
416
+
417
+ message = "Time expired fault on signed command."
418
+ code = 17
419
+
420
+
421
+ class NotProvisionedWithIdentityFault(TeslaFleetSigningError):
422
+ """Not provisioned with identity fault on signed command."""
423
+
424
+ message = "Not provisioned with identity fault on signed command."
425
+ code = 18
426
+
427
+
428
+ class CouldNotHashMetadataFault(TeslaFleetSigningError):
429
+ """Could not hash metadata fault on signed command."""
430
+
431
+ message = "Could not hash metadata fault on signed command."
432
+ code = 19
433
+
434
+
435
+ SIGNING_EXCEPTIONS = [
436
+ None,
437
+ UnknownFault,
438
+ NotOnWhitelistFault,
439
+ IVSmallerThanExpectedFault,
440
+ InvalidTokenFault,
441
+ TokenAndCounterInvalidFault,
442
+ AESDecryptAuthFault,
443
+ ECDSAInputFault,
444
+ ECDSASignatureFault,
445
+ LocalEntityStartFault,
446
+ LocalEntityResultFault,
447
+ CouldNotRetrieveKeyFault,
448
+ CouldNotRetrieveTokenFault,
449
+ SignatureTooShortFault,
450
+ TokenIsIncorrectLengthFault,
451
+ IncorrectEpochFault,
452
+ IVIncorrectLengthFault,
453
+ TimeExpiredFault,
454
+ NotProvisionedWithIdentityFault,
455
+ CouldNotHashMetadataFault,
456
+ ]
457
+
458
+
296
459
  async def raise_for_status(resp: aiohttp.ClientResponse) -> None:
297
460
  """Raise an exception if the response status code is >=400."""
298
461
  # https://developer.tesla.com/docs/fleet-api#response-codes
File without changes
File without changes