mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
check if name is None when scanning with bleak
This commit is contained in:
parent
2d9e8f63e1
commit
ed746eb8f5
1 changed files with 2 additions and 2 deletions
|
|
@ -1603,14 +1603,14 @@ async def main(argv):
|
||||||
if len(devices) == 0:
|
if len(devices) == 0:
|
||||||
logger.error("No ble device found")
|
logger.error("No ble device found")
|
||||||
for d in devices :
|
for d in devices :
|
||||||
if d.name.startswith("MeshCore-"):
|
if not d.name is None and d.name.startswith("MeshCore-"):
|
||||||
print(f"{d.address} {d.name}")
|
print(f"{d.address} {d.name}")
|
||||||
return
|
return
|
||||||
case "-S" :
|
case "-S" :
|
||||||
devices = await BleakScanner.discover(timeout=timeout)
|
devices = await BleakScanner.discover(timeout=timeout)
|
||||||
choices = []
|
choices = []
|
||||||
for d in devices:
|
for d in devices:
|
||||||
if d.name.startswith("MeshCore-"):
|
if not d.name is None and d.name.startswith("MeshCore-"):
|
||||||
choices.append((d.address, f"{d.address} {d.name}"))
|
choices.append((d.address, f"{d.address} {d.name}"))
|
||||||
if len(choices) == 0:
|
if len(choices) == 0:
|
||||||
logger.error("No BLE device found, exiting")
|
logger.error("No BLE device found, exiting")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue