Two python scripts:
bluetoothctl-parser.py
- Gathers device info using bluetoothctl, cleans it up and outputs it STDOUT in JSON format.bluetoothctl-prettytable.py
- Gathers device info from bluetoothctl, cleans it and and outputs it to a table. This script gets device data every 5 seconds and refreshes the table. It runs in a forever loop.
- Start bluetooth scanning using bluetoothctl. Leave the scan running while using the script.
bluetoothctl scan on
- Open a second terminal and mark the script executable.
chmod +x bluetoothctl-parser.py
- Run the script. No privilege is required.
./bluetoothctl-parser.py
- Start bluetooth scanning using bluetoothctl. Leave the scan running while using the script.
bluetoothctl scan on
- Open a second terminal and mark the script executable.
chmod +x bluetoothctl-prettytable.py
- Run the script. No privilege is required.
./bluetoothctl-prettytable.py
bluetoothctl.py
returns only [] orbluetoothctl-prettytable.py
returns a header row with no devices:- Check that
bluetoothctl scan on
is actually running.
- Check that
- There are a few fields that sometimes still have a leading or trailing blank space; I need to remove those.
- Add writing results to a database to include first_seen, last_seen, GPS, etc..
- Integrate GPS recording.
bluetoothctl-prettytable.py
sometimes add a wonkily-formatted row when devices are in the process of being added. It goes away as soon as the device is fully seen. I need to chase it down in the tables to figure out how to clean that up.