Decaf is the Mugsy JSON API. And at least for now, that stands for Does Every Coffee Action, Friend.
Current Requirements:
- Python 3
- MySQL
- Pip3
Install(instructions in progress):
- sudo pip3 install Flask
- sudo pip3 install Flask-RESTful
- sudo pip3 install Flask-MySQL
- sudo pip3 install simplejson
- mkdir /var/mugsy
- cd /var/mugsy
- git clone https://github.com/margyle/decaf.git
- import db/mugsy.sql into your mysql instance
- cd decaf
- touch decafConfig.py
- Edit decafConfig.py and add:
from flaskext.mysql import MySQL
mysql = MySQL()
dbuser = '************'
dbpass = '************'
dbdb = '************'
dbhost = '************'
Enter your mysql settings in place of asterisks
Access end point by pointing your browser or a curl request to:
http://192.168.1.183:5000/BrewSettings/1 http://192.168.1.183:5000/CoffeeInfo/2 etc...
dont forget to change the ip to your Pi's IP, or local host if your are browsing from the pi itself.
It currently requires 6 arguments:
- pinNumber
- relayChannel
- timeOn
- repeatValue
- repeatDelay
- connectedHardware
Example: http://192.168.1.183:5000/relayControl/23/1/2/2/4/grinder
This turns on pin 23 which is connected to relay channel 1 for 2 seconds, it repeats 2 times with a delay of 4 seconds between repeats and is connected to the grinder.
Access pinInfo by pointing your browser or a curl request to: http://192.168.1.183:5000/pinInfo/grinder
- Install Git and Docker CE
git clone https://github.com/margyle/decaf.git && cd decaf
- Edit config file as above.
dbhost = 'localhost'
,dbuser = 'root'
,dbpass = ''
,dbdb = 'mugsy'
docker build -t heymugsy .
docker run -it --rm -p 5000:5000 -v /var/lib/mysql heymugsy