##############
# brewcontrol uses 1-wire to pull temps from waterproof temperature probes
# connected to the gpio pins on a raspberry pi. It then communicates via a
# ftdi library to relays. ftdi is a serial protocol but my relay is
# connected via usb and emulates the serial device.
#
# temp probes can be found here: https://www.amazon.com/dp/B0C8J77NJR
# usb relay can found here: https://www.amazon.com/dp/B009A524Z0
##############

install -d -o www-data -g www-data -m 775 /usr/lib/cgi-bin/db/
cp brewcontrol /usr/lib/cgi-bin/
cp index.html brewcontrol.js favicon.ico /var/www/html/
echo "@reboot $HOME/brewcontrol/brewcontrol --daemon --stderr $HOME/out" | crontab -

# In recent versions my usb relay kept disconnecting.  I solved this by reloading the usb device in brewcontrol, but this is how to do it manually:
lsusb -t # verify Bus: Port: Port
echo 0 | sudo tee /sys/bus/usb/devices/1-1.5/power/autosuspend_delay_ms
echo auto | sudo tee /sys/bus/usb/devices/1-1.5/power/control
