Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scan for Bluetooth device
#1
Hello ,
I'm trying to scan for bluetooth devices around me
I'm using this simple code I have found here (
https://geektechstuff.com/2020/06/01/python-and-bluetooth-part-1-scanning-for-devices-and-services-python/
# geektechstuff bluetooth

import bluetooth

def scan():

    print("Scanning for bluetooth devices:")

    devices = bluetooth.discover_devices(lookup_names = True, lookup_class = True)

    number_of_devices = len(devices)

    print(number_of_devices,"devices found")

    for addr, name, device_class in devices:

        print("\n")

        print("Device:")

        print("Device Name: %s" % (name))

        print("Device MAC Address: %s" % (addr))

        print("Device Class: %s" % (device_class))

        print("\n")

    return
when I run it it show me a list of devices my computer allready know and connect to them in the past
1. why is it ?
2. what do I need to in order to scan and see "Live" devices?

Thanks,
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Read data via bluetooth frohr 9 3,422 Jul-10-2022, 09:51 AM
Last Post: frohr
  Connect to HC-05 Bluetooth (NOT BLE) korenron 0 1,479 Jun-26-2022, 09:06 AM
Last Post: korenron
  Read buffer from bluetooth frohr 2 2,158 Jun-01-2022, 01:31 PM
Last Post: frohr
  Sending string commands from Python to a bluetooth device Rovelin 13 9,531 Aug-31-2021, 06:40 PM
Last Post: deanhystad
  ModuleNotFoundError: No module named 'bluetooth' Error Rovelin 4 12,210 Aug-31-2021, 04:04 PM
Last Post: Rovelin
  Bluetooth send message after connecting? korenron 2 2,682 Apr-26-2021, 05:50 AM
Last Post: korenron
  Convert looping home security to a one time scan of switches and sensors duckredbeard 0 1,755 Dec-08-2020, 04:31 AM
Last Post: duckredbeard
  scan drives in windows from Cygwin RRR 1 1,641 Nov-29-2020, 04:34 PM
Last Post: Larz60+
  Bluetooth problem Lad 0 1,905 Sep-24-2020, 07:26 PM
Last Post: Lad
  bluetooth device inquiry anne 0 2,347 Aug-01-2020, 12:24 AM
Last Post: anne

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020