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.bluetoothctl scan on
chmod +x bluetoothctl-parser.py
./bluetoothctl-parser.py
bluetoothctl scan on
chmod +x bluetoothctl-prettytable.py
./bluetoothctl-prettytable.py
<img src=https://dojolabs.s3.amazonaws.com/bluetooth/bluetoothctl-parser-script-output2.jpg>
<img src=https://dojolabs.s3.amazonaws.com/bluetooth/bluetoothctl-parser-script-output1.jpg>
<img src=https://dojolabs.s3.amazonaws.com/bluetooth/bluetoothctl-prettytable.jpg>
bluetoothctl.py
returns only [] or bluetoothctl-prettytable.py
returns a header row with no devices:
bluetoothctl scan on
is actually running.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.