thermo2016 / SensirionSmartGadget

6 stars 0 forks source link

Address type in btread.py #1

Open mhassell opened 6 years ago

mhassell commented 6 years ago

Hello, it seems that pygatt now uses a different convention for identifying the type of address a device uses (e.g. public, random). The sample code in btread.py has

device = adapter.connect(MACADDR,5,'random')

but this no longer works and throws an error from the pygatt backend that a string does not have an attribute of "name." This is because the string 'random' that is being passed should now look more like

ADDRTYPE = pygatt.backends.BLEAddressType.random

so now the connect call would look like

device = adapter.connect(MACADDR, TIMEOUT, ADDRTYPE)

where TIMEOUT is the timeout value and MACADDR is the address of the device.

I've found this issue using Ubuntu 16.04 LTS and Python 2.7

thermo2016 commented 6 years ago

Thanks for the info. I'll update the code if I get time.