tesla-fleet-api 1.0.0__py3-none-any.whl → 1.0.1__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 +1 -1
- tesla_fleet_api/tesla/bluetooth.py +6 -1
- tesla_fleet_api/tesla/vehicle/__init__.py +13 -0
- tesla_fleet_api/tesla/vehicle/bluetooth.py +219 -0
- tesla_fleet_api/tesla/vehicle/commands.py +1286 -0
- tesla_fleet_api/tesla/vehicle/fleet.py +847 -0
- tesla_fleet_api/tesla/vehicle/proto/__init__.py +0 -0
- tesla_fleet_api/tesla/vehicle/proto/__init__.pyi +9 -0
- tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.py +175 -0
- tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.pyi +904 -0
- tesla_fleet_api/tesla/vehicle/proto/common_pb2.py +33 -0
- tesla_fleet_api/tesla/vehicle/proto/common_pb2.pyi +130 -0
- tesla_fleet_api/tesla/vehicle/proto/errors_pb2.py +17 -0
- tesla_fleet_api/tesla/vehicle/proto/errors_pb2.pyi +32 -0
- tesla_fleet_api/tesla/vehicle/proto/keys_pb2.py +15 -0
- tesla_fleet_api/tesla/vehicle/proto/keys_pb2.pyi +21 -0
- tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.py +15 -0
- tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.pyi +17 -0
- tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.py +35 -0
- tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.pyi +152 -0
- tesla_fleet_api/tesla/vehicle/proto/universal_message_pb2.py +30 -0
- tesla_fleet_api/tesla/vehicle/proto/universal_message_pb2.pyi +148 -0
- tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.py +79 -0
- tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.pyi +482 -0
- tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.py +125 -0
- tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.pyi +1183 -0
- tesla_fleet_api/tesla/vehicle/signed.py +56 -0
- tesla_fleet_api/tesla/vehicle/vehicle.py +19 -0
- tesla_fleet_api/tesla/vehicle/vehicles.py +46 -0
- {tesla_fleet_api-1.0.0.dist-info → tesla_fleet_api-1.0.1.dist-info}/METADATA +1 -1
- tesla_fleet_api-1.0.1.dist-info/RECORD +51 -0
- tesla_fleet_api-1.0.0.dist-info/RECORD +0 -24
- {tesla_fleet_api-1.0.0.dist-info → tesla_fleet_api-1.0.1.dist-info}/LICENSE +0 -0
- {tesla_fleet_api-1.0.0.dist-info → tesla_fleet_api-1.0.1.dist-info}/WHEEL +0 -0
- {tesla_fleet_api-1.0.0.dist-info → tesla_fleet_api-1.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import base64
|
4
|
+
from typing import TYPE_CHECKING
|
5
|
+
|
6
|
+
from .fleet import VehicleFleet
|
7
|
+
from .commands import Commands
|
8
|
+
|
9
|
+
from ...exceptions import (
|
10
|
+
MESSAGE_FAULTS,
|
11
|
+
)
|
12
|
+
from .proto.signatures_pb2 import (
|
13
|
+
SessionInfo,
|
14
|
+
)
|
15
|
+
from .proto.universal_message_pb2 import (
|
16
|
+
RoutableMessage,
|
17
|
+
)
|
18
|
+
|
19
|
+
if TYPE_CHECKING:
|
20
|
+
from ..fleet import TeslaFleetApi
|
21
|
+
|
22
|
+
|
23
|
+
class VehicleSigned(VehicleFleet, Commands):
|
24
|
+
"""Class describing the Tesla Fleet API vehicle endpoints and commands for a specific vehicle with command signing."""
|
25
|
+
|
26
|
+
|
27
|
+
_auth_method = "hmac"
|
28
|
+
|
29
|
+
def __init__(self, parent: TeslaFleetApi, vin: str):
|
30
|
+
"""Initialize the VehicleSigned class."""
|
31
|
+
super().__init__(parent, vin)
|
32
|
+
super(Commands, self).__init__(parent, vin)
|
33
|
+
|
34
|
+
|
35
|
+
async def _send(self, msg: RoutableMessage) -> RoutableMessage:
|
36
|
+
"""Serialize a message and send to the signed command endpoint."""
|
37
|
+
|
38
|
+
async with self._sessions[msg.to_destination.domain].lock:
|
39
|
+
resp = await self.signed_command(
|
40
|
+
base64.b64encode(msg.SerializeToString()).decode()
|
41
|
+
)
|
42
|
+
|
43
|
+
resp_msg = RoutableMessage.FromString(base64.b64decode(resp["response"]))
|
44
|
+
|
45
|
+
# Check UUID?
|
46
|
+
# Check RoutingAdress?
|
47
|
+
|
48
|
+
if resp_msg.session_info:
|
49
|
+
self._sessions[resp_msg.from_destination.domain].update(
|
50
|
+
SessionInfo.FromString(resp_msg.session_info), self.private_key
|
51
|
+
)
|
52
|
+
|
53
|
+
if resp_msg.signedMessageStatus.signed_message_fault:
|
54
|
+
raise MESSAGE_FAULTS[resp_msg.signedMessageStatus.signed_message_fault]
|
55
|
+
|
56
|
+
return resp_msg
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import TYPE_CHECKING
|
3
|
+
|
4
|
+
|
5
|
+
if TYPE_CHECKING:
|
6
|
+
from ..tesla import Tesla
|
7
|
+
|
8
|
+
|
9
|
+
class Vehicle:
|
10
|
+
"""Base class describing a Tesla vehicle."""
|
11
|
+
|
12
|
+
vin: str
|
13
|
+
|
14
|
+
def __init__(self, parent: Tesla, vin: str):
|
15
|
+
self.vin = vin
|
16
|
+
|
17
|
+
def pre2021(self, vin: str) -> bool:
|
18
|
+
"""Checks if a vehicle is a pre-2021 model S or X."""
|
19
|
+
return vin[3] in ["S", "X"] and (vin[9] <= "L" or (vin[9] == "M" and vin[7] in ['1', '2', '3', '4']))
|
@@ -0,0 +1,46 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import TYPE_CHECKING
|
3
|
+
|
4
|
+
from .signed import VehicleSigned
|
5
|
+
from .bluetooth import VehicleBluetooth
|
6
|
+
from .fleet import VehicleFleet
|
7
|
+
from .vehicle import Vehicle
|
8
|
+
|
9
|
+
if TYPE_CHECKING:
|
10
|
+
from ..fleet import TeslaFleetApi
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
class Vehicles(dict[str, Vehicle]):
|
15
|
+
"""Class containing and creating vehicles."""
|
16
|
+
|
17
|
+
_parent: TeslaFleetApi
|
18
|
+
|
19
|
+
def __init__(self, parent: TeslaFleetApi):
|
20
|
+
self._parent = parent
|
21
|
+
|
22
|
+
def createFleet(self, vin: str) -> VehicleFleet:
|
23
|
+
"""Creates a Fleet API vehicle."""
|
24
|
+
vehicle = VehicleFleet(self._parent, vin)
|
25
|
+
self[vin] = vehicle
|
26
|
+
return vehicle
|
27
|
+
|
28
|
+
def createSigned(self, vin: str) -> VehicleSigned:
|
29
|
+
"""Creates a Fleet API vehicle that uses command protocol."""
|
30
|
+
vehicle = VehicleSigned(self._parent, vin)
|
31
|
+
self[vin] = vehicle
|
32
|
+
return vehicle
|
33
|
+
|
34
|
+
def createBluetooth(self, vin: str) -> VehicleBluetooth:
|
35
|
+
"""Creates a bluetooth vehicle that uses command protocol."""
|
36
|
+
vehicle = VehicleBluetooth(self._parent, vin)
|
37
|
+
self[vin] = vehicle
|
38
|
+
return vehicle
|
39
|
+
|
40
|
+
def specific(self, vin: str) -> Vehicle:
|
41
|
+
"""Legacy method for creating a Fleet API vehicle."""
|
42
|
+
return self.createFleet(vin)
|
43
|
+
|
44
|
+
def specificSigned(self, vin: str) -> VehicleSigned:
|
45
|
+
"""Legacy method for creating a Fleet API vehicle that uses command protocol."""
|
46
|
+
return self.createSigned(vin)
|
@@ -0,0 +1,51 @@
|
|
1
|
+
tesla_fleet_api/__init__.py,sha256=FewtEncMLxOZa3dVA3SsT3tY--RMNF9-GXIpOTkbXvk,396
|
2
|
+
tesla_fleet_api/const.py,sha256=8KPO_bQbwwspp1Gm-DrHt4EsuQQSFsp1n9yMk0b2hZA,3158
|
3
|
+
tesla_fleet_api/exceptions.py,sha256=nTo9MIJrAxL-UxzbrMrr00QhSvrLaSc6ee00Ko9pB1Q,34213
|
4
|
+
tesla_fleet_api/ratecalculator.py,sha256=4lz8yruUeouHXh_3ezsXX-CTpIegp1T1J4VuRV_qdHA,1791
|
5
|
+
tesla_fleet_api/tesla/__init__.py,sha256=sWIkVh4lesdp5eGQPC9Hjk_eoyN1_g9zz7vpMsJzTgo,219
|
6
|
+
tesla_fleet_api/tesla/bluetooth.py,sha256=7L6U8_xr2JiAX2YJOCLcsCOD7NkGdLLSf3-qnopHQtg,1092
|
7
|
+
tesla_fleet_api/tesla/charging.py,sha256=9zNSFi9vo8v03KQRKyosO5me49_tDrg3_25BRZibfQ0,1690
|
8
|
+
tesla_fleet_api/tesla/energysite.py,sha256=jauUrh14LL-EaMruxhye1YsNHjtTMmgCl1HCf_8mBeI,6070
|
9
|
+
tesla_fleet_api/tesla/fleet.py,sha256=NCkHLd-ddpa0wkSu_CEOG7ru9ea5HTLXud4lvkh3DWM,5516
|
10
|
+
tesla_fleet_api/tesla/oauth.py,sha256=pFGtIcERjsNKrO5VUEHm8WsNo1xF4DVbx3Yt2MhlGPQ,4070
|
11
|
+
tesla_fleet_api/tesla/partner.py,sha256=TU3Xg18x2w3PHv6Dy3Mo40pb417pp5lqnF0c1vDCt6g,1224
|
12
|
+
tesla_fleet_api/tesla/tesla.py,sha256=Jlz90-fM0nJbhnQN0k3ukNv59-9KqZZbyQ91IiLIbfo,2010
|
13
|
+
tesla_fleet_api/tesla/user.py,sha256=1LVwarEU-wmkqkPw0LGvNiPRy6uGRZkYL-vr17sz51M,1180
|
14
|
+
tesla_fleet_api/tesla/vehicle/__init__.py,sha256=luJKFuTGxmo4ef4tURaZgYwdkmWqCQrjxKogQzlFBtI,265
|
15
|
+
tesla_fleet_api/tesla/vehicle/bluetooth.py,sha256=QjnFT4UYNsS4UWD_Spq-2T6Qlh4HnVCX_1ZCS18XjT8,8153
|
16
|
+
tesla_fleet_api/tesla/vehicle/commands.py,sha256=INHps_29kPjblFSFJdQCrf2Ob3tURy6J9pO85NbGDVU,46874
|
17
|
+
tesla_fleet_api/tesla/vehicle/fleet.py,sha256=j9jGE6kGUnmlO6kvB2CBJcwaEPaJ-CGxP7Cgv2AI9AU,32018
|
18
|
+
tesla_fleet_api/tesla/vehicle/signed.py,sha256=lhf_zzMc9xL9P2S8GC7IQC-CEVkQNUIrT_gR8AvODCc,1659
|
19
|
+
tesla_fleet_api/tesla/vehicle/vehicle.py,sha256=kbL6o-doro5wD-pMBbFcphfSUz1jNApfAUDEZmleKNs,485
|
20
|
+
tesla_fleet_api/tesla/vehicle/vehicles.py,sha256=gG7I9tCr3-fag5DSLK2lXayBpjbgEpE61DeDzJZs4f8,1449
|
21
|
+
tesla_fleet_api/tesla/vehicle/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
+
tesla_fleet_api/tesla/vehicle/proto/__init__.pyi,sha256=qFXWNIgl71wB260u-XPzaAwWAHL6krw21q-aXnBtop0,252
|
23
|
+
tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.py,sha256=v_eb4NDIkx_ZYPYW29_EFRky5vQ4b2q14gwuQSbouYw,29202
|
24
|
+
tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.pyi,sha256=qkig9HEsOE4Dk2-r38BAWOyALqt7CtUnlirgSVt_oa8,46334
|
25
|
+
tesla_fleet_api/tesla/vehicle/proto/common_pb2.py,sha256=C5O6BBTckU3F-XItLfivaPG_XVCnzF_JX4mpVfM_jFk,3931
|
26
|
+
tesla_fleet_api/tesla/vehicle/proto/common_pb2.pyi,sha256=8aZiigp74MfSOMpHtMw0D9Jj0kwPz1zV_BIZfVWhh_0,5012
|
27
|
+
tesla_fleet_api/tesla/vehicle/proto/errors_pb2.py,sha256=nfOvriyjVgVxnJZIAYNRHiBa1_14dOXhC9Pokc5anV8,1631
|
28
|
+
tesla_fleet_api/tesla/vehicle/proto/errors_pb2.pyi,sha256=CNsAR7Oe6wavnqjzhInEyAFxMio6TtXfaNT0DUztn6o,1478
|
29
|
+
tesla_fleet_api/tesla/vehicle/proto/keys_pb2.py,sha256=-hyVP9-W1DypTYLaWwkOSUzgia6l9R3M9wUIgvNs-T0,1252
|
30
|
+
tesla_fleet_api/tesla/vehicle/proto/keys_pb2.pyi,sha256=HH-TfhE5ihwmoPCGdiVnZ5B7KkaMJglEpusgLc1J02M,676
|
31
|
+
tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.py,sha256=4crkLo6uC0YPkgw90jRjAqlGMFnRze_koUt2-pw14m4,1430
|
32
|
+
tesla_fleet_api/tesla/vehicle/proto/managed_charging_pb2.pyi,sha256=SqEmrfknTfzYTUYHtsoCpt1Fw2YpU3OyQllX247UfyQ,1227
|
33
|
+
tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.py,sha256=TRaJ6lzmJtryhhmBC_PbYzftc-pqCmwC6wuBCXHeuTg,4734
|
34
|
+
tesla_fleet_api/tesla/vehicle/proto/signatures_pb2.pyi,sha256=-OGm9ctBnEJiXk-3nkFCPRTxKgFiqFgMbKeq3x2zGGM,6101
|
35
|
+
tesla_fleet_api/tesla/vehicle/proto/universal_message_pb2.py,sha256=UklH73qoYsqxylie6IK8iIcw2tmykSqDiaBKSWz66OQ,5093
|
36
|
+
tesla_fleet_api/tesla/vehicle/proto/universal_message_pb2.pyi,sha256=a_RygTJL26v0rA7QuUwsxiG1_ZBcliwXCqOAqTIJ6UE,7647
|
37
|
+
tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.py,sha256=PDv9TfiXnNs6sQ0D5vBrsSSPinSqu3eBUwvTcG8xMWo,15919
|
38
|
+
tesla_fleet_api/tesla/vehicle/proto/vcsec_pb2.pyi,sha256=cyK1uyRtDjRVqVlyl5uRQYY1RhFlWSJheLg3PGfs-_s,28524
|
39
|
+
tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.py,sha256=bqyFJM-1qZ7W9XKREINhYZx8yXAudmq6W8_Pdfkhbkk,44711
|
40
|
+
tesla_fleet_api/tesla/vehicle/proto/vehicle_pb2.pyi,sha256=sAUW_9aVB8NqJCnhZjXMLfqfePLVZv_7PfSKZKEBaQA,74251
|
41
|
+
tesla_fleet_api/teslemetry/__init__.py,sha256=OnHrZEkPGVFrziwMA-vArvh5vgBn6vT_nMbIhjN49V0,68
|
42
|
+
tesla_fleet_api/teslemetry/teslemetry.py,sha256=BtV__OSenTg_dwM0aovbL--mv3HhIIWtoWHQp58sViQ,2990
|
43
|
+
tesla_fleet_api/teslemetry/vehicle.py,sha256=aCe4Vhs4WHd6OQ-gzdxsPubKF_C5aLBoHrDvzyVgucI,2277
|
44
|
+
tesla_fleet_api/tessie/__init__.py,sha256=UNsWgx5w0DJSIFcMd7jBBdSxklF3Vhubq9tSL8vfegg,56
|
45
|
+
tesla_fleet_api/tessie/tessie.py,sha256=Z6t-ulDL7zfBIAJ6L7EBUMux2iawWjR1cR4jvYIhVFg,2523
|
46
|
+
tesla_fleet_api/tessie/vehicle.py,sha256=C2Q0en3Uo3xtI2sU9jSHXUtYhgBrNJYYhl8gP2zVmfQ,1315
|
47
|
+
tesla_fleet_api-1.0.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
48
|
+
tesla_fleet_api-1.0.1.dist-info/METADATA,sha256=6wVdb-DMTVaAa9hKPrYQNjphXXMbE6Rabxf003sDSB8,4056
|
49
|
+
tesla_fleet_api-1.0.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
50
|
+
tesla_fleet_api-1.0.1.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
|
51
|
+
tesla_fleet_api-1.0.1.dist-info/RECORD,,
|
@@ -1,24 +0,0 @@
|
|
1
|
-
tesla_fleet_api/__init__.py,sha256=FewtEncMLxOZa3dVA3SsT3tY--RMNF9-GXIpOTkbXvk,396
|
2
|
-
tesla_fleet_api/const.py,sha256=uyfy2ZOfFZd4sunTRiIuB3FtGxIzmO1VAcSRs1pztSY,3158
|
3
|
-
tesla_fleet_api/exceptions.py,sha256=nTo9MIJrAxL-UxzbrMrr00QhSvrLaSc6ee00Ko9pB1Q,34213
|
4
|
-
tesla_fleet_api/ratecalculator.py,sha256=4lz8yruUeouHXh_3ezsXX-CTpIegp1T1J4VuRV_qdHA,1791
|
5
|
-
tesla_fleet_api/tesla/__init__.py,sha256=sWIkVh4lesdp5eGQPC9Hjk_eoyN1_g9zz7vpMsJzTgo,219
|
6
|
-
tesla_fleet_api/tesla/bluetooth.py,sha256=H4LQwNJ4RwtKMWMwfHTOyG2om11MtvC9px0Go2GCRNE,915
|
7
|
-
tesla_fleet_api/tesla/charging.py,sha256=9zNSFi9vo8v03KQRKyosO5me49_tDrg3_25BRZibfQ0,1690
|
8
|
-
tesla_fleet_api/tesla/energysite.py,sha256=jauUrh14LL-EaMruxhye1YsNHjtTMmgCl1HCf_8mBeI,6070
|
9
|
-
tesla_fleet_api/tesla/fleet.py,sha256=NCkHLd-ddpa0wkSu_CEOG7ru9ea5HTLXud4lvkh3DWM,5516
|
10
|
-
tesla_fleet_api/tesla/oauth.py,sha256=pFGtIcERjsNKrO5VUEHm8WsNo1xF4DVbx3Yt2MhlGPQ,4070
|
11
|
-
tesla_fleet_api/tesla/partner.py,sha256=TU3Xg18x2w3PHv6Dy3Mo40pb417pp5lqnF0c1vDCt6g,1224
|
12
|
-
tesla_fleet_api/tesla/tesla.py,sha256=Jlz90-fM0nJbhnQN0k3ukNv59-9KqZZbyQ91IiLIbfo,2010
|
13
|
-
tesla_fleet_api/tesla/user.py,sha256=1LVwarEU-wmkqkPw0LGvNiPRy6uGRZkYL-vr17sz51M,1180
|
14
|
-
tesla_fleet_api/teslemetry/__init__.py,sha256=OnHrZEkPGVFrziwMA-vArvh5vgBn6vT_nMbIhjN49V0,68
|
15
|
-
tesla_fleet_api/teslemetry/teslemetry.py,sha256=BtV__OSenTg_dwM0aovbL--mv3HhIIWtoWHQp58sViQ,2990
|
16
|
-
tesla_fleet_api/teslemetry/vehicle.py,sha256=aCe4Vhs4WHd6OQ-gzdxsPubKF_C5aLBoHrDvzyVgucI,2277
|
17
|
-
tesla_fleet_api/tessie/__init__.py,sha256=UNsWgx5w0DJSIFcMd7jBBdSxklF3Vhubq9tSL8vfegg,56
|
18
|
-
tesla_fleet_api/tessie/tessie.py,sha256=Z6t-ulDL7zfBIAJ6L7EBUMux2iawWjR1cR4jvYIhVFg,2523
|
19
|
-
tesla_fleet_api/tessie/vehicle.py,sha256=C2Q0en3Uo3xtI2sU9jSHXUtYhgBrNJYYhl8gP2zVmfQ,1315
|
20
|
-
tesla_fleet_api-1.0.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
21
|
-
tesla_fleet_api-1.0.0.dist-info/METADATA,sha256=vmW8VMIM1jR6N_64JNBgkivup9NBaM9blKTkFULRDxY,4056
|
22
|
-
tesla_fleet_api-1.0.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
23
|
-
tesla_fleet_api-1.0.0.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
|
24
|
-
tesla_fleet_api-1.0.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|