VernierST / godirect-py

A Python module for reading from Vernier Go Direct® Sensors using USB or BLE.
GNU General Public License v3.0
8 stars 9 forks source link

Possible issue with Bleak on Raspberry Pi #19

Closed bobthechemist closed 3 years ago

bobthechemist commented 3 years ago

I am unable to get the example gdx programs to work with a GoDirect Temperature probe (BLE) on a Raspberry Pi (fresh install, Buster, Pi 3 B Rev 1.3). Bleak is version 0.11.0, godirect is version 1.0.7, python is version 3.7. Error appears with the following MWE

from gdx import gdx
gdx = gdx.gdx()
gdx.open_ble()

Starting from a sensor that is off, I turn on the sensor (red blinking light), run the program. Sensor is found and I am asked to choose the GDX-TMP ... Attempting to open the device results in the sensor blinking green but a python traceback with last two lines being:

bleak.exc.BleakDBusError: org.bluez.Error.NotPermitted
open device 0 = False
dvernier commented 3 years ago

Hello Bob,

My wife and I are headed off for a vacation for about a week.

I assume you are using the GDX python stuff from our website. Is that correc?

I am copying Sam, who wrote up that stuff, to see if he has a suggestion.

Dave

On Fri, Apr 16, 2021 at 6:46 AM bobthechemist @.***> wrote:

I am unable to get the example gdx programs to work with a GoDirect Temperature probe (BLE) on a Raspberry Pi (fresh install, Buster, Pi 3 B Rev 1.3). Bleak is version 0.11.0, godirect is version 1.0.7, python is version 3.7. Error appears with the following MWE

from gdx import gdx gdx = gdx.gdx() gdx.open_ble()

Starting from a sensor that is off, I turn on the sensor (red blinking light), run the program. Sensor is found and I am asked to choose the GDX-TMP ... Attempting to open the device results in the sensor blinking green but a python traceback with last two lines being:

bleak.exc.BleakDBusError: org.bluez.Error.NotPermitted open device 0 = False

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/VernierST/godirect-py/issues/19, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABN5U2SJSJHDOLU3DHAQYZLTJA5TPANCNFSM43BSHG6Q .

-- David L. Vernier Founder and Co-President Vernier Software & Technology 13979 SW Millikan Way Beaverton, OR 97005 503-277-2299 1-888-Vernier (1-888-837-6437) @.*** www.vernier.com

bobthechemist commented 3 years ago

This is correct, Dave. Sensor works great out of the box with USB Windows 10 graphical analysis and iPad BLE graphical analysis. Now trying to tackle the RPi.

Hello Bob, My wife and I are headed off for a vacation for about a week. I assume you are using the GDX python stuff from our website. Is that correc? I am copying Sam, who wrote up that stuff, to see if he has a suggestion. Dave

sswartley commented 3 years ago

Hello,

I wonder if it is an issue with the bluez library as described here? https://github.com/hbldh/bleak/issues/94

This information on upgrading bluez might be helpful: https://scribles.net/updating-bluez-on-raspberry-pi-from-5-43-to-5-50/

Also, I just want to make sure you that you saw the notes from the getting started guide that show the install steps for Linux

All the best,

stocktonkincade commented 3 years ago

This error has shown up for others. It appears that bluez v5.51 may have solved the problem for some users.

bobthechemist commented 3 years ago

Buster currently ships with bluez-5.50. Installing bluez-5.51 appears to be the trick. Code used is below:

sudo apt-get install libdbus-1-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev
wget www.kernel.org/pub/linux/bluetooth/bluez-5.51.tar.xz
tar xvf bluez-5.51.tar.xz 
cd bluez-5.51
./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental 
make -j4
sudo make install

Can confirm that both gdx_getting_started_bluetooth.py and gdx_getting_started_graphing.py work.

stocktonkincade commented 3 years ago

@bobthechemist, thank you for working through this. It will be very helpful for those that follow in your footsteps.