Skip to content

Commit c71dda6

Browse files
committed
Small tweak for device handling
1 parent a4fc56a commit c71dda6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tesla_fleet_api/tesla/vehicle/bluetooth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class VehicleBluetooth(Commands):
8686
_auth_method = "aes"
8787

8888
def __init__(
89-
self, parent: Tesla, vin: str, key: ec.EllipticCurvePrivateKey | None = None, device: None | str | BLEDevice = None
89+
self, parent: Tesla, vin: str, key: ec.EllipticCurvePrivateKey | None = None, device: BLEDevice | None = None
9090
):
9191
super().__init__(parent, vin, key)
9292
self.ble_name = "S" + hashlib.sha1(vin.encode('utf-8')).hexdigest()[:16] + "C"
@@ -95,7 +95,7 @@ def __init__(
9595
Domain.DOMAIN_INFOTAINMENT: asyncio.Queue(),
9696
}
9797
if device is not None:
98-
self.client = BleakClient(device, services=[SERVICE_UUID])
98+
self.device = device
9999

100100
async def find_vehicle(self, name: str | None = None, address: str | None = None, scanner: BleakScanner = BleakScanner()) -> BLEDevice:
101101
"""Find the Tesla BLE device."""
@@ -121,7 +121,7 @@ async def connect(self, device: BLEDevice | None = None, max_attempts: int = MAX
121121
if device:
122122
self.device = device
123123
if not self.device:
124-
raise ValueError(f"Device {self.ble_name} not found")
124+
raise ValueError(f"Device {self.ble_name} not found or provided")
125125
self.client = await establish_connection(
126126
BleakClient,
127127
self.device,

0 commit comments

Comments
 (0)