brewpi-brewometer icon indicating copy to clipboard operation
brewpi-brewometer copied to clipboard

Not Issue - Install Suggestion

Open lgbainbridge opened this issue 7 years ago • 7 comments

@sibowler Here are directions that I think will greatly help all of your new RaspPi / new users going in the right direction quickly...

So I had my BrewPi all set up, added in the extra "security" features (to allow for Public/Private viewing) as well as hosting 2 web servers on my RaspPi. Below should be the steps to get you back up and brewing with the Tilt Hydrometer working.

  1. cd /home/brewpi

  2. sudo git clone https://github.com/sibowler/brewpi-brewometer.git

  3. sudo apt-get install bluez python-bluez python-scipy python-numpy libcap2-bin

  4. sudo setcap cap_net_raw+eip $(eval readlink -f ``which python)`

  5. python /brewpi-brewometer/tiltHydrometer-test/TiltHydrometerTest.py

  6. cd brewpi-brewometer/brewpi-web/

<------- only do these steps if you have already completed the "PublicBeerPanel" setup----->

  1. cp index.php admin.php (this copy/pastes the index pages as the new admin page, due to Public/Admin setup; the goal is to replace the admin.php page [current] with this new page)

  2. rm -r index.php (this deletes the index.php page from the Tilt additional code, so it won't overwrite the current index.php page)

<-------end of PublicBeerPanel specific directions------------------------------------------>

  1. sudo cp -r * /var/www/html/BrewPi/ (This is because I am running 2 web servers and this is where BrewPi is at)

  2. sudo chown -R www-data:www-data /var/www/html/BrewPi/

  3. cd /home/brewpi/brewpi-brewometer/brewpi-script/

  4. sudo cp -r * /home/brewpi/

  5. sudo chown -R brewpi:brewpi /home/brewpi

  6. sudo shutdown -r

I hope this helps. If you need to take a look at how I was setting up the PublicBeerPanel to see I missed anything I have it posted here as well... http://backpackbees.com/home-brewing/brew-controller-brew-servers/

I wasn't able to fully test because I don't have my Tilt Hydrometer yet.

lgbainbridge avatar Jan 02 '17 05:01 lgbainbridge

Hey! Im giving your instructions a go but on step 5 i get:

root@2ff923962d6a:/home/brewpi# python ./brewpi-brewometer/tiltHydrometer-test/TiltHydrometerTest.py ERROR: Loading default settings file (tiltHydrometer/settings.ini): No section: 'Manager' Scanning - 20 Secs (Control+C to exit early) Red: None Green: None Black: None Purple: None Orange: None Blue: None Yellow: None Pink: None Unhandled exception in thread started by <bound method TiltHydrometerManager.scan of <TiltHydrometer.TiltHydrometerManager instance at 0xb51c7738>> Traceback (most recent call last): File "/home/brewpi/brewpi-brewometer/tiltHydrometer-test/TiltHydrometer.py", line 360, in scan blescan.hci_le_set_scan_parameters(sock) File "/home/brewpi/brewpi-brewometer/tiltHydrometer-test/blescan.py", line 107, in hci_le_set_scan_parameters old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) _bluetooth.error: (9, 'Bad file descriptor')

zakit24 avatar Sep 18 '17 22:09 zakit24

Looks like a typo in your command: python /brewpi-brewometer/tiltHydrometer-test/TiltHydrometerTest.py is the command in step 5 You entered: python ./brewpi-brewometer/tiltHydrometer-test/TiltHydrometerTest.py (should be python / not python ./)

kaljade avatar Sep 19 '17 02:09 kaljade

Im not too proficient with coding, but with the way brewpi is installed with the new containers on the raspberry ./ is the only way i can access the "brewpi-brewometer" folder. If I use / then it says the folder doesn't exist.

and even if I cd into that folder and run I still get:

root@2ff923962d6a:/home/brewpi/brewpi-brewometer/tiltHydrometer-test# python TiltHydrometerTest.py Scanning - 20 Secs (Control+C to exit early) Red: None Green: None Black: None Purple: None Orange: None Blue: None Yellow: None Pink: None Unhandled exception in thread started by <bound method TiltHydrometerManager.scan of <TiltHydrometer.TiltHydrometerManager instance at 0xb51ed738>> Traceback (most recent call last): File "/home/brewpi/brewpi-brewometer/tiltHydrometer-test/TiltHydrometer.py", line 360, in scan blescan.hci_le_set_scan_parameters(sock) File "/home/brewpi/brewpi-brewometer/tiltHydrometer-test/blescan.py", line 107, in hci_le_set_scan_parameters old_filter = sock.getsockopt( bluez.SOL_HCI, bluez.HCI_FILTER, 14) _bluetooth.error: (9, 'Bad file descriptor') ^CTraceback (most recent call last): File "TiltHydrometerTest.py", line 21, in time.sleep(10) KeyboardInterrupt

zakit24 avatar Sep 19 '17 02:09 zakit24

If using brewpi via Docker, run your container with --net host to access bluetooth...

lum1n avatar Sep 19 '17 08:09 lum1n

Yup! That did it. I now get a reading from my Tilt while running the test. Thank you, I am still new to using Dockers. For now I have a fermentation going on so I am going to wait until that is over before proceeding past the TiltHydrometerTest, but so far so good.

zakit24 avatar Sep 19 '17 13:09 zakit24

when I run brewpi.py as non-root, I get this error in the log: Unhandled exception in thread started by <bound method TiltHydrometerManager.scan of <TiltHydrometer.TiltHydrometerManager instance at 0x745454e0>> Traceback (most recent call last): File "/home/brewpi/TiltHydrometer.py", line 374, in scan blescan.hci_enable_le_scan(sock) File "/home/brewpi/blescan.py", line 79, in hci_enable_le_scan hci_toggle_le_scan(sock, 0x01) File "/home/brewpi/blescan.py", line 103, in hci_toggle_le_scan bluez.hci_send_cmd(sock, OGF_LE_CTL, OCF_LE_SET_SCAN_ENABLE, cmd_pkt) _bluetooth.error: (1, 'Operation not permitted')

This feels like I missed the setcap command, but I ran it.

uSlackr avatar Feb 06 '18 01:02 uSlackr

This revised setcap worked for me

sudo setcap 'cap_net_raw,cap_net_admin+eip' $(eval readlink -f `which python`)

uSlackr avatar Feb 06 '18 01:02 uSlackr