tesla-fleet-api 0.9.5__py3-none-any.whl → 0.9.6__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. tesla_fleet_api/const.py +1 -1
  2. tesla_fleet_api/exceptions.py +239 -46
  3. tesla_fleet_api/pb2/__init__.pyi +9 -0
  4. tesla_fleet_api/pb2/car_server_pb2.py +164 -386
  5. tesla_fleet_api/pb2/car_server_pb2.pyi +904 -0
  6. tesla_fleet_api/pb2/common_pb2.py +26 -60
  7. tesla_fleet_api/pb2/common_pb2.pyi +130 -0
  8. tesla_fleet_api/pb2/errors_pb2.py +10 -22
  9. tesla_fleet_api/pb2/errors_pb2.pyi +32 -0
  10. tesla_fleet_api/pb2/keys_pb2.py +8 -16
  11. tesla_fleet_api/pb2/keys_pb2.pyi +21 -0
  12. tesla_fleet_api/pb2/managed_charging_pb2.py +8 -14
  13. tesla_fleet_api/pb2/managed_charging_pb2.pyi +17 -0
  14. tesla_fleet_api/pb2/signatures_pb2.py +28 -75
  15. tesla_fleet_api/pb2/signatures_pb2.pyi +152 -0
  16. tesla_fleet_api/pb2/universal_message_pb2.py +22 -78
  17. tesla_fleet_api/pb2/universal_message_pb2.pyi +148 -0
  18. tesla_fleet_api/pb2/vcsec_pb2.py +70 -236
  19. tesla_fleet_api/pb2/vcsec_pb2.pyi +482 -0
  20. tesla_fleet_api/pb2/vehicle_pb2.py +114 -267
  21. tesla_fleet_api/pb2/vehicle_pb2.pyi +1183 -0
  22. tesla_fleet_api/teslafleetapi.py +7 -5
  23. tesla_fleet_api/teslafleetoauth.py +1 -1
  24. tesla_fleet_api/teslemetry.py +2 -2
  25. tesla_fleet_api/vehicle.py +1 -1
  26. tesla_fleet_api/vehiclesigned.py +142 -94
  27. {tesla_fleet_api-0.9.5.dist-info → tesla_fleet_api-0.9.6.dist-info}/METADATA +12 -3
  28. tesla_fleet_api-0.9.6.dist-info/RECORD +42 -0
  29. {tesla_fleet_api-0.9.5.dist-info → tesla_fleet_api-0.9.6.dist-info}/WHEEL +1 -1
  30. tesla_fleet_api-0.9.5.dist-info/RECORD +0 -33
  31. {tesla_fleet_api-0.9.5.dist-info → tesla_fleet_api-0.9.6.dist-info}/LICENSE +0 -0
  32. {tesla_fleet_api-0.9.5.dist-info → tesla_fleet_api-0.9.6.dist-info}/top_level.txt +0 -0
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.5"
6
+ VERSION = "0.9.6"
7
7
  LOGGER = logging.getLogger(__package__)
8
8
  SERVERS = {
9
9
  "na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
@@ -148,6 +148,7 @@ class SubscriptionRequired(TeslaFleetError): # Teslemetry specific
148
148
  status = 402
149
149
  key = "subscription_required"
150
150
 
151
+
151
152
  class VehicleSubscriptionRequired(TeslaFleetError): # Teslemetry specific
152
153
  """Subscription is required in order to use Teslemetry."""
153
154
 
@@ -155,6 +156,7 @@ class VehicleSubscriptionRequired(TeslaFleetError): # Teslemetry specific
155
156
  status = 402
156
157
  key = "vehicle_subscription_required"
157
158
 
159
+
158
160
  class InsufficientCredits(TeslaFleetError):
159
161
  """Account has insufficient credits to make this request."""
160
162
 
@@ -162,6 +164,7 @@ class InsufficientCredits(TeslaFleetError):
162
164
  status = 402
163
165
  key = "insufficient_credits"
164
166
 
167
+
165
168
  class Forbidden(TeslaFleetError):
166
169
  """Access to this resource is not authorized, developers should check required Scope."""
167
170
 
@@ -318,18 +321,21 @@ class UnknownFault(TeslaFleetInformationFault):
318
321
  message = "Unknown fault on signed command."
319
322
  code = 1
320
323
 
324
+
321
325
  class NotOnWhitelistFault(TeslaFleetInformationFault):
322
326
  """Not on whitelist fault on signed command."""
323
327
 
324
328
  message = "Not on whitelist fault on signed command."
325
329
  code = 2
326
330
 
331
+
327
332
  class IVSmallerThanExpectedFault(TeslaFleetInformationFault):
328
333
  """IV smaller than expected fault on signed command."""
329
334
 
330
335
  message = "IV smaller than expected fault on signed command."
331
336
  code = 3
332
337
 
338
+
333
339
  class InvalidTokenFault(TeslaFleetInformationFault):
334
340
  """Invalid token fault on signed command."""
335
341
 
@@ -473,166 +479,184 @@ class TeslaFleetMessageFault(TeslaFleetError):
473
479
 
474
480
 
475
481
  class TeslaFleetMessageFaultBusy(TeslaFleetMessageFault):
476
- """Vehicle is busy"""
482
+ """Required vehicle subsystem is busy. Try again"""
477
483
 
478
- message = "Vehicle is busy"
484
+ message = "Required vehicle subsystem is busy. Try again"
479
485
  code = 1
480
486
 
481
487
 
482
488
  class TeslaFleetMessageFaultTimeout(TeslaFleetMessageFault):
483
- """Vehicle timed out"""
489
+ """Vehicle subsystem did not respond. Try again"""
484
490
 
485
- message = "Vehicle timed out"
491
+ message = "Vehicle subsystem did not respond. Try again"
486
492
  code = 2
487
493
 
488
494
 
489
495
  class TeslaFleetMessageFaultUnknownKeyId(TeslaFleetMessageFault):
490
- """Unknown Key ID"""
496
+ """Vehicle did not recognize the key used to authorize command. Make sure your key is paired with the vehicle"""
491
497
 
492
- message = "Unknown Key ID"
498
+ message = "Vehicle did not recognize the key used to authorize command. Make sure your key is paired with the vehicle"
493
499
  code = 3
494
500
 
495
501
 
496
502
  class TeslaFleetMessageFaultInactiveKey(TeslaFleetMessageFault):
497
- """Inactive Key"""
503
+ """Key used to authorize command has been disabled"""
498
504
 
499
- message = "Inactive Key"
505
+ message = "Key used to authorize command has been disabled"
500
506
  code = 4
501
507
 
502
508
 
503
509
  class TeslaFleetMessageFaultInvalidSignature(TeslaFleetMessageFault):
504
- """Invalid Signature"""
510
+ """Command signature/MAC is incorrect. Use included session info to update session and try again"""
505
511
 
506
- message = "Invalid Signature"
512
+ message = "Command signature/MAC is incorrect. Use included session info to update session and try again"
507
513
  code = 5
508
514
 
509
515
 
510
516
  class TeslaFleetMessageFaultInvalidTokenOrCounter(TeslaFleetMessageFault):
511
- """Invalid Token or Counter"""
517
+ """Command anti-replay counter has been used before. Use included session info to update session and try again"""
512
518
 
513
- message = "Invalid Token or Counter"
519
+ message = "Command anti-replay counter has been used before. Use included session info to update session and try again"
514
520
  code = 6
515
521
 
516
522
 
517
523
  class TeslaFleetMessageFaultInsufficientPrivileges(TeslaFleetMessageFault):
518
- """Insufficient Privileges"""
524
+ """User is not authorized to execute command. This can be because of the role or because of vehicle state"""
519
525
 
520
- message = "Insufficient Privileges"
526
+ message = "User is not authorized to execute command. This can be because of the role or because of vehicle state"
521
527
  code = 7
522
528
 
523
529
 
524
530
  class TeslaFleetMessageFaultInvalidDomains(TeslaFleetMessageFault):
525
- """Invalid Domains"""
531
+ """Command was malformed or addressed to an unrecognized vehicle system. May indicate client error or older vehicle firmware"""
526
532
 
527
- message = "Invalid Domains"
533
+ message = "Command was malformed or addressed to an unrecognized vehicle system. May indicate client error or older vehicle firmware"
528
534
  code = 8
529
535
 
530
536
 
531
537
  class TeslaFleetMessageFaultInvalidCommand(TeslaFleetMessageFault):
532
- """Invalid Command"""
538
+ """Unrecognized command. May indicate client error or unsupported vehicle firmware"""
533
539
 
534
- message = "Invalid Command"
540
+ message = "Unrecognized command. May indicate client error or unsupported vehicle firmware"
535
541
  code = 9
536
542
 
537
543
 
538
544
  class TeslaFleetMessageFaultDecoding(TeslaFleetMessageFault):
539
- """Decoding Error"""
545
+ """Could not parse command. Indicates client error"""
540
546
 
541
- message = "Decoding Error"
547
+ message = "Could not parse command. Indicates client error"
542
548
  code = 10
543
549
 
544
550
 
545
551
  class TeslaFleetMessageFaultInternal(TeslaFleetMessageFault):
546
- """Internal Error"""
552
+ """Internal vehicle error. Try again. Most commonly encountered when the vehicle has not finished booting"""
547
553
 
548
- message = "Internal Error"
554
+ message = "Internal vehicle error. Try again. Most commonly encountered when the vehicle has not finished booting"
549
555
  code = 11
550
556
 
551
557
 
552
558
  class TeslaFleetMessageFaultWrongPersonalization(TeslaFleetMessageFault):
553
- """Wrong Personalization"""
559
+ """Command sent to wrong VIN"""
554
560
 
555
- message = "Wrong Personalization"
561
+ message = "Command sent to wrong VIN"
556
562
  code = 12
557
563
 
558
564
 
559
565
  class TeslaFleetMessageFaultBadParameter(TeslaFleetMessageFault):
560
- """Bad Parameter"""
566
+ """Command was malformed or used a deprecated parameter"""
561
567
 
562
- message = "Bad Parameter"
568
+ message = "Command was malformed or used a deprecated parameter"
563
569
  code = 13
564
570
 
565
571
 
566
572
  class TeslaFleetMessageFaultKeychainIsFull(TeslaFleetMessageFault):
567
- """Keychain is Full"""
573
+ """Vehicle's keychain is full. You must delete a key before you can add another"""
568
574
 
569
- message = "Keychain is Full"
575
+ message = (
576
+ "Vehicle's keychain is full. You must delete a key before you can add another"
577
+ )
570
578
  code = 14
571
579
 
572
580
 
573
581
  class TeslaFleetMessageFaultIncorrectEpoch(TeslaFleetMessageFault):
574
- """Incorrect Epoch"""
582
+ """Session ID mismatch. Use included session info to update session and try again"""
575
583
 
576
- message = "Incorrect Epoch"
584
+ message = (
585
+ "Session ID mismatch. Use included session info to update session and try again"
586
+ )
577
587
  code = 15
578
588
 
579
589
 
580
590
  class TeslaFleetMessageFaultIVIncorrectLength(TeslaFleetMessageFault):
581
- """IV Incorrect Length"""
591
+ """Initialization Value length is incorrect (AES-GCM must use 12-byte IVs). Indicates a client programming error"""
582
592
 
583
- message = "IV Incorrect Length"
593
+ message = "Initialization Value length is incorrect (AES-GCM must use 12-byte IVs). Indicates a client programming error"
584
594
  code = 16
585
595
 
586
596
 
587
597
  class TeslaFleetMessageFaultTimeExpired(TeslaFleetMessageFault):
588
- """Time Expired"""
598
+ """Command expired. Use included session info to determine if clocks have desynchronized and try again"""
589
599
 
590
- message = "Time Expired"
600
+ message = "Command expired. Use included session info to determine if clocks have desynchronized and try again"
591
601
  code = 17
592
602
 
593
603
 
594
604
  class TeslaFleetMessageFaultNotProvisionedWithIdentity(TeslaFleetMessageFault):
595
- """Not Provisioned with Identity"""
605
+ """Vehicle has not been provisioned with a VIN and may require service"""
596
606
 
597
- message = "Not Provisioned with Identity"
607
+ message = "Vehicle has not been provisioned with a VIN and may require service"
598
608
  code = 18
599
609
 
600
610
 
601
611
  class TeslaFleetMessageFaultCouldNotHashMetadata(TeslaFleetMessageFault):
602
- """Could not Hash Metadata"""
612
+ """Internal vehicle error"""
603
613
 
604
- message = "Could not Hash Metadata"
614
+ message = "Internal vehicle error"
605
615
  code = 19
606
616
 
607
617
 
608
618
  class TeslaFleetMessageFaultTimeToLiveTooLong(TeslaFleetMessageFault):
609
- """Time to Live Too Long"""
619
+ """Vehicle rejected command because its expiration time was too far in the future. This is a security precaution"""
610
620
 
611
- message = "Time to Live Too Long"
621
+ message = "Vehicle rejected command because its expiration time was too far in the future. This is a security precaution"
612
622
  code = 20
613
623
 
614
624
 
615
625
  class TeslaFleetMessageFaultRemoteAccessDisabled(TeslaFleetMessageFault):
616
- """Remote Access Disabled"""
626
+ """The vehicle owner has disabled Mobile access"""
617
627
 
618
- message = "Remote Access Disabled"
628
+ message = "The vehicle owner has disabled Mobile access"
619
629
  code = 21
620
630
 
621
631
 
622
632
  class TeslaFleetMessageFaultRemoteServiceAccessDisabled(TeslaFleetMessageFault):
623
- """Remote Service Access Disabled"""
633
+ """The command was authorized with a Service key, but the vehicle has not been configured to permit remote service commands"""
624
634
 
625
- message = "Remote Service Access Disabled"
635
+ message = "The command was authorized with a Service key, but the vehicle has not been configured to permit remote service commands"
626
636
  code = 22
627
637
 
628
638
 
629
639
  class TeslaFleetMessageFaultCommandRequiresAccountCredentials(TeslaFleetMessageFault):
630
- """Command Requires Account Credentials"""
640
+ """The command requires proof of Tesla account credentials but was not sent over a channel that provides this proof. Resend the command using Fleet API"""
631
641
 
632
- message = "Command Requires Account Credentials"
642
+ message = "The command requires proof of Tesla account credentials but was not sent over a channel that provides this proof. Resend the command using Fleet API"
633
643
  code = 23
634
644
 
635
645
 
646
+ class TeslaFleetMessageFaultFieldExceedsMTU(TeslaFleetMessageFault):
647
+ """Client sent a request with a field that exceeds MTU"""
648
+
649
+ message = "Client sent a request with a field that exceeds MTU"
650
+ code = 24
651
+
652
+
653
+ class TeslaFleetMessageFaultResponseSizeExceedsMTU(TeslaFleetMessageFault):
654
+ """Client's request was received, but response size exceeded MTU"""
655
+
656
+ message = "Client's request was received, but response size exceeded MTU"
657
+ code = 25
658
+
659
+
636
660
  MESSAGE_FAULTS = [
637
661
  None,
638
662
  TeslaFleetMessageFaultBusy,
@@ -658,6 +682,175 @@ MESSAGE_FAULTS = [
658
682
  TeslaFleetMessageFaultRemoteAccessDisabled,
659
683
  TeslaFleetMessageFaultRemoteServiceAccessDisabled,
660
684
  TeslaFleetMessageFaultCommandRequiresAccountCredentials,
685
+ TeslaFleetMessageFaultFieldExceedsMTU,
686
+ TeslaFleetMessageFaultResponseSizeExceedsMTU,
687
+ None,
688
+ None,
689
+ None,
690
+ ]
691
+
692
+ class SignedMessageInformationFault(TeslaFleetError):
693
+ """Vehicle has responded with an error when sending a signed command"""
694
+
695
+ message = "Vehicle has responded with an error when sending a signed command"
696
+
697
+
698
+ class SignedMessageInformationFaultUnknown(SignedMessageInformationFault):
699
+ """Unknown fault on signed command."""
700
+
701
+ message = "Unknown fault on signed command."
702
+ code = 1
703
+
704
+
705
+ class SignedMessageInformationFaultNotOnWhitelist(SignedMessageInformationFault):
706
+ """Not on whitelist fault on signed command."""
707
+
708
+ message = "Not on whitelist fault on signed command."
709
+ code = 2
710
+
711
+
712
+ class SignedMessageInformationFaultIVSmallerThanExpected(SignedMessageInformationFault):
713
+ """IV smaller than expected fault on signed command."""
714
+
715
+ message = "IV smaller than expected fault on signed command."
716
+ code = 3
717
+
718
+
719
+ class SignedMessageInformationFaultInvalidToken(SignedMessageInformationFault):
720
+ """Invalid token fault on signed command."""
721
+
722
+ message = "Invalid token fault on signed command."
723
+ code = 4
724
+
725
+
726
+ class SignedMessageInformationFaultTokenAndCounterInvalid(SignedMessageInformationFault):
727
+ """Token and counter invalid fault on signed command."""
728
+
729
+ message = "Token and counter invalid fault on signed command."
730
+ code = 5
731
+
732
+
733
+ class SignedMessageInformationFaultAESDecryptAuth(SignedMessageInformationFault):
734
+ """AES decrypt auth fault on signed command."""
735
+
736
+ message = "AES decrypt auth fault on signed command."
737
+ code = 6
738
+
739
+
740
+ class SignedMessageInformationFaultECDSAInput(SignedMessageInformationFault):
741
+ """ECDSA input fault on signed command."""
742
+
743
+ message = "ECDSA input fault on signed command."
744
+ code = 7
745
+
746
+
747
+ class SignedMessageInformationFaultECDSASignature(SignedMessageInformationFault):
748
+ """ECDSA signature fault on signed command."""
749
+
750
+ message = "ECDSA signature fault on signed command."
751
+ code = 8
752
+
753
+
754
+ class SignedMessageInformationFaultLocalEntityStart(SignedMessageInformationFault):
755
+ """Local entity start fault on signed command."""
756
+
757
+ message = "Local entity start fault on signed command."
758
+ code = 9
759
+
760
+
761
+ class SignedMessageInformationFaultLocalEntityResult(SignedMessageInformationFault):
762
+ """Local entity result fault on signed command."""
763
+
764
+ message = "Local entity result fault on signed command."
765
+ code = 10
766
+
767
+
768
+ class SignedMessageInformationFaultCouldNotRetrieveKey(SignedMessageInformationFault):
769
+ """Could not retrieve key fault on signed command."""
770
+
771
+ message = "Could not retrieve key fault on signed command."
772
+ code = 11
773
+
774
+
775
+ class SignedMessageInformationFaultCouldNotRetrieveToken(SignedMessageInformationFault):
776
+ """Could not retrieve token fault on signed command."""
777
+
778
+ message = "Could not retrieve token fault on signed command."
779
+ code = 12
780
+
781
+
782
+ class SignedMessageInformationFaultSignatureTooShort(SignedMessageInformationFault):
783
+ """Signature too short fault on signed command."""
784
+
785
+ message = "Signature too short fault on signed command."
786
+ code = 13
787
+
788
+
789
+ class SignedMessageInformationFaultTokenIsIncorrectLength(SignedMessageInformationFault):
790
+ """Token is incorrect length fault on signed command."""
791
+
792
+ message = "Token is incorrect length fault on signed command."
793
+ code = 14
794
+
795
+
796
+ class SignedMessageInformationFaultIncorrectEpoch(SignedMessageInformationFault):
797
+ """Incorrect epoch fault on signed command."""
798
+
799
+ message = "Incorrect epoch fault on signed command."
800
+ code = 15
801
+
802
+
803
+ class SignedMessageInformationFaultIVIncorrectLength(SignedMessageInformationFault):
804
+ """IV incorrect length fault on signed command."""
805
+
806
+ message = "IV incorrect length fault on signed command."
807
+ code = 16
808
+
809
+
810
+ class SignedMessageInformationFaultTimeExpired(SignedMessageInformationFault):
811
+ """Time expired fault on signed command."""
812
+
813
+ message = "Time expired fault on signed command."
814
+ code = 17
815
+
816
+
817
+ class SignedMessageInformationFaultNotProvisionedWithIdentity(
818
+ SignedMessageInformationFault
819
+ ):
820
+ """Not provisioned with identity fault on signed command."""
821
+
822
+ message = "Not provisioned with identity fault on signed command."
823
+ code = 18
824
+
825
+
826
+ class SignedMessageInformationFaultCouldNotHashMetadata(SignedMessageInformationFault):
827
+ """Could not hash metadata fault on signed command."""
828
+
829
+ message = "Could not hash metadata fault on signed command."
830
+ code = 19
831
+
832
+
833
+ SIGNED_MESSAGE_INFORMATION_FAULTS = [
834
+ None,
835
+ SignedMessageInformationFaultUnknown,
836
+ SignedMessageInformationFaultNotOnWhitelist,
837
+ SignedMessageInformationFaultIVSmallerThanExpected,
838
+ SignedMessageInformationFaultInvalidToken,
839
+ SignedMessageInformationFaultTokenAndCounterInvalid,
840
+ SignedMessageInformationFaultAESDecryptAuth,
841
+ SignedMessageInformationFaultECDSAInput,
842
+ SignedMessageInformationFaultECDSASignature,
843
+ SignedMessageInformationFaultLocalEntityStart,
844
+ SignedMessageInformationFaultLocalEntityResult,
845
+ SignedMessageInformationFaultCouldNotRetrieveKey,
846
+ SignedMessageInformationFaultCouldNotRetrieveToken,
847
+ SignedMessageInformationFaultSignatureTooShort,
848
+ SignedMessageInformationFaultTokenIsIncorrectLength,
849
+ SignedMessageInformationFaultIncorrectEpoch,
850
+ SignedMessageInformationFaultIVIncorrectLength,
851
+ SignedMessageInformationFaultTimeExpired,
852
+ SignedMessageInformationFaultNotProvisionedWithIdentity,
853
+ SignedMessageInformationFaultCouldNotHashMetadata,
661
854
  ]
662
855
 
663
856
 
@@ -0,0 +1,9 @@
1
+ from . import car_server_pb2
2
+ from . import common_pb2
3
+ from . import errors_pb2
4
+ from . import keys_pb2
5
+ from . import managed_charging_pb2
6
+ from . import signatures_pb2
7
+ from . import universal_message_pb2
8
+ from . import vcsec_pb2
9
+ from . import vehicle_pb2