tesla-fleet-api 1.0.8__py3-none-any.whl → 1.0.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tesla_fleet_api/const.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from enum import Enum
4
4
  import logging
5
5
 
6
- VERSION = "1.0.8"
6
+ VERSION = "1.0.9"
7
7
  LOGGER = logging.getLogger(__package__)
8
8
  SERVERS = {
9
9
  "na": "https://fleet-api.prd.na.vn.cloud.tesla.com",
@@ -97,9 +97,12 @@ class VehicleBluetooth(Commands):
97
97
  if device is not None:
98
98
  self.device = device
99
99
 
100
- async def find_vehicle(self, name: str | None = None, address: str | None = None, scanner: BleakScanner = BleakScanner()) -> BLEDevice:
100
+ async def find_vehicle(self, name: str | None = None, address: str | None = None, scanner: BleakScanner | None = None) -> BLEDevice:
101
101
  """Find the Tesla BLE device."""
102
102
 
103
+ if scanner is None:
104
+ scanner = BleakScanner(service_uuids=[SERVICE_UUID])
105
+
103
106
  if address is not None:
104
107
  device = await scanner.find_device_by_address(address)
105
108
  elif name is not None:
@@ -126,7 +129,8 @@ class VehicleBluetooth(Commands):
126
129
  self.device,
127
130
  self.vin,
128
131
  max_attempts=max_attempts,
129
- ble_device_callback=self.get_device
132
+ #ble_device_callback=self.get_device,
133
+ services=[SERVICE_UUID]
130
134
  )
131
135
  await self.client.start_notify(READ_UUID, self._on_notify)
132
136
 
@@ -212,6 +216,7 @@ class VehicleBluetooth(Commands):
212
216
  if resp.HasField(requires):
213
217
  return resp
214
218
 
219
+
215
220
  async def pair(self, role: Role = Role.ROLE_OWNER, form: KeyFormFactor = KeyFormFactor.KEY_FORM_FACTOR_CLOUD_KEY, timeout: int = 60):
216
221
  """Pair the key."""
217
222
 
@@ -183,7 +183,7 @@ class Session:
183
183
  self.counter = sessionInfo.counter
184
184
  self.epoch = sessionInfo.epoch
185
185
  self.delta = int(time.time()) - sessionInfo.clock_time
186
- if (not self.ready or self.publicKey != sessionInfo.publicKey):
186
+ if (not self.ready or getattr(self, "publicKey", "None") != sessionInfo.publicKey):
187
187
  self.publicKey = sessionInfo.publicKey
188
188
  self.sharedKey = self.parent.shared_key(sessionInfo.publicKey)
189
189
  self.hmac = hmac.new(self.sharedKey, "authenticated command".encode(), hashlib.sha256).digest()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tesla_fleet_api
3
- Version: 1.0.8
3
+ Version: 1.0.9
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,5 +1,5 @@
1
1
  tesla_fleet_api/__init__.py,sha256=3DZMoZ-5srW-7SooAjqcRubQDuZPY8rMKH7eqIp4qtg,392
2
- tesla_fleet_api/const.py,sha256=677X3D-SV_9h-QyD0UM9cz8XHt5PY5TnHmkQzT1458Q,3748
2
+ tesla_fleet_api/const.py,sha256=6avk1nS7GL_OVZaiC1Cmy0a-QoZ3LNoXTUjxFNKiPWA,3748
3
3
  tesla_fleet_api/exceptions.py,sha256=GvjJBR77xGt2g3vhiAxcNtysj-e1Me7F-9PwO9dyzOo,35430
4
4
  tesla_fleet_api/ratecalculator.py,sha256=4lz8yruUeouHXh_3ezsXX-CTpIegp1T1J4VuRV_qdHA,1791
5
5
  tesla_fleet_api/tesla/__init__.py,sha256=Cvpqu8OaOFmbuwu9KjgYrje8eVluDp2IU_zwdtXbmO0,282
@@ -12,8 +12,8 @@ tesla_fleet_api/tesla/partner.py,sha256=e-l6sEP6-IupjFEQieSUjhhvRXF3aL4ebPNahcGF
12
12
  tesla_fleet_api/tesla/tesla.py,sha256=Gs8-L3OsEMhs1N_vdDx-E46bOHKGowXTBxmRiP8NKh4,2391
13
13
  tesla_fleet_api/tesla/user.py,sha256=w8rwiAOIFjuDus8M0RpZ0wucJtw8kYFKtJfYVk7Ekr0,1194
14
14
  tesla_fleet_api/tesla/vehicle/__init__.py,sha256=3A5_wTQHofRShof4pUNOtF78-7lUh62uz2jq2ecnmRY,381
15
- tesla_fleet_api/tesla/vehicle/bluetooth.py,sha256=N4OHy1z_oAk8gOcub6AZ53Cpdi4PDur-5RAkWqi2hh0,16431
16
- tesla_fleet_api/tesla/vehicle/commands.py,sha256=zgfc2yo1UxEh8ePqSb-4h0UTK0RmpCG_9LZX44CES2c,51268
15
+ tesla_fleet_api/tesla/vehicle/bluetooth.py,sha256=SAzJL0GW8Gp5cCs_Gyc2qBJP9WVVwV_qwUFkQF8waTI,16561
16
+ tesla_fleet_api/tesla/vehicle/commands.py,sha256=_LXAtuAIkeojJuw8k1QjEabAQQH2MLD5YZyUH58QoSg,51288
17
17
  tesla_fleet_api/tesla/vehicle/fleet.py,sha256=K9BVZj6CChJSDSMFroa7Cz0KrsYWj32ILtQumarkLaU,32080
18
18
  tesla_fleet_api/tesla/vehicle/signed.py,sha256=RUzVnZIfykz3YZW2gaxd1iaN1i8LkLaEoiXrbqZn9kg,1339
19
19
  tesla_fleet_api/tesla/vehicle/vehicle.py,sha256=BlmHjV5Hly8v0vWNVBUhdNvwsSSuCuF946D7zROUB3s,823
@@ -44,8 +44,8 @@ tesla_fleet_api/teslemetry/vehicles.py,sha256=9nybVg7VHKLa2woMG6fzMmQP6xJIE_jdAd
44
44
  tesla_fleet_api/tessie/__init__.py,sha256=9lhQJaB6X4PObUL9QdaaZYqs2BxiTidu3zmHcBESLVw,78
45
45
  tesla_fleet_api/tessie/tessie.py,sha256=uhg0oOIxpwDvlvdBhKHeF3AGR2PzmdBgzh2-_EkmSq0,2617
46
46
  tesla_fleet_api/tessie/vehicles.py,sha256=gfEatilI_ct-R4CM5xYhrlduqCR9IHlyc56WmJf7v7k,1149
47
- tesla_fleet_api-1.0.8.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
48
- tesla_fleet_api-1.0.8.dist-info/METADATA,sha256=_Lo_vqVRgsfYm5-2kKVO0lT4BOplNA7fam0SQ6cjxwk,4382
49
- tesla_fleet_api-1.0.8.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
50
- tesla_fleet_api-1.0.8.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
51
- tesla_fleet_api-1.0.8.dist-info/RECORD,,
47
+ tesla_fleet_api-1.0.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
48
+ tesla_fleet_api-1.0.9.dist-info/METADATA,sha256=bDVsevE52Rb5wKU46C2oUVlDHMmMp9zClJl2KQlRpjk,4382
49
+ tesla_fleet_api-1.0.9.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
50
+ tesla_fleet_api-1.0.9.dist-info/top_level.txt,sha256=jeNbog_1saXBFrGpom9WyPWmilxsyP3szL_G7JLWQfM,16
51
+ tesla_fleet_api-1.0.9.dist-info/RECORD,,