Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
7e12d71
Added the start of the booze explorer
RichGibson Mar 7, 2016
46957f1
Added 'Explore Booze' which lets you look at what drinks can be made …
RichGibson Mar 8, 2016
776b2ab
Added 'Explore Booze' which lets a non-admin user look at the booze w…
RichGibson Mar 8, 2016
59951b0
minor wording change
RichGibson Mar 9, 2016
ae3bb5c
trending now has options to show drinks for a date range, and to show…
RichGibson Mar 10, 2016
70750b3
Trending drinks improvement for a first pass at issue 105. Shows the …
RichGibson Mar 10, 2016
fa727e0
Added the drink size underneath the list of ingredients. This is a du…
RichGibson Mar 10, 2016
396d92e
Merge branch 'trending_105'
RichGibson Mar 10, 2016
d35a7c1
remove call to deprected explore module
RichGibson Mar 11, 2016
9849ae7
Issue 58 - Save As New option. Select an existing drink, change the n…
RichGibson Mar 12, 2016
c7a9381
This commit fixes Issue #58 - Save As New option. Select an existing …
RichGibson Mar 12, 2016
bd45cbb
Merge branch 'save_as_new_58' of github.com:RichGibson/bartendro into…
RichGibson Mar 12, 2016
0978a5e
added a test endpoint 'snooze' and other minor changes
RichGibson Mar 18, 2019
ae2ddb1
start of controlling hello drinkbot
RichGibson Mar 25, 2019
e360b79
mostly wrapped sql in sqlalchemy text()
RichGibson Mar 25, 2019
4744810
merge code, and add inital use of adafruit library for motor control
RichGibson Mar 25, 2019
3568fac
added hello_drinkbot_driver which replaces RouterDriver
RichGibson Mar 26, 2019
7d42421
Merge branch 'hello_drinkbot' of github.com:RichGibson/bartendro into…
RichGibson Mar 26, 2019
9f3fc19
fix accidental delete of a line
RichGibson Mar 26, 2019
663c4a9
new driver in progress. correct pumps come on, but not yet for the co…
RichGibson Apr 8, 2019
0c6b1f5
Merge hello_drinkbot branch into master.
RichGibson Apr 8, 2019
3fcdbc9
added todos
RichGibson Apr 8, 2019
89f50e9
added commands to stop() so it should turn motors off
RichGibson Apr 8, 2019
4024a3c
converted from dispense ticks to dispense ml
RichGibson Apr 9, 2019
1bbfc60
tweaks to get it to run
RichGibson Apr 12, 2019
a81cea6
fixed number of pumps
RichGibson Apr 13, 2019
ae9497b
60/100 seconds per ml
RichGibson Apr 13, 2019
369e913
seconds per ml
RichGibson Apr 13, 2019
58abcf3
hopefully seconds per ml correct
RichGibson Apr 13, 2019
a367d09
fixed explore booze by adding text(), and work on getting stop to wor…
RichGibson Apr 13, 2019
0db8e07
Solved my port/dispenser/sibling mismatches. Now appears to dispense …
RichGibson Apr 22, 2019
a377ecf
removed a bartendro router specific error
RichGibson Apr 22, 2019
c3f089c
fixed 'trending' by adding 'text' wrapper around sql satements
RichGibson May 5, 2019
dc91d01
added graphic shots menu, with 'image' field in booze table. it point…
May 13, 2019
79ec506
add images for graphical view, start of adding edit of the graphical …
May 22, 2019
02e7847
includes first torani syrups, and images
May 22, 2019
261a2ea
fixed admin->debug by initializing the log. Also wrapped the adafruit…
RichGibson May 22, 2019
69a03ed
added api endpoints /booze/all and /booze/loaded. They return json wi…
RichGibson May 22, 2019
100fb0f
Added api endpoints for /drink/all and /drink/available
RichGibson May 22, 2019
1c225d5
added ws_make_drink/id?size= to the api options
RichGibson May 30, 2019
5ec7756
Modified files to fix active menu issue
JBG2018 Apr 1, 2021
77d4f4b
Merge pull request #1 from JBG2018/master
RichGibson Apr 2, 2021
7b2971e
Changed default database to include the drink image name
RichGibson Jul 8, 2022
bcdf849
Wrapped query('foo') calls in text. query(text('foo')) because SQLAlc…
RichGibson Jul 8, 2022
cd80bb0
Added hellodrinkbot quickstart instructions
RichGibson Jul 8, 2022
93e147d
fixed README
RichGibson Jul 8, 2022
d7dab3d
work on converting to python 3
RichGibson Jul 8, 2022
5e96637
debug code, delete soon
RichGibson Jul 26, 2022
40c7fd0
Lots of changes to get the code to run under Python 3. Also added doc…
RichGibson Jul 28, 2022
a3405ad
added doc string, and fixed a type.
RichGibson Jul 28, 2022
9ad331b
Added older dev notes to README_DEV.md
RichGibson Aug 13, 2022
658647c
Needed to make confusing changes to get bartendro to run. Some things…
RichGibson Aug 26, 2022
588ee5b
added ws_dispense_ml api endpoint
RichGibson Aug 26, 2022
9292bbd
the big change is that hello_drinkbot_driver is fixed so the pumps ar…
RichGibson Aug 26, 2022
ff42b30
Merging version that had the fixes to fix the dispenser numbering issue.
RichGibson Aug 26, 2022
fd542fc
ws_dispense_ml mostly works. There is an oddity when called from Ukra…
RichGibson Aug 26, 2022
eca1653
New ws/dispense api end point
RichGibson Aug 26, 2022
8eab950
Fixed bug in 'image' that I created.
RichGibson Aug 31, 2022
181b1b0
messing with start script
RichGibson Sep 16, 2022
645ed8d
I don't know why this wasn't already merged. Merge branch 'sept2_merge'
RichGibson Sep 16, 2022
dfddfe4
Removed ext style import
RichGibson Jun 27, 2024
69d213d
fixing flask.ext
RichGibson Jun 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
This is a forked version of the original Bartendro software which
supports the [Hello Drinkbot](https://www.facebook.com/groups/602734573508700) project

(the original hellodrinkbot.com domain was lost, and now appears to be a malware
distribution vector)

# Quickstart for Hello Drinkbot fork



- git clone https://github.com/RichGibson/bartendro.git
- cd bartendro/ui
- #this requires python 2.7, for now. If you use Conda this works:
- conda create --name py27 python=2.7
- conda activate py27
- pip install -r requirements.txt
- cp bartendro.db.default bartendro.db
- sh ./start_bartendro.sh

Got to http://http://127.0.0.1:8080/

----

Programs for the various systems of the Bartendro drink dispensing robot.

Created by Pierre Michael and Robert Kaye
Expand Down
3 changes: 1 addition & 2 deletions scripts/restartd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@
# Example:
#
# restartd ".*restartd" "/bin/echo 'It is not running!' >/tmp/restartd.out" "/bin/echo 'It is running!' >/tmp/restartd.out"
bartendro "bartendro_server\.py" "/home/robert/bartendro/scripts/start_bartendro.sh" "/bin/true"
user_button "user_button\.py" "/home/robert/bartendro/scripts/user_button.py &" "/bin/true"
bartendro "bartendro_server\.py" "/home/pi/start_bartendro.sh" "/bin/true"
4 changes: 1 addition & 3 deletions ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ the required tables for you to start playing with.
Configuration
-------------

You'll need to copy the config.py.default file to config.py . This will assume
the basic sane setting for your Bartendro configuration. These settings will be migrated
to the DB soon, so please take a look at the file to see what can be changed.
Configuration has been moved from a config.py file to the option table.

Starting
--------
Expand Down
211 changes: 211 additions & 0 deletions ui/README_DEV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
# Developer notes on hello drinkbot fork of bartendro

# July 2022

## A list of all of the routes

In bartender/

grep -r 'app.route' ui/*


ui/README_DEV.md:grep -r 'app.route' ui/*
ui/bartendro/view/booze.py:@app.route('/booze')
ui/bartendro/view/booze.py:@app.route('/booze/<int:id>')
ui/bartendro/view/booze.py:@app.route('/booze/all')
ui/bartendro/view/booze.py:@app.route('/booze/loaded')
ui/bartendro/view/trending.py:@app.route('/trending')
ui/bartendro/view/trending.py:@app.route('/trending/date/')
ui/bartendro/view/trending.py:@app.route('/trending/<int:hours>')
ui/bartendro/view/snooze.py:@app.route('/snooze')
ui/bartendro/view/admin/options.py:@app.route('/admin/options')
ui/bartendro/view/admin/options.py:@app.route('/admin/lost-passwd')
ui/bartendro/view/admin/options.py:@app.route('/admin/upload')
ui/bartendro/view/admin/dispenser.py:@app.route('/admin')
ui/bartendro/view/admin/dispenser.py:@app.route('/admin/save', methods=['POST'])
ui/bartendro/view/admin/user.py:@app.route("/admin/login", methods=["GET", "POST"])
ui/bartendro/view/admin/user.py:@app.route("/admin/logout")
ui/bartendro/view/admin/booze.py:@app.route('/admin/booze')
ui/bartendro/view/admin/booze.py:@app.route('/admin/booze/edit/<id>')
ui/bartendro/view/admin/booze.py:@app.route('/admin/booze/save', methods=['POST'])
ui/bartendro/view/admin/drink.py:@app.route('/admin/drink')
ui/bartendro/view/admin/debug.py:@app.route('/admin/debug')
ui/bartendro/view/admin/liquidlevel.py:@app.route('/admin/liquidlevel')
ui/bartendro/view/admin/report.py:@app.route('/admin/report')
ui/bartendro/view/admin/report.py:@app.route('/admin/report/<begin>/<end>')
ui/bartendro/view/root.py:@app.route('/')
ui/bartendro/view/root.py:@app.route('/shots')
ui/bartendro/view/root.py:@app.route('/graphical_shots')
ui/bartendro/view/drink/drink.py:@app.route('/drink/<int:id>')
ui/bartendro/view/drink/drink.py:@app.route('/drink/<int:id>/go')
ui/bartendro/view/drink/drink.py:@app.route('/drink/sobriety')
ui/bartendro/view/drink/drink.py:@app.route('/drink/all')
ui/bartendro/view/drink/drink.py:@app.route('/drink/available')
ui/bartendro/view/ws/dispenser.py:@app.route('/ws/dispenser/<int:disp>/on')
ui/bartendro/view/ws/dispenser.py:@app.route('/ws/dispenser/<int:disp>/on/reverse')
ui/bartendro/view/ws/dispenser.py:@app.route('/ws/dispenser/<int:disp>/off')
ui/bartendro/view/ws/dispenser.py:@app.route('/ws/dispenser/<int:disp>/test')
ui/bartendro/view/ws/dispenser.py:@app.route('/ws/clean')
ui/bartendro/view/ws/dispenser.py:@app.route('/ws/clean/right')
ui/bartendro/view/ws/dispenser.py:@app.route('/ws/clean/left')
ui/bartendro/view/ws/misc.py:@app.route('/ws/reset')
ui/bartendro/view/ws/misc.py:@app.route('/ws/test')
ui/bartendro/view/ws/misc.py:@app.route('/ws/checklevels')
ui/bartendro/view/ws/misc.py:@app.route('/ws/download/bartendro.db')
ui/bartendro/view/ws/option.py:@app.route('/ws/options', methods=["POST", "GET"])
ui/bartendro/view/ws/option.py:@app.route('/ws/upload', methods=["POST"])
ui/bartendro/view/ws/option.py:@app.route('/ws/upload/confirm', methods=["POST"])
ui/bartendro/view/ws/booze.py:@app.route('/ws/booze/match/<str>')
ui/bartendro/view/ws/drink.py:@app.route('/ws/drink/<int:drink>')
ui/bartendro/view/ws/drink.py:@app.route('/ws/drink/custom')
ui/bartendro/view/ws/drink.py:@app.route('/ws/drink/<int:drink>/available/<int:state>')
ui/bartendro/view/ws/drink.py:@app.route('/ws/shots/<int:booze_id>')
ui/bartendro/view/ws/drink.py:@app.route('/ws/drink/<int:id>/load')
ui/bartendro/view/ws/drink.py:@app.route('/ws/drink/<int:drink>/save', methods=["POST"])
ui/bartendro/view/ws/liquidlevel.py:@app.route('/ws/liquidlevel/test/<int:disp>')
ui/bartendro/view/ws/liquidlevel.py:@app.route('/ws/liquidlevel/out/<int:disp>/set')
ui/bartendro/view/ws/liquidlevel.py:@app.route('/ws/liquidlevel/low/<int:disp>/set')
ui/bartendro/view/ws/liquidlevel.py:@app.route('/ws/liquidlevel/out/all/set')
ui/bartendro/view/ws/liquidlevel.py:@app.route('/ws/liquidlevel/low/all/set')



# Bartendro software notes Mon Feb 11 15:49:36 PST 2019


Goal? It would be nice to be able to have features from the bartendro software.

Notes:
sqlite3 bartendro.db

see options, including password
select * from option;
username: bartendro
password (default): boozemeup

class Mixer in mixer.py is the point of it all..
'''The mixer object is the heart of Bartendro. This is where the state of the bot
is managed, checked if drinks can be made, and actually make drinks. Everything
else in Bartendro lives for *this* *code*. :) '''

bartendro
/Users/richgibson/wa/pistonbot/bartendro/ui

./bartendro_server.py --debug

To Add a view

in bartendro/ui/bartendro/view
cp booze.py snooze.py

in bartendro/ui/bartendro
edit __init__.py
from bartendro.view import snooze

edit
@app.route('/booze')
@login_required
def booze():

templates in
bartendro/ui/content/templates

cp booze snooze
edit snooze

http://127.0.0.1:8080/snooze

Yay! That worked.
Next: add an endpoint which talks to my pumps.

the bartendro has a restfulish api. yay.

/ws/drink/34?booze1=60&booze24=10&booze28=20&booze8=50
/ws/drink/[drink id]?booze[booze id]=[qty ml]&booze24=10&...

booze[booze.id]=[qty in ml]
booze1 = booze id=1, vodka
booze24 = booze id=24, triple sec

The quantity is in ml

I think I can hack my pumps in in ws/drink.py ws_make_drink()
rather than app.mixer.make_drink(drink, recipe)

from bartendro import app
from bartendro import mixer
from bartendro import db
from bartendro.model.drink import Drink
from bartendro.model.drink import DrinkName
drink = Drink.query.filter_by(id=1)[0]
drink
<Drink>(1,Sour Apple Martini,A fruity martini made with tart apple pucker and vodka. Stir or shake after it's dispensed.,<DrinkBooze>(1) <DrinkBooze>(2))>
# mixer object normally requires driver and mc - but in my hacked world...
# this almost works, for large values of 'almost'
mix=mixer.Mixer(None,None)


The question is: how much do I want to hack it?
- a custom app.mixer.py
- hack /ui/bartendro/view/ws/drink.py


app.mixer.dispense_shot
app.mixer.make_drink


--
- made hello_drinkbot branch on my git hub
- checked it out on pi
- to install dependencies
```pip install -r requirements.txt```
- to start bartendro
```./bartendro_server.py --debug```

(need to export :
export BARTENDRO_SOFTWARE_ONLY=1)

specify address
./bartendro_server.py --debug -t 10.1.10.214

now sqlalchemy.orm.exc.FlushError
but that is cool.

```./bartendro_server.py --debug -t 10.1.10.214```
...
I have the code runnnig on the pi except for that sql error.


Methods from bartendro/ui/bartendro/mixer.py
def _can_make_drink(self, boozes, booze_dict):
def _check_liquid_levels(self):
def _dispense_recipe(self, recipe, always_fast = False):
def _state_check(self):
def _state_current_sense(self):
def _state_error(self):
def _state_hard_out(self):
def _state_low(self):
def _state_out(self):
def _state_pour_done(self):
def _state_pouring(self):
def _state_pre_pour(self):
def _state_pre_shot(self):
def _state_ready(self):
def _state_test_dispense(self):
def check_levels(self):
def clean(self):
def clean_left(self):
def clean_right(self):
def dispense_ml(self, dispenser, ml):
def dispense_shot(self, dispenser, ml):
def do_event(self, event):
def get_available_drink_list(self):
def liquid_level_test(self, dispenser, threshold):
def make_drink(self, drink, recipe):
def reset(self):

It may be driver.py /Users/richgibson/wa/pistonbot/bartendro/ui/bartendro/router/driver.py
which we need to mess with.

select count(booze_id), name from drink_booze db, booze bz where booze_id=bz.id group by name order by name;

Binary file added ui/bartendro.db-2019-05-20
Binary file not shown.
Binary file modified ui/bartendro.db.default
Binary file not shown.
11 changes: 9 additions & 2 deletions ui/bartendro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import os
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager

from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager

#from flask.ext.sqlalchemy import SQLAlchemy
#from flask.ext.login import LoginManager
from sqlalchemy.orm import mapper, relationship, backref

SQLALCHEMY_DATABASE_FILE = 'bartendro.db'
Expand Down Expand Up @@ -31,6 +35,7 @@
from bartendro.model.drink_name import DrinkName
from bartendro.model.drink_booze import DrinkBooze


from bartendro.model.booze import Booze
from bartendro.model.booze_group import BoozeGroup
from bartendro.model.booze_group_booze import BoozeGroupBooze
Expand Down Expand Up @@ -61,6 +66,8 @@

# Import views
from bartendro.view import root, trending
from bartendro.view import booze
from bartendro.view import snooze
from bartendro.view.admin import booze as booze_admin, drink as drink_admin, \
dispenser as admin_dispenser, report, liquidlevel, user, options, debug
from bartendro.view.drink import drink
Expand Down
7 changes: 4 additions & 3 deletions ui/bartendro/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from threading import Thread
from bartendro import db, app
from bartendro.error import BartendroBrokenError
from bartendro.router.driver import MOTOR_DIRECTION_FORWARD
#from bartendro.router.driver import MOTOR_DIRECTION_FORWARD
from bartendro.router.hello_drinkbot_driver import MOTOR_DIRECTION_FORWARD

CLEAN_DURATION = 10 # seconds

Expand All @@ -31,7 +32,7 @@ def clean(self):
else:
disp_list.extend(self.left_set)
else:
for d in xrange(self.mixer.disp_count):
for d in range(self.mixer.disp_count):
disp_list.append(d)

self.mixer.driver.led_clean()
Expand All @@ -52,5 +53,5 @@ def clean(self):

try:
self.mixer.check_levels()
except BartendroBrokenError, msg:
except BartendroBrokenError as msg:
log.error("Post clean: %s" % msg)
9 changes: 6 additions & 3 deletions ui/bartendro/form/booze.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#!/usr/bin/env python
from wtforms import Form, TextField, DecimalField, HiddenField, validators, \
from wtforms import Form, StringField, DecimalField, HiddenField, validators, \
TextAreaField, SubmitField, SelectField
#from wtforms import Form, TextField, DecimalField, HiddenField, validators, \
# TextAreaField, SubmitField, SelectField
from bartendro.model import booze

class BoozeForm(Form):
id = HiddenField(u"id", default=0)
name = TextField(u"Name", [validators.Length(min=3, max=255)])
brand = TextField(u"Brand") # Currently unused
name = StringField(u"Name", [validators.Length(min=3, max=255)])
brand = StringField(u"Brand") # Currently unused
desc = TextAreaField(u"Description", [validators.Length(min=3, max=1024)])
abv = DecimalField(u"ABV", [validators.NumberRange(0, 97)], default=0, places=0)
type = SelectField(u"Type", [validators.NumberRange(0, len(booze.booze_types))],
choices=booze.booze_types,
coerce=int)
image = StringField(u"image") #
save = SubmitField(u"save")
cancel = SubmitField(u"cancel")

Expand Down
4 changes: 2 additions & 2 deletions ui/bartendro/form/login.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env python
from wtforms import Form, TextField, PasswordField, SubmitField, SelectField, validators
from wtforms import Form, StringField, PasswordField, SubmitField, SelectField, validators

class LoginForm(Form):
user = TextField(u"Name", [validators.Length(min=3, max=255)])
user = StringField(u"Name", [validators.Length(min=3, max=255)])
password = PasswordField(u"Password", [validators.Length(min=3, max=255)])

login = SubmitField(u"login")
Expand Down
7 changes: 4 additions & 3 deletions ui/bartendro/global_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ def get_state(self):
# If we're not running inside uwsgi, then we can't keep global state
if not have_uwsgi: return self.state

uwsgi.lock()
state = uwsgi.sharedarea_readbyte(1)
uwsgi.unlock()
# this gaves me an error under uwsgi, so comment it out.
#uwsgi.lock()
#state = uwsgi.sharedarea_readbyte(1)
#uwsgi.unlock()

return state

Expand Down
Loading