[Version 2 Release] RaspberryPints - Digital Taplist Solution

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
To help you out on your quest the problem is that the MySQL_[function]s were deprecated in php 7

most of the changes needed are straight forward as there are direct replacements for the functions, but I think there or 2 in the original that don't have a new direct function but could be worked around

Example
mysql_connect($servername,'root',$rootpass);
mysql_query($sql) ;
$qry = mysql_query($sql);
while($b = mysql_fetch_array($qry)) {
$b['id']
}

could be (there are different ways in PHP to DB access this is just my preference)

$mysqli = new mysqli("$host", "$username", "$password", "$db_name")or die("cannot connect to server");
$qry = $mysqli->query($sql);
while($qry && $b = $qry->fetch_array()){
$b['id']
}
Thanks @RandR+ this will definitely help us get started! Don't get me wrong I think your efforts for the PHP7.0 new install version is awesome, and to paraphrase @day_trippr is likely to be what keeps this project alive in the future.

My motivation is to find an upgrade pathway for existing users, now that PHP5.6 is officially EOL, as some of us that have been around since Wheezy/Jessie have heavily customised our instances and would dread the prospect of having to start over.

Cheers,

Kal
 
Last edited:
T

My motivation is to find an upgrade pathway for existing users, now that PHP5.6 is officially EOL, as some of us that have been around since Wheezy/Jessie have heavily customised our instances and would dread the prospect of having to start over.

Cheers,

Kal

Kal, please clarify. Once RPints is working why update the OS and/or underlying software? If it "ain't broke, then don't fix it". I see no reason to update my Raspbian Jessie, MySQL, php, etc. It works. Leave it alone.
 
Kal, please clarify. Once RPints is working why update the OS and/or underlying software? If it "ain't broke, then don't fix it". I see no reason to update my Raspbian Jessie, MySQL, php, etc. It works. Leave it alone.

Security patching is very important, and performance improvements are also a good thing, but most importantly hardware issues inevitably come up and old hardware can become more difficult to source and new hardware often won't support old software, so it's always prudent to remain agile "just in case".

Dang. I need to put my RPints on the net to get rpi-clone. This is where un-updated things (OS, php, etc) run into problems. However, I'll only be on the net briefly so I should be OK.

Lol, I rest my case (beware KRACK, Spectre, Meltdown, etc while you are online) ;)
 
Dang. I need to put my RPints on the net to get rpi-clone. This is where un-updated things (OS, php, etc) run into problems. However, I'll only be on the net briefly so I should be OK.
rpi-clone is great and the preferred method, but if you want to stay on a local windows machine, use Win32DiskImager. You just have to make sure that your target card is larger than the card you are copying because it does a byte for byte copy. Sometimes an image from a similar sized card won't fit on another card due to a few extra bytes. Other than that, it works great. I create backup images and store them on a hard drive and my Google drive for backup purposes.
 
rpi-clone is great and the preferred method, but if you want to stay on a local windows machine, use Win32DiskImager. You just have to make sure that your target card is larger than the card you are copying because it does a byte for byte copy. Sometimes an image from a similar sized card won't fit on another card due to a few extra bytes. Other than that, it works great. I create backup images and store them on a hard drive and my Google drive for backup purposes.

This is great. So, Win32DiskImager handles Linux items? Yes, my spare microSD card is 32 gig whereas the Raspbian is 16 gig.

IMO, purchase extra microSD cards when they are on sale. These items are amazingly cheap right now.
 
Security patching is very important, and performance improvements are also a good thing, but most importantly hardware issues inevitably come up and old hardware can become more difficult to source and new hardware often won't support old software, so it's always prudent to remain agile "just in case".;)

Not trying to be disrespectful, but we're working on a special situation. I still say, leave things alone. If someone's Raspberry Pi fails then worry about upgrading. Life is too short for constant updates/fixes. IMO, fix when, and only when, needed.

Actually, I don't know a reason why the most current Raspberry Pi won't run our image of RPints. Hmm... perhaps we should clone our working RPints and sell.
 
Not trying to be disrespectful, but we're working on a special situation. I still say, leave things alone. If someone's Raspberry Pi fails then worry about upgrading. Life is too short for constant updates/fixes. IMO, fix when, and only when, needed.

Actually, I don't know a reason why the most current Raspberry Pi won't run our image of RPints. Hmm... perhaps we should clone our working RPints and sell.
No offence taken, we are all in our own unique situations, but I'm still keen to find an upgrade pathway for myself and happy to share with anyone else that also wants to.

My understanding (which again may be wrong) is that the latest Pi will only run Stretch or higher due to a change in the bootloader, so that means RPints is out on the latest hardware, but either way I'd like to get mine up to a security patched version of the OS and underlying software.
 
@RandR+ a quick search on the original files for 'mysql_' shows the following 24 files:
Code:
/index.php
/includes/pours.php
/admin/Mya.php
/admin/personalize.php
/admin/update_header_text.php
/admin/update_header_text_trunclen.php
/admin/left_bar.php
/admin/tap_form.php
/admin/update.php
/admin/push_update.php
/install/index.php
/admin/includes/insert.php
/admin/includes/email_tou.php
/admin/includes/send_username_ac.php
/admin/includes/sendpassword.php
/admin/includes/checklogin.php
/install/includes/configprocessor.php
/install/includes/config_files.php
/admin/includes/managers/beerStyle_manager.php
/admin/includes/managers/keg_manager.php
/admin/includes/managers/beer_manager.php
/admin/includes/managers/kegStatus_manager.php
/admin/includes/managers/kegType_manager.php
/admin/includes/managers/tap_manager.php
Does that align with your findings?

Cheers,

Kal
 
So MariaDB may not actually be the problem.

One thing mariadb does different by default is that the root user cannot log in using a password. Only sudo mysql will work out of the box.

Not a big deal but it does break the installer php for the original rpints. Unless a work around for php exists I didnt research to much
 
One thing mariadb does different by default is that the root user cannot log in using a password. Only sudo mysql will work out of the box.

Not a big deal but it does break the installer php for the original rpints. Unless a work around for php exists I didnt research to much
You can create a root password in MariaDB with the following commands:
Code:
sudo mysql -u root
update mysql.user set plugin = '' where user='root' and host='localhost';
set password = password('enter_your_password_here');
flush privileges;
quit
So that could potentially be added to the installation steps rather than coding around it?

Cheers,

Kal
 
Last edited:
Visited http://www.raspberrypi.org/downloads/

See "Raspberry Pi Desktop (for PC and Mac)
Debian with Raspberry Pi Desktop is the Foundation’s operating system for PC and Mac. You can create a live disc, run it in a virtual machine, or even install it on your computer."

Woohoo, virtual machine. Does this mean we can run Raspbian in a Windows VM?
 
Visited http://www.raspberrypi.org/downloads/

See "Raspberry Pi Desktop (for PC and Mac)
Debian with Raspberry Pi Desktop is the Foundation’s operating system for PC and Mac. You can create a live disc, run it in a virtual machine, or even install it on your computer."

Woohoo, virtual machine. Does this mean we can run Raspbian in a Windows VM?
Well that's a welcome addition to the NOOBS fleet!
 
Well that all got sideways or something - I thought MS was going to put a stripper W10 on the RPi!
Anyway, perhaps there's some value there but I'm not keeping a windows box alive just for a tap list.
Even the 3B+ only uses a few watts of power...

Cheers!
 
Well that all got sideways or something - I thought MS was going to put a stripper W10 on the RPi!
Anyway, perhaps there's some value there but I'm not keeping a windows box alive just for a tap list.
Even the 3B+ only uses a few watts of power...

Cheers!

Wow :drunk:

Anyway...

No one is recommending keeping a windows box alive for RPints. The VM is for testing/upgrading/experimenting.

I'm getting the impression that there's a communication problem extant here...
 
@RandR+ a quick search on the original files for 'mysql_'
Does that align with your findings?

Cheers,

Kal

Looks Right, in fact here are all the deprecated functions I found in a quick search:
mysql_close
mysql_connect
mysql_fetch_array
mysql_fetch_row
mysql_num_rows
mysql_query
mysql_real_escape_string
mysql_result
mysql_select_db
 
Visited http://www.raspberrypi.org/downloads/

See "Raspberry Pi Desktop (for PC and Mac)
Debian with Raspberry Pi Desktop is the Foundation’s operating system for PC and Mac. You can create a live disc, run it in a virtual machine, or even install it on your computer."

Woohoo, virtual machine. Does this mean we can run Raspbian in a Windows VM?

I have Jessie and Stretch VMs for Oracle Virtual Box I use for testing. If they weren't so large I would upload the virtual disk to help you get started

One thing is that the Desktop version is not the full Raspbian, it doesn't support any GPIO commands meaning you cannot test flow meters with it.
 
Correct, the desktop doesn't support GPIO, but hopefully we do have enough functionality to upgrade RPints (without the flow meters) to the latest.

Raspbian November 26, 2018 kernel 4.9 downloaded from the raspberrypi.org site (iso image) running in Windows 10 using VMWare

2019 Raspbian running in a Windows VM - Copy.png
 
Raspbian November 26, 2018 kernel 4.9 downloaded from the raspberrypi.org site (iso image) running in Windows 10 using VMWare

I'm sure you thought of this but once you get Raspbian configured make a copy of the virtual Disk so that you can start over any time you want (i.e. test the full LAMP installation repeatedly)
 
Looks Right, in fact here are all the deprecated functions I found in a quick search:
mysql_close
mysql_connect
mysql_fetch_array
mysql_fetch_row
mysql_num_rows
mysql_query
mysql_real_escape_string
mysql_result
mysql_select_db
Thanks @RandR+ you're a legend!
 
Try running this Script on the pi:
https://raw.githubusercontent.com/rtlindne/RaspberryPints/master/util/installRaspberryPints
simply download it to the pi and run
# i.e. "chmod +x installRaspberryPints"
# i.e. "sudo ./installRaspberryPints"

Ive made some updates to it in the past month that should make it work on the latest Stretch version

Thank you for developing such an easy to follow script - after days of trying to work with the original instructions from the RaspberryPints website I'm finally getting somewhere! I'm encountering this error just after I've entered usernames and passwords etc (have used the default):

Do you want to turn off Screen Blanking? (Y:N) (default is: Y): y
Do you want to start with Chromium in Kiosk MOde? (Y:N) (default is: Y): y
Site phpmyadmin already enabled
RaspberryPints Database Name? (default is: raspberrypints): raspberrypints
RaspberryPints Database User Name? (default is: RaspberryPints): RaspberryPints
RaspberryPints Database User Password? (default is: RaspberryPints):
Database loading
ERROR 1136 (21S01) at line 370: Column count doesn't match value count at row 41
pi@raspberrypi:~ $

Any help would be greatly appreciated.
 
ERROR 1136 (21S01) at line 370: Column count doesn't match value count at row 41
pi@raspberrypi:~ $

Any help would be greatly appreciated.

My bad, should be fixed now if you rerun the script, I just put the fix in GitHub

I was committing some new features (thanks to original work done by day_trippr) but I was piecing them in so they were in seperate check ins and made a mistake in the last sql one. Goes to show after you commit retest
 
I'm sure you thought of this but once you get Raspbian configured make a copy of the virtual Disk so that you can start over any time you want (i.e. test the full LAMP installation repeatedly)

That's the plan.

Have the following setup and working in the VM.

Server type: MariaDB
Server version: 10.1.37-MariaDB-0+deb9u1 - Debian 9.6
PHP version: 7.2.13
phpMyAdmin
 
That's the plan.

Have the following setup and working in the VM.

Server type: MariaDB
Server version: 10.1.37-MariaDB-0+deb9u1 - Debian 9.6
PHP version: 7.2.13
phpMyAdmin
So in theory it's just a case of replacing the deprecated functions @RandR+ listed above, in the 24 files I listed earlier. Simples ;)
 
Over the last few weeks I've had a few hardware and software failures that have made me have to re-evaluate my setup. My current setup had a brewpi box controlling the fridge... overkill I know but after freezing a keg or two with the janky adjustment dial on the mini fridge I decided that temperature control needed to be overridden and I had some extra parts to make a brewpi. The box was always annoying and in the way with several power adapters and such.. So I have 3d printed some cases and have neatly tucked the parts for the brewpi and raspberry pints neatly inside the compressor hump in the fridge. I have cleaned up the wiring so everything is powered from one plug by plugging in the fridge which is a huge improvement.

On the hardware side one of the failures I had to prompt this change is my flow sensors connecting to a terminal block in the fridge. The harsh environment and moisture caused some corrosion to I believe interfere with connection and take my flow sensors down. I'm tackling that problem by running all the wires out of the fridge before connecting them.

On the software side my website would refuse to connect or ssh would refuse to connect. Or inconsistently it would load on say a tablet but not my computer I would have to power cycle to get reliable connection back even though my router would show the pi as connected with strong connection.. Definitely wasn't behaving as it once was. Overall just no reliability. Since reinstalling from scratch it seems to have 100 percent reliability and connections from multiple sources.

Long story short all my backups and latest images have behaved the same way I'm assuming do to corrupt files or what have ya. This has caused me to have to completely start over completely clean without any unnecessary things I may have put in along the way to break my setup. Once I've got a fully working setup I will clone an early version and then just handle backups of the database separately. This way if something happens in the future I can go back to a true zero point clean installation instead of copying compounding problems with a "newer update"

One hangup I'm having is I'm changing from using an arduberry to a regular arduino uno for the flow sensors. So basically both unos plug into the pi via usb, since I need the brewpi setup as well on this fridge. The problem I am seeing is the addresses that are assigned to the arduinos. The first one I plug in to usb gets assigned tty.ACM0 and the second gets assigned tty.ACM1. If I reboot the same arduino doesn't always get the same designation and brewpi script wont load as well as the flow stuff wouldnt work properly. I've already pointed the pints flow services to talk via tty.ACM1. I can fix this by unplugging them both and plugging them back in order. However, I need something more hardy that can survive a reboot since they are tucked away back inside the back of the fridge and wont be super conveniently accessible. I assume somebody has had to have run into a similar issue or knows a fix? Thanks in advance.
 
Used Notepad++ to find the following references in Raspberry Pints version 2.0.1.

mysql_close
admin\update.php (1 hit)

mysql_connect
install\includes\configprocessor.php (2 hits)
install\includes\config_files.php (2 hits)

mysql_fetch_array
admin\includes\managers\beerStyle_manager.php (2 hits)
admin\includes\managers\beer_manager.php (4 hits)
admin\includes\managers\kegStatus_manager.php (2 hits)
admin\includes\managers\kegType_manager.php (2 hits)
admin\includes\managers\keg_manager.php (5 hits)
admin\includes\managers\tap_manager.php (3 hits)
admin\includes\send_username_ac.php (1 hit)
admin\personalize.php (2 hits)
admin\tap_form.php (1 hit)
admin\update.php (1 hit)
includes\pours.php (2 hits)
index.php (4 hits)

mysql_fetch_row
admin\includes\email_tou.php (1 hit)

mysql_num_rows
admin\includes\checklogin.php (1 hit)
admin\includes\send_username_ac.php (1 hit)

mysql_query
admin\includes\checklogin.php (1 hit)
admin\includes\email_tou.php (1 hit)
admin\includes\insert.php (1 hit)
admin\includes\managers\beerStyle_manager.php (2 hits)
admin\includes\managers\beer_manager.php (6 hits)
admin\includes\managers\kegStatus_manager.php (2 hits)
admin\includes\managers\kegType_manager.php (2 hits)
admin\includes\managers\keg_manager.php (7 hits)
admin\includes\managers\tap_manager.php (11 hits)
admin\includes\sendpassword.php (1 hit)
admin\includes\send_username_ac.php (1 hit)
admin\left_bar.php (1 hit)
admin\Mya.php (3 hits)
admin\personalize.php (2 hits)
admin\push_update.php (1 hit)
admin\tap_form.php (1 hit)
admin\update.php (1 hit)
admin\update_header_text.php (1 hit)
admin\update_header_text_trunclen.php (1 hit)
includes\pours.php (3 hits)
index.php (4 hits)
install\includes\configprocessor.php (2 hits)
install\index.php (1 hit)

mysql_real_escape_string
admin\includes\checklogin.php (2 hits)

mysql_result
admin\left_bar.php (1 hit)
admin\Mya.php (3 hits)
install\index.php (1 hit)

mysql_select_db
install\includes\config_files.php (2 hits)
 
Please realize not just a simple matter of changing the mysql to MariaDB syntax.

For example mysql's mysql_close in MariaDB is mysql_close(mysql handle)

So in the Raspberry Pints code we'll need to find and replace the mysql_connect with MariaDB's mysql_real_connect or other equivalent code.
 
[...]

One hangup I'm having is I'm changing from using an arduberry to a regular arduino uno for the flow sensors. So basically both unos plug into the pi via usb, since I need the brewpi setup as well on this fridge. The problem I am seeing is the addresses that are assigned to the arduinos. The first one I plug in to usb gets assigned tty.ACM0 and the second gets assigned tty.ACM1. If I reboot the same arduino doesn't always get the same designation and brewpi script wont load as well as the flow stuff wouldnt work properly. I've already pointed the pints flow services to talk via tty.ACM1. I can fix this by unplugging them both and plugging them back in order. However, I need something more hardy that can survive a reboot since they are tucked away back inside the back of the fridge and wont be super conveniently accessible. I assume somebody has had to have run into a similar issue or knows a fix? Thanks in advance.

You can manage this by using the /etc/udev/rules.d/99-arduino.rules file to hard-code each Arduino to a logical port.
Here's an example of adding a fourth UNO to a BrewPi host. Hopefully you'll find it explanatory but if you have any questions please ask!
You can also use this to manage UNO's connected via Bluetooth or Wifi adapters.
In this example "RPINTS" is the host name, and each UNO instance has its associated file sets (rooted under both /home/pi and /var/www) in unique folders.

Code:
Adding Fourth UNO R3 to RPINTS

Cloned /home/brewpi/brewpi3 to /home/brewpi/brewpi4
Changed /home/brewpi/brewpi4/settings/config.cfg

scriptPath = /home/brewpi/brewpi4/
wwwPath = /var/www/brewpi4/
port = /dev/brewpi4
altport = /dev/null
boardType = uno
beerName = BrewPi2%20Test%202
dataLogging = active

save and exit

Cloned /var/www/brewpi3 to /var/www/brewpi4
Changed /var/www/brewpi4/config_user.php 

$scriptPath = '/home/brewpi/brewpi4';

save and exit


Changed tag in /var/www/brewpi4/index.php:

        <title>BrewPi4 reporting for duty!</title>

Find UNO serial number

$ udevadm info -a -n /dev/ttyACM1 | less > info.log

  looking at parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2':
    KERNELS=="1-1.2"
        ATTRS{manufacturer}=="Arduino (www.arduino.cc)"
        ATTRS{serial}=="55431313238351104021"

Changed the rules file:

$ sudo nano /etc/udev/rules.d/99-arduino.rules

SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="85336303532351F0A031", SYMLINK+="brewpi1", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="754373038303510BF870", SYMLINK+="brewpi2", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="5543131323835130B160", SYMLINK+="brewpi3", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="55431313238351104021", SYMLINK+="brewpi4", GROUP="brewpi"


Reloaded the udev rules:

$ sudo /etc/init.d/udev reload

Restarted scripts successfully

Set up cron job to start the script for BrewPi4:

$ sudo nano /etc/cron.d/brewpi4

PYTHON=/usr/bin/python
SCRIPTPATH=/home/brewpi/brewpi4
MAILTO=""
* * * * * brewpi $PYTHON $SCRIPTPATH/brewpi.py --config $SCRIPTPATH/settings/config.cfg --checkstartuponly --dontrunfile; [ $? != 0 ] && $PYTHON -u $SCRIPTPATH/brewpi.py --config $SCRIPTPATH/settings/config.cfg 1>$SCRIPTPATH/logs/stdout.txt 2>>$SCRIPTPATH/logs/stderr.txt &

Save the file and exit

Restart CRON:

$ sudo /etc/init.d/cron restart

BrewPi4 is up and running on USB!

Cheers!
 
Please realize not just a simple matter of changing the mysql to MariaDB syntax.

For example mysql's mysql_close in MariaDB is mysql_close(mysql handle)

So in the Raspberry Pints code we'll need to find and replace the mysql_connect with MariaDB's mysql_real_connect or other equivalent code.

You are correct in that is just replacing MySQL_ with mysqli because you have to get the returned value from mysqli_connect and pass that to the new function calls.

But these changes are not caused by the switch MariaDB these changes are in PHP and even if true MySQL was still in stretch these changes would be needed to be compatible with PHP7
 
My bad, should be fixed now if you rerun the script, I just put the fix in GitHub

I was committing some new features (thanks to original work done by day_trippr) but I was piecing them in so they were in seperate check ins and made a mistake in the last sql one. Goes to show after you commit retest

Thank you! Worked a treat. Thanks again for all the work you guys have done on this.

Hopefully this isn't a stupid question... Once I get onto the RaspberryPints page through LocalHost, I can't seem to display any taps (even the sample taps). I've added Taps, Kegs and Beers to show the three beers I currently have on tap and will add conditioning etc eventually. Has anyone encountered a similar issue? I've run through all the FAQ's on the RaspberryPints website and believe the settings I have are configured correctly. Cheers.
 
Hopefully this isn't a stupid question... Once I get onto the RaspberryPints page through LocalHost, I can't seem to display any taps (even the sample taps). I've added Taps, Kegs and Beers to show the three beers I currently have on tap and will add conditioning etc eventually. Has anyone encountered a similar issue? I've run through all the FAQ's on the RaspberryPints website and believe the settings I have are configured correctly. Cheers.

Can you post some screenshots of your browser? Also the taps admin page.

Did you change any of the default settings in the configurations page?
 
You can manage this by using the /etc/udev/rules.d/99-arduino.rules file to hard-code each Arduino to a logical port.
Here's an example of adding a fourth UNO to a BrewPi host. Hopefully you'll find it explanatory but if you have any questions please ask!
You can also use this to manage UNO's connected via Bluetooth or Wifi adapters.
In this example "RPINTS" is the host name, and each UNO instance has its associated file sets (rooted under both /home/pi and /var/www) in unique folders.

Code:
Adding Fourth UNO R3 to RPINTS

Cloned /home/brewpi/brewpi3 to /home/brewpi/brewpi4
Changed /home/brewpi/brewpi4/settings/config.cfg

scriptPath = /home/brewpi/brewpi4/
wwwPath = /var/www/brewpi4/
port = /dev/brewpi4
altport = /dev/null
boardType = uno
beerName = BrewPi2%20Test%202
dataLogging = active

save and exit

Cloned /var/www/brewpi3 to /var/www/brewpi4
Changed /var/www/brewpi4/config_user.php

$scriptPath = '/home/brewpi/brewpi4';

save and exit


Changed tag in /var/www/brewpi4/index.php:

        <title>BrewPi4 reporting for duty!</title>

Find UNO serial number

$ udevadm info -a -n /dev/ttyACM1 | less > info.log

  looking at parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2':
    KERNELS=="1-1.2"
        ATTRS{manufacturer}=="Arduino (www.arduino.cc)"
        ATTRS{serial}=="55431313238351104021"

Changed the rules file:

$ sudo nano /etc/udev/rules.d/99-arduino.rules

SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="85336303532351F0A031", SYMLINK+="brewpi1", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="754373038303510BF870", SYMLINK+="brewpi2", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="5543131323835130B160", SYMLINK+="brewpi3", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="55431313238351104021", SYMLINK+="brewpi4", GROUP="brewpi"


Reloaded the udev rules:

$ sudo /etc/init.d/udev reload

Restarted scripts successfully

Set up cron job to start the script for BrewPi4:

$ sudo nano /etc/cron.d/brewpi4

PYTHON=/usr/bin/python
SCRIPTPATH=/home/brewpi/brewpi4
MAILTO=""
* * * * * brewpi $PYTHON $SCRIPTPATH/brewpi.py --config $SCRIPTPATH/settings/config.cfg --checkstartuponly --dontrunfile; [ $? != 0 ] && $PYTHON -u $SCRIPTPATH/brewpi.py --config $SCRIPTPATH/settings/config.cfg 1>$SCRIPTPATH/logs/stdout.txt 2>>$SCRIPTPATH/logs/stderr.txt &

Save the file and exit

Restart CRON:

$ sudo /etc/init.d/cron restart

BrewPi4 is up and running on USB!

Cheers!



So I have tried this as a guide and ignored some of the steps that didn't apply to me. Heres what I have done.

1. Got my aduino serial numbers.
2. made the udev rule in /etc/udev/rules.d/99-arduino.rules

my rule looks like
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="9543231313835141D060", SYMLINK+="brewpi", GROUP="pi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="557353238353518172C1", SYMLINK+="pints", GROUP="pi"

rebooted

3. edited brewpi config.cfg file to look like this

wwwPath = /var/www/html/brewpi
beerName = keggerator
dataLogging = paused
port = /dev/brewpi
altport = /dev/null
boardType = uno

also edited the pints flow monitor script to look at /dev/pints instead of ACM1

rebooted again

now my brewpi script wont start. clicking the start script button on the web interface does nothing it doesn't react at all. It gives me the cant read lcd text python script. Previously that button would react fine.
 
You can manage this by using the /etc/udev/rules.d/99-arduino.rules file to hard-code each Arduino to a logical port.
Here's an example of adding a fourth UNO to a BrewPi host. Hopefully you'll find it explanatory but if you have any questions please ask!
You can also use this to manage UNO's connected via Bluetooth or Wifi adapters.
In this example "RPINTS" is the host name, and each UNO instance has its associated file sets (rooted under both /home/pi and /var/www) in unique folders.

Code:
Adding Fourth UNO R3 to RPINTS

Cloned /home/brewpi/brewpi3 to /home/brewpi/brewpi4
Changed /home/brewpi/brewpi4/settings/config.cfg

scriptPath = /home/brewpi/brewpi4/
wwwPath = /var/www/brewpi4/
port = /dev/brewpi4
altport = /dev/null
boardType = uno
beerName = BrewPi2%20Test%202
dataLogging = active

save and exit

Cloned /var/www/brewpi3 to /var/www/brewpi4
Changed /var/www/brewpi4/config_user.php

$scriptPath = '/home/brewpi/brewpi4';

save and exit


Changed tag in /var/www/brewpi4/index.php:

        <title>BrewPi4 reporting for duty!</title>

Find UNO serial number

$ udevadm info -a -n /dev/ttyACM1 | less > info.log

  looking at parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.2':
    KERNELS=="1-1.2"
        ATTRS{manufacturer}=="Arduino (www.arduino.cc)"
        ATTRS{serial}=="55431313238351104021"

Changed the rules file:

$ sudo nano /etc/udev/rules.d/99-arduino.rules

SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="85336303532351F0A031", SYMLINK+="brewpi1", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="754373038303510BF870", SYMLINK+="brewpi2", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="5543131323835130B160", SYMLINK+="brewpi3", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*", ATTRS{serial}=="55431313238351104021", SYMLINK+="brewpi4", GROUP="brewpi"


Reloaded the udev rules:

$ sudo /etc/init.d/udev reload

Restarted scripts successfully

Set up cron job to start the script for BrewPi4:

$ sudo nano /etc/cron.d/brewpi4

PYTHON=/usr/bin/python
SCRIPTPATH=/home/brewpi/brewpi4
MAILTO=""
* * * * * brewpi $PYTHON $SCRIPTPATH/brewpi.py --config $SCRIPTPATH/settings/config.cfg --checkstartuponly --dontrunfile; [ $? != 0 ] && $PYTHON -u $SCRIPTPATH/brewpi.py --config $SCRIPTPATH/settings/config.cfg 1>$SCRIPTPATH/logs/stdout.txt 2>>$SCRIPTPATH/logs/stderr.txt &

Save the file and exit

Restart CRON:

$ sudo /etc/init.d/cron restart

BrewPi4 is up and running on USB!

Cheers!
Okay I may have spoke to soon but I think I found the actual problem... I didn't change the cron entry file like the example. I figured the example was doing that because of the needed fourth brewpi install needing a crone entry to start yet a fourth instance of the script.. if i run a kill then manually run the script the script starts up and works...
pi@raspberrypi:/home/brewpi $ sudo python brewpi.py --kill
Jan 05 2019 12:54:23 Killing all BrewPi Processes
pi@raspberrypi:/home/brewpi $ ./brewpi.py
Jan 05 2019 12:54:30 Opening serial port
Jan 05 2019 12:54:30 Notification: Script started for beer 'keggerator'
Jan 05 2019 12:54:40 Checking software version on controller...
Jan 05 2019 12:54:40 Found BrewPi v0.2.10 build unknown, running on an Arduino Uno with a revC shield on port /dev/brewpi

Jan 05 2019 12:54:41 {"BeerTemp":null,"BeerSet":null,"BeerAnn":null,"FridgeTemp": 67.77,"FridgeSet":null,"FridgeAnn":null,"RoomTemp": 70.02,"State":0}
Jan 05 2019 12:54:41 {"BeerTemp":null,"BeerSet":null,"BeerAnn":null,"FridgeTemp": 67.77,"FridgeSet":null,"FridgeAnn":null,"RoomTemp": 70.02,"State":0}
Jan 05 2019 12:56:42 {"BeerTemp":null,"BeerSet":null,"BeerAnn":null,"FridgeTemp": 67.77,"FridgeSet":null,"FridgeAnn":null,"RoomTemp": 70.02,"State":0}



My chron entry that was already there created automatically by brewpi was slightly different from the example.. I tried matching it more like the example and to no avail.... is there something maybe causing the cron job to try and start before the usb devices are assigned by the udev rule? If so any reason I cant create a systemd service for brewpi instead of the cron job?
 
You should only have to configure the BrewPi Arduino(s) to ports other than /dev/ttyACM0 and leave that port to the Uno running your flow meters (or, if using an Alamode for R'Pints, /dev/ttyS0). That's how I set up my main system with four BrewPi instances, only the BrewPi Arduinos get assigned to logical ports.

Cheers!

[edit] It's easily possible my cron entries for the BrewPi instances don't match the stock versions char by char, I've been playing around with all kinds of things over the years.
 
You should only have to configure the BrewPi Arduino(s) to ports other than /dev/ttyACM0 and leave that port to the Uno running your flow meters (or, if using an Alamode for R'Pints, /dev/ttyS0). That's how I set up my main system with four BrewPi instances, only the BrewPi Arduinos get assigned to logical ports.

Cheers!

[edit] It's easily possible my cron entries for the BrewPi instances don't match the stock versions char by char, I've been playing around with all kinds of things over the years.
Okay yeah that makes sense I can put the cron back the way it was. Is there any reason you can think of that making that trivial change is suddenly causing the brewpi script to not launch via cron successfully? Cause its obviously just not starting anymore since manually starting the script in a terminal window is successful
 
Back
Top