[<< | Prev | Index | Next | >>]

Tuesday, December 10, 2019

Bluetooth LE library for Python3

[Technical entry: Python, Bluetooth LE/BLE/BTLE.]

In the process of writing a library for talking to the Airthings Wave+, I ended up writing a generic Bluetooth LE library of sorts. It's a thin wrapper around bluepy which in turn uses bluez, but put all together it makes a rather nice package because, for example, here is how you would connect to a device and read and display its manufacturer:

dev = BtleDevice(testDevice)
    print("Manufacturer: %s"%(dev[BtleDevice.manufacturer_name_uuid].decode()))

This is kind of what I would expect from a python library, but bluepy didn't quite make it there. (Not a failure of bluepy, per se, just another level of abstraction.)

I linked the file in my previous entry, but here it is again: Btle.py.

[<< | Prev | Index | Next | >>]

Simon Funk / simonfunk@gmail.com