add safeguard for other kind of addresses

This commit is contained in:
Florent 2025-08-06 20:08:42 +02:00
parent 336f2f3d68
commit 790f25498c

View file

@ -58,11 +58,13 @@ class BLEConnection:
self.client = BleakClient(self.device, disconnected_callback=self.handle_disconnect)
else:
def match_meshcore_device(_: BLEDevice, adv: AdvertisementData):
def match_meshcore_device(d: BLEDevice, adv: AdvertisementData):
"""Filter to match MeshCore devices."""
if adv.local_name and adv.local_name.startswith("MeshCore"):
if self.address is None or self.address in adv.local_name:
return True
if d and d.address == self.address:
return True
return False
if self.address is None or ":" not in self.address: