flo269 GitHub 8 лет назад
Родитель
Сommit
8d7cf3fdd7
10 измененных файлов: 41 добавлений и 41 удалений
  1. +1
    -1
      README.md
  2. +10
    -10
      install.sh
  3. +15
    -15
      modules/base_plugins/brew_steps/__init__.py
  4. +2
    -2
      modules/base_plugins/gpio_actor/__init__.py
  5. +2
    -2
      modules/base_plugins/hysteresis/__init__.py
  6. +1
    -1
      modules/notification/__init__.py
  7. +3
    -3
      modules/recipe_import/beerxml.py
  8. +4
    -4
      modules/recipe_import/kbh.py
  9. +1
    -1
      modules/recipe_import/restapi.py
  10. +2
    -2
      modules/system/endpoints.py

+ 1
- 1
README.md Просмотреть файл

@@ -30,6 +30,6 @@ CraftBeerPi 3.0 is a complete rewrite. Server as well as user interface. I recom


## Donation ## Donation


CraftBeerPi is a free & open source project. If you like to support the project I happy about a donation:
CraftBeerPi is a free & open source project. If you would like to support the project I would be happy about a donation:


[![Donate](https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2X9KR98KJ8YZQ) [![Donate](https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2X9KR98KJ8YZQ)

+ 10
- 10
install.sh Просмотреть файл

@@ -29,12 +29,12 @@ show_menu () {
if [ $BUTTON -eq 0 ]; then if [ $BUTTON -eq 0 ]; then
case $OPTION in case $OPTION in
1) 1)
confirmAnswer "Would you like run apt-get update & apt-get upgrade?"
confirmAnswer "Would you like to run apt-get update & apt-get upgrade?"
if [ $? = 0 ]; then if [ $? = 0 ]; then
apt-get -y update; apt-get -y upgrade; apt-get -y update; apt-get -y upgrade;
fi fi


confirmAnswer "Would you like to install wiringPI? This is required to control the GPIO"
confirmAnswer "Would you like to install wiringPI? This is required to control the GPIO."
if [ $? = 0 ]; then if [ $? = 0 ]; then
git clone git://git.drogon.net/wiringPi; git clone git://git.drogon.net/wiringPi;
cd wiringPi; cd wiringPi;
@@ -48,7 +48,7 @@ show_menu () {
apt-get -y install libpcre3-dev apt-get -y install libpcre3-dev
pip install -r requirements.txt pip install -r requirements.txt


confirmAnswer "Would you like to add active 1-wire support at your Raspberry PI now? IMPORTANT: The 1-wire thermometer must be conneted to GPIO 4!"
confirmAnswer "Would you like to add active 1-wire support to your Raspberry PI now? IMPORTANT: The 1-wire thermometer must be conneted to GPIO 4!"
if [ $? = 0 ]; then if [ $? = 0 ]; then
#apt-get -y update; apt-get -y upgrade; #apt-get -y update; apt-get -y upgrade;
echo '# CraftBeerPi 1-wire support' >> "/boot/config.txt" echo '# CraftBeerPi 1-wire support' >> "/boot/config.txt"
@@ -65,7 +65,7 @@ show_menu () {
show_menu show_menu
;; ;;
2) 2)
confirmAnswer "Are you sure you want to clear the CraftBeerPi. All hardware setting will be deleted"
confirmAnswer "Are you sure you want to clear the CraftBeerPi? All hardware settings will be deleted."
if [ $? = 0 ]; then if [ $? = 0 ]; then
sudo rm -f craftbeerpi.db sudo rm -f craftbeerpi.db
whiptail --title "Database Delted" --msgbox "The CraftBeerPi database was succesfully deleted. You must hit OK to continue." 8 78 whiptail --title "Database Delted" --msgbox "The CraftBeerPi database was succesfully deleted. You must hit OK to continue." 8 78
@@ -75,19 +75,19 @@ show_menu () {
fi fi
;; ;;
3) 3)
confirmAnswer "Are you sure you want to add CraftBeerPi to autostart"
confirmAnswer "Are you sure you want to add CraftBeerPi to autostart?"
if [ $? = 0 ]; then if [ $? = 0 ]; then
sed "s@#DIR#@${PWD}@g" config/craftbeerpiboot > /etc/init.d/craftbeerpiboot sed "s@#DIR#@${PWD}@g" config/craftbeerpiboot > /etc/init.d/craftbeerpiboot
chmod 755 /etc/init.d/craftbeerpiboot; chmod 755 /etc/init.d/craftbeerpiboot;
update-rc.d craftbeerpiboot defaults; update-rc.d craftbeerpiboot defaults;
whiptail --title "Added succesfull to autostart" --msgbox "The CraftBeerPi was added to autostart succesfully. You must hit OK to continue." 8 78
whiptail --title "Succesfull add to autostart" --msgbox "CraftBeerPi was added to autostart succesfully. You must hit OK to continue." 8 78
show_menu show_menu
else else
show_menu show_menu
fi fi
;; ;;
4) 4)
confirmAnswer "Are you sure you want to remove CraftBeerPi from autostart"
confirmAnswer "Are you sure you want to remove CraftBeerPi from autostart?"
if [ $? = 0 ]; then if [ $? = 0 ]; then
update-rc.d -f craftbeerpiboot remove update-rc.d -f craftbeerpiboot remove
show_menu show_menu
@@ -103,7 +103,7 @@ show_menu () {
;; ;;
6) 6)
sudo /etc/init.d/craftbeerpiboot stop sudo /etc/init.d/craftbeerpiboot stop
whiptail --title "CraftBeerPi stoped" --msgbox "The software is stoped" 8 78
whiptail --title "CraftBeerPi stopped" --msgbox "The software is stopped." 8 78
show_menu show_menu
;; ;;
7) 7)
@@ -126,10 +126,10 @@ show_menu () {
fi fi
;; ;;
9) 9)
confirmAnswer "Are you sure you want to delete all CraftBeerPi log files"
confirmAnswer "Are you sure you want to delete all CraftBeerPi log files?"
if [ $? = 0 ]; then if [ $? = 0 ]; then
sudo rm -rf logs/*.log sudo rm -rf logs/*.log
whiptail --title "Log files deleted" --msgbox "All CraftBeerPi Files are deleted. You must hit OK to continue." 8 78
whiptail --title "Log files deleted" --msgbox "All CraftBeerPi files are deleted. You must hit OK to continue." 8 78
show_menu show_menu
else else
show_menu show_menu


+ 15
- 15
modules/base_plugins/brew_steps/__init__.py Просмотреть файл

@@ -14,9 +14,9 @@ class MashStep(StepBase):
Just put the decorator @cbpi.step on top of a method Just put the decorator @cbpi.step on top of a method
''' '''
# Properties # Properties
temp = Property.Number("Temperature", configurable=True, description="Target Temperature of Mash Step")
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the mashing takes place")
timer = Property.Number("Timer in Minutes", configurable=True, description="Timer is started when the target temperature is reached")
temp = Property.Number("Temperature", configurable=True, description="Target temperature of mash step.")
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the mashing takes place.")
timer = Property.Number("Timer in Minutes", configurable=True, description="Timer is started when the target temperature is reached.")


def init(self): def init(self):
''' '''
@@ -67,8 +67,8 @@ class MashInStep(StepBase):
Just put the decorator @cbpi.step on top of a method Just put the decorator @cbpi.step on top of a method
''' '''
# Properties # Properties
temp = Property.Number("Temperature", configurable=True, description="Target Temperature of Mash Step")
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the mashing takes place")
temp = Property.Number("Temperature", configurable=True, description="Target temperature of mash step.")
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the mashing takes place.")
s = False s = False


@cbpi.action("Change Power") @cbpi.action("Change Power")
@@ -95,14 +95,14 @@ class MashInStep(StepBase):
# Check if Target Temp is reached # Check if Target Temp is reached
if self.get_kettle_temp(self.kettle) >= float(self.temp) and self.s is False: if self.get_kettle_temp(self.kettle) >= float(self.temp) and self.s is False:
self.s = True self.s = True
self.notify("Step Temp Reached!", "Please press the next button to continue", timeout=None)
self.notify("Step temperature reached!", "Please press the next button to continue.", timeout=None)






@cbpi.step @cbpi.step
class ChilStep(StepBase): class ChilStep(StepBase):


timer = Property.Number("Timer in Minutes", configurable=True, default_value=0, description="Timer is started immediately")
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0, description="Timer is started immediately.")


@cbpi.action("Stat Timer") @cbpi.action("Stat Timer")
def start(self): def start(self):
@@ -126,8 +126,8 @@ class ChilStep(StepBase):
@cbpi.step @cbpi.step
class PumpStep(StepBase): class PumpStep(StepBase):


pump = StepProperty.Actor("Pump", description="Pump actor gets toogled")
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0, description="Timer is started immediately")
pump = StepProperty.Actor("Pump", description="Pump actor gets toggled.")
timer = Property.Number("Timer in Minutes", configurable=True, default_value=0, description="Timer is started immediately.")


@cbpi.action("Stat Timer") @cbpi.action("Stat Timer")
def start(self): def start(self):
@@ -157,15 +157,15 @@ class BoilStep(StepBase):
Just put the decorator @cbpi.step on top of a method Just put the decorator @cbpi.step on top of a method
''' '''
# Properties # Properties
temp = Property.Number("Temperature", configurable=True, default_value=100, description="Target temperature for boiling")
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the boiling step takes place")
timer = Property.Number("Timer in Minutes", configurable=True, default_value=90, description="Timer is started when target temperature is reached")
hop_1 = Property.Number("Hop 1 Addition", configurable=True, description="Fist Hop alert")
temp = Property.Number("Temperature", configurable=True, default_value=100, description="Target temperature for boiling.")
kettle = StepProperty.Kettle("Kettle", description="Kettle in which the boiling step takes place.")
timer = Property.Number("Timer in Minutes", configurable=True, default_value=90, description="Timer is started when target temperature is reached.")
hop_1 = Property.Number("Hop 1 Addition", configurable=True, description="First hop alert.")
hop_1_added = Property.Number("",default_value=None) hop_1_added = Property.Number("",default_value=None)
hop_2 = Property.Number("Hop 2 Addition", configurable=True, description="Second Hop alert")
hop_2 = Property.Number("Hop 2 Addition", configurable=True, description="Second hop alert.")
hop_2_added = Property.Number("", default_value=None) hop_2_added = Property.Number("", default_value=None)
hop_3 = Property.Number("Hop 3 Addition", configurable=True) hop_3 = Property.Number("Hop 3 Addition", configurable=True)
hop_3_added = Property.Number("", default_value=None, description="Second Hop alert")
hop_3_added = Property.Number("", default_value=None, description="Third hop alert.")


def init(self): def init(self):
''' '''


+ 2
- 2
modules/base_plugins/gpio_actor/__init__.py Просмотреть файл

@@ -18,7 +18,7 @@ except Exception as e:
@cbpi.actor @cbpi.actor
class GPIOSimple(ActorBase): class GPIOSimple(ActorBase):


gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27], description="GPIO to which the actor is connected")
gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27], description="GPIO to which the actor is connected.")


def init(self): def init(self):
GPIO.setup(int(self.gpio), GPIO.OUT) GPIO.setup(int(self.gpio), GPIO.OUT)
@@ -35,7 +35,7 @@ class GPIOSimple(ActorBase):
@cbpi.actor @cbpi.actor
class GPIOPWM(ActorBase): class GPIOPWM(ActorBase):


gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27], description="GPIO to which the actor is connected")
gpio = Property.Select("GPIO", options=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27], description="GPIO to which the actor is connected.")
duty_cylce = Property.Number("Duty Cycle", configurable=True) duty_cylce = Property.Number("Duty Cycle", configurable=True)


p = None p = None


+ 2
- 2
modules/base_plugins/hysteresis/__init__.py Просмотреть файл

@@ -8,8 +8,8 @@ class Hysteresis(KettleController):


# Custom Properties # Custom Properties


on = Property.Number("Offset On", True, 0, description="Offset below target temp when heater should switched on. Should be bigger then Offset Off")
off = Property.Number("Offset Off", True, 0, description="Offset below target temp when heater should switched off. Should be smaller then Offset Off")
on = Property.Number("Offset On", True, 0, description="Offset below target temp when heater should be switched on. Should be bigger then Offset Off")
off = Property.Number("Offset Off", True, 0, description="Offset below target temp when heater should be switched off. Should be smaller then Offset Off")


def stop(self): def stop(self):
''' '''


+ 1
- 1
modules/notification/__init__.py Просмотреть файл

@@ -44,7 +44,7 @@ def init(cbpi):
:return: None :return: None
""" """
if cbpi.get_config_parameter("donation_notification", "YES") == "YES": if cbpi.get_config_parameter("donation_notification", "YES") == "YES":
msg = {"id": len(cbpi.cache["messages"]), "type": "info", "headline": "Support CraftBeerPi with your donation", "message": "You will find the PayPay Donation button in the system menu" , "read": False}
msg = {"id": len(cbpi.cache["messages"]), "type": "info", "headline": "Support CraftBeerPi with your donation", "message": "You will find the PayPal Donation button in the system menu." , "read": False}
cbpi.cache["messages"].append(msg) cbpi.cache["messages"].append(msg)


NotificationView.register(cbpi.app, route_base='/api/notification') NotificationView.register(cbpi.app, route_base='/api/notification')

+ 3
- 3
modules/recipe_import/beerxml.py Просмотреть файл

@@ -15,7 +15,7 @@ class BeerXMLImport(FlaskView):
@route('/', methods=['GET']) @route('/', methods=['GET'])
def get(self): def get(self):
if not os.path.exists(self.BEER_XML_FILE): if not os.path.exists(self.BEER_XML_FILE):
self.api.notify(headline="File Not Found", message="Please upload a Beer.xml File",
self.api.notify(headline="File Not Found", message="Please upload a beer.xml file.",
type="danger") type="danger")
return ('', 404) return ('', 404)
result = [] result = []
@@ -36,11 +36,11 @@ class BeerXMLImport(FlaskView):
file = request.files['file'] file = request.files['file']
if file and self.allowed_file(file.filename): if file and self.allowed_file(file.filename):
file.save(os.path.join(self.api.app.config['UPLOAD_FOLDER'], "beer.xml")) file.save(os.path.join(self.api.app.config['UPLOAD_FOLDER'], "beer.xml"))
self.api.notify(headline="Upload Successful", message="The Beer XML file was uploaded succesfully")
self.api.notify(headline="Upload Successful", message="The beer.xml file was succesfully uploaded.")
return ('', 204) return ('', 204)
return ('', 404) return ('', 404)
except Exception as e: except Exception as e:
self.api.notify(headline="Upload Failed", message="Failed to upload Beer xml", type="danger")
self.api.notify(headline="Upload Failed", message="Failed to upload beer.xml file.", type="danger")
return ('', 500) return ('', 500)


@route('/<int:id>', methods=['POST']) @route('/<int:id>', methods=['POST'])


+ 4
- 4
modules/recipe_import/kbh.py Просмотреть файл

@@ -17,7 +17,7 @@ class KBH(FlaskView):
conn = None conn = None
try: try:
if not os.path.exists(self.api.app.config['UPLOAD_FOLDER'] + '/kbh.db'): if not os.path.exists(self.api.app.config['UPLOAD_FOLDER'] + '/kbh.db'):
self.api.notify(headline="File Not Found", message="Please upload a Kleiner Brauhelfer Database", type="danger")
self.api.notify(headline="File Not Found", message="Please upload a Kleiner Brauhelfer database.", type="danger")
return ('', 404) return ('', 404)


conn = sqlite3.connect(self.api.app.config['UPLOAD_FOLDER'] + '/kbh.db') conn = sqlite3.connect(self.api.app.config['UPLOAD_FOLDER'] + '/kbh.db')
@@ -30,7 +30,7 @@ class KBH(FlaskView):
return json.dumps(result) return json.dumps(result)
except Exception as e: except Exception as e:
print e print e
self.api.notify(headline="Failed to load KHB database", message="ERROR", type="danger")
self.api.notify(headline="Failed to load Kleiner Brauhelfer database.", message="ERROR", type="danger")
return ('', 500) return ('', 500)
finally: finally:
if conn: if conn:
@@ -47,11 +47,11 @@ class KBH(FlaskView):
if file and self.allowed_file(file.filename): if file and self.allowed_file(file.filename):
filename = secure_filename(file.filename) filename = secure_filename(file.filename)
file.save(os.path.join(self.api.app.config['UPLOAD_FOLDER'], "kbh.db")) file.save(os.path.join(self.api.app.config['UPLOAD_FOLDER'], "kbh.db"))
self.api.notify(headline="Upload Successful", message="The Kleiner Brauhelfer Database was uploaded succesfully")
self.api.notify(headline="Upload Successful", message="The Kleiner Brauhelfer database was succesfully uploaded.")
return ('', 204) return ('', 204)
return ('', 404) return ('', 404)
except Exception as e: except Exception as e:
self.api.notify(headline="Upload Failed", message="Failed to upload Kleiner Brauhelfer", type="danger")
self.api.notify(headline="Upload Failed", message="Failed to upload Kleiner Brauhelfer database.", type="danger")


return ('', 500) return ('', 500)




+ 1
- 1
modules/recipe_import/restapi.py Просмотреть файл

@@ -49,7 +49,7 @@ class RESTImport(FlaskView):
self.api.emit("UPDATE_ALL_STEPS", Step.get_all()) self.api.emit("UPDATE_ALL_STEPS", Step.get_all())
self.api.notify(headline="Recipe %s loaded successfully" % name, message="") self.api.notify(headline="Recipe %s loaded successfully" % name, message="")
except Exception as e: except Exception as e:
self.api.notify(headline="Failed to load Recipe", type="danger", message=str(e))
self.api.notify(headline="Failed to load recipe", type="danger", message=str(e))
m = str(e.message) m = str(e.message)
return (str(e), 500) return (str(e), 500)




+ 2
- 2
modules/system/endpoints.py Просмотреть файл

@@ -48,7 +48,7 @@ class SystemView(FlaskView):
o.fetch() o.fetch()
g = Git('./') g = Git('./')
g.checkout(name) g.checkout(name)
cbpi.notify("Checkout successful", "Please restart the system")
cbpi.notify("Checkout successful.", "Please restart the system.")
return ('', 204) return ('', 204)
@route('/git/status', methods=['GET']) @route('/git/status', methods=['GET'])
@@ -95,7 +95,7 @@ class SystemView(FlaskView):
repo = Repo('./') repo = Repo('./')
o = repo.remotes.origin o = repo.remotes.origin
info = o.pull() info = o.pull()
cbpi.notify("Pull successful", "The lasted updated was downloaded. Please restart the system")
cbpi.notify("Pull successful", "The lastet update was downloaded. Please restart the system.")
return ('', 204) return ('', 204)
@route('/dump', methods=['GET']) @route('/dump', methods=['GET'])


Загрузка…
Отмена
Сохранить