linjmeyer / tilt-pitch

Simple replacement for the Tilt Hydrometer mobile apps and TiltPi with lots of features
GNU General Public License v3.0
51 stars 16 forks source link

Bluetooth Error #34

Closed Sleepybear closed 2 years ago

Sleepybear commented 2 years ago

I'm trying to run this on an Intel NUC that has a bluetooth adapter. I have it all setup and installed, but when I run python3 -m pitch I get the following:

python3 -m pitch
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.9) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
    ____  _ __       __
   / __ \(_) /______/ /_
  / /_/ / / __/ ___/ __ \
 / ____/ / /_/ /__/ / / /
/_/   /_/\__/\___/_/ /_/

Starting...
...started: File (pitch_log.json)
...started: InfluxDb2 (localhost:8086)
...started: Tilt scanner
Ready!  Listening for beacons
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/tj/.local/lib/python3.8/site-packages/beacontools/scanner.py", line 147, in run
    self.set_scan_parameters(**self.scan_parameters)
  File "/home/tj/.local/lib/python3.8/site-packages/beacontools/scanner.py", line 236, in set_scan_parameters
    self.backend.send_cmd(self.socket, OGF_LE_CTL, command_field, scan_parameter_pkg)
  File "/home/tj/.local/lib/python3.8/site-packages/beacontools/backend/linux.py", line 19, in send_cmd
    return bluez.hci_send_cmd(socket, group_field, command_field, data)
_bluetooth.error: (1, 'Operation not permitted')

Figured it was a permissions issue, but when I do sudo python3 -m pitch It just says /usr/bin/python3: No module named pitch

How do I give permission to pitch to use the bluetooth adapter?

Sleepybear commented 2 years ago

By installing using sudo command sudo pip3 install tilt-pitch && sudo pip3 install influxdb_client I was able to get it to run using sudo command, but is it possible to just grant bluetooth permissions to the module?

linjmeyer commented 2 years ago

For the module not found part - modules are "localized" to the user, so if you install it as root you can only run it as root, etc. You can also use virtualenvs . That's a python thing not a pitch thing.

For the permissions issues, can you/did you try these steps? https://github.com/linjmeyer/tilt-pitch/blob/master/examples/install/prereqs.sh In particular that last command may help.

Sleepybear commented 2 years ago

Yes, I did the last command, but I'll try it again.

Sleepybear commented 2 years ago

Weird, running the command again seemed to fix it. Cheers!

linjmeyer commented 2 years ago

If it pops up again feel free to reach out. I have an Ubuntu laptop and Raspberry PI both running Pitch, never had to run it again. Maybe something to do with the user or maybe it resets on reboots in some distros? Not sure, glad you got it working