50 Commits
Author SHA1 Message Date
Manuel83andGitHub 2b095c8c77 Update install.sh
WiringPi Removed
2019-08-20 21:17:46 +02:00
Manuel83andGitHub 63f9f5468b Update __init__.py 2019-08-08 21:29:01 +02:00
Manuel83andGitHub 16ad8daf44 Change Target Temp for Fermentation to 50
Change Target Temp for Fermentation to 50
2019-06-18 22:21:28 +02:00
Manuel83andGitHub 67a103d1f3 Update schema.sql 2019-05-18 10:09:31 +02:00
Manuel83andGitHub 274f282e11 Update __init__.py 2019-05-18 10:08:32 +02:00
manuel83 4e432e05bd pyyaml update 2019-02-07 21:24:31 +01:00
Manuel83 eda209422f Update package because of vulnerability
Flask:
CVE-2018-1000656 More information
moderate severity
Vulnerable versions: < 0.12.3
Patched version: 0.12.3
The Pallets Project flask version Before 0.12.3 contains a CWE-20:
Improper Input Validation vulnerability in flask that can result in
Large amount of memory usage possibly leading to denial of service.
This attack appear to be exploitable via Attacker provides JSON data in
incorrect encoding. This vulnerability appears to have been fixed in
0.12.3.

Requests:
CVE-2018-18074 More information
moderate severity
Vulnerable versions: <= 2.19.1
Patched version: 2.20.0
The Requests package through 2.19.1 before 2018-09-14 for Python sends
an HTTP Authorization header to an http URI upon receiving a
same-hostname https-to-http redirect, which makes it easier for remote
attackers to discover credentials by sniffing the network.
2018-10-29 22:15:03 +01:00
Manuel83andGitHub 5b47b94833 Merge pull request #213 from cgspeck/fix-typo
Fix typo in README
2018-09-04 06:32:32 +02:00
Manuel83andGitHub 98409d9895 Merge pull request #206 from swimIan/swimIan-patch-1
Remove "Steps started on xml imported" bug
2018-09-04 06:32:15 +02:00
Chris Speck 433b1c30f1 Fix typo which resulted in reference to incorrect port 2018-08-15 22:47:36 +10:00
Manuel83andGitHub a477cb83a8 Merge pull request #211 from cgspeck/docker-dev-env
Docker files for ease of development on PCs/macs
2018-08-15 07:00:19 +02:00
Chris Speck a22dcba77c Docker files for ease of development on PCs/macs 2018-08-13 23:13:13 +10:00
swimIanandGitHub c1d94a8f61 Remove "Steps started on xml imported" bug 2018-08-03 09:12:45 -07:00
swimIanandGitHub dd64f4ee16 Merge pull request #16 from Manuel83/master
August 2 update
2018-08-03 08:40:43 -07:00
Manuel83andGitHub 1414b1ed3b Merge pull request #166 from DrRataplan/master
Import hop alerts from BeerXML
2018-08-02 12:54:14 +02:00
Manuel83andGitHub acd404622b Merge pull request #182 from archonic/patch-1
Remove duplicate line
2018-05-23 10:19:17 +02:00
Manuel83andGitHub d657077570 Merge pull request #181 from clearwaterbrewer/patch-1
Fix hysteresis turning off heater
2018-05-23 10:18:41 +02:00
JoshandGitHub 0e6da89cfd Remove duplicate line 2018-04-05 08:53:19 -07:00
clearwaterbrewerandGitHub faa2b9d32c Update __init__.py
removed lines 37 and 38 to make hysteresis work properly.
2018-04-05 10:49:35 -04:00
Martin 83699f1933 Import boil time alerts from BeerXML
By reading the HOP and MISC elements, the 'please add your hop' alerts may be imported.
2018-01-07 11:45:15 +00:00
swimIanandGitHub fea3e85053 Merge pull request #15 from Manuel83/master
Update swimIan master
2017-11-15 09:31:46 -08:00
Manuel83andGitHub 5efa1df350 Merge pull request #133 from JamFfm/JamFfm-install
Added a combinaton of stop-del logfiles-start
2017-11-08 19:45:08 +01:00
Manuel83andGitHub dd5b5f456a Merge pull request #151 from mb-tec/master
Buzzer Beep Level
2017-11-08 19:44:32 +01:00
Matthias e0e3aff929 Buzzer Beep Level 2017-10-28 22:08:30 +02:00
Manuel83andGitHub 2a02979e37 Merge pull request #142 from Manuel83/revert-105-patch2
Revert "Updates the boilstep and beerxml recipe import"
2017-10-15 14:48:45 +02:00
Manuel83andGitHub a1740074ac Revert "Updates the boilstep and beerxml recipe import" 2017-10-15 14:48:24 +02:00
swimIanandGitHub 1b3042a082 Merge pull request #13 from Manuel83/master
Update
2017-10-14 07:55:06 -07:00
Manuel83andGitHub b279dcf347 Merge pull request #105 from swimIan/patch2
Updates the boilstep and beerxml recipe import
2017-10-13 21:56:17 +02:00
JamFfmandGitHub 211edc1bbc Added a combinaton of stop-del logfiles-start
This one makes it easier to test plugins.
2017-10-01 14:11:52 +02:00
swimIanandGitHub b56c10a8a5 Merge branch 'master' into patch2 2017-09-29 13:43:51 -07:00
swimIan 8d2c5c916a Updated again 2017-09-29 13:40:55 -07:00
swimIan d637c08eba update to reflect changes in the master branch 2017-09-29 13:12:03 -07:00
swimIanandGitHub 0447621895 Merge pull request #10 from Manuel83/master
Most recent
2017-09-28 21:44:17 -07:00
Manuel83andGitHub 03395647ed Merge pull request #130 from bertah/master
GPIOPWM: Fixed misleading label and support decimal frequencies
2017-09-25 13:22:46 +02:00
bertah 65833b1249 GPIOPWM: Fixed misleading label "duty cycle" to "frequency", and handle decimal frequency values. Tested working with Rpi.GPIO 2017-09-23 10:03:48 -04:00
Manuel83andGitHub 25ace8024c Merge pull request #127 from mrillies/patch-1
Add reset to post put call (Fermenter update)
2017-09-22 13:55:10 +02:00
Manuel83 820061cf09 - Two new hop steps added. Now you can set 5 hop alerts 2017-09-22 13:52:00 +02:00
mrilliesandGitHub c1c5faa1f3 Add reset to post put call (Fermenter update)
Added a call to reset the fermenter after an update.

Reset builds step parameter with FerementerStep objects from database.
Reset all clears current ferment steps - this may be positive or negative
2017-09-22 21:41:19 +10:00
Manuel83andGitHub 837b906af1 Merge pull request #126 from mrillies/patch-1
Fix Fermentor Heater power
2017-09-20 23:41:43 +02:00
mrilliesandGitHub 0f42153591 Update controller.py
Fix for issue #125: Missing 'power' in call to actor_on had heater id number set as power
2017-09-21 02:14:56 +10:00
swimIan 5fc5684e56 update boilstep and reorder steps in beerxml recipe import 2017-09-09 10:51:37 -07:00
swimIanandGitHub dc908268dd Merge pull request #9 from swimIan/master
update 9/6/17
2017-09-06 06:10:43 -07:00
swimIanandGitHub 14e4e6d61a Merge pull request #8 from Manuel83/master
Update 9/6/17
2017-09-06 06:08:22 -07:00
swimIan ae7e3a2e7b Adjust check_hop_timer function to alert the user to add the hops at the expected values in the boil process (ex. 60= bittering, 20=aroma, etc), instead of the reverse (ex. 0=bittering, 40=aroma, etc). 2017-08-08 23:36:18 -07:00
swimIan 3eee952a04 Add mashinstep, import mashin temp(infuse_temp) from beerxml, and put boil step ahead of whirlpool and chill steps. 2017-08-08 22:48:23 -07:00
swimIanandGitHub 88b360a8d7 Merge pull request #7 from Manuel83/master
- Add On - Link to Plugin Website
2017-07-29 07:13:20 -07:00
swimIanandGitHub 3761713219 Merge pull request #6 from swimIan/patch2
Merge pull request #5 from swimIan/master
2017-07-22 07:55:19 -07:00
swimIanandGitHub a96c678dd9 Merge pull request #5 from swimIan/master
Update
2017-07-22 07:53:16 -07:00
swimIanandGitHub e7765a2c4c Merge pull request #4 from Manuel83/master
Update
2017-07-22 07:51:27 -07:00
swimIanandGitHub 74b56937e7 Merge pull request #3 from Manuel83/master
Update
2017-07-18 21:43:34 -07:00
15 changed files with 134 additions and 36 deletions
+14
View File
@@ -0,0 +1,14 @@
# Dockerfile for development on a pc/mac
FROM python:2
EXPOSE 5000
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "run.py"]
+15
View File
@@ -28,6 +28,21 @@ http://web.craftbeerpi.com/hardware/
CraftBeerPi 3.0 is a complete rewrite. Server as well as user interface. I recommend to use a second SD card for testing. CraftBeerPi 3.0 is a complete rewrite. Server as well as user interface. I recommend to use a second SD card for testing.
## Docker-based development
For developing this application or its plugins on a PC/Mac you can use the docker-compose file:
``` shell
$ docker-compose up
...
Starting craftbeerpi3_app_1 ... done
Attaching to craftbeerpi3_app_1
app_1 | [2018-08-13 12:54:44,264] ERROR in __init__: BUZZER not working
app_1 | (1) wsgi starting up on http://0.0.0.0:5000
```
The contents of this folder will be mounted to `/usr/src/craftbeerpi3` and the server will be accesible on `localhost:5000`.
## 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 like to support the project I happy about a donation:
+2 -1
View File
@@ -84,7 +84,8 @@ INSERT OR IGNORE INTO config VALUES ('actor_cols', 4, 'select', 'Adjust the widt
INSERT OR IGNORE INTO config VALUES ('sensor_cols', 4, 'select', 'Adjust the width of a sensor widget on the brewing dashboard', '[1,2,3, 4, 5, 6, 7, 8, 9, 10, 11, 12]'); INSERT OR IGNORE INTO config VALUES ('sensor_cols', 4, 'select', 'Adjust the width of a sensor widget on the brewing dashboard', '[1,2,3, 4, 5, 6, 7, 8, 9, 10, 11, 12]');
INSERT OR IGNORE INTO config VALUES ('unit', 'C', 'select', 'Temperature Unit', '["C","F"]'); INSERT OR IGNORE INTO config VALUES ('unit', 'C', 'select', 'Temperature Unit', '["C","F"]');
INSERT OR IGNORE INTO config VALUES ('brewery_name', 'My Home Brewery', 'text', 'Your brewery name', NULL ); INSERT OR IGNORE INTO config VALUES ('brewery_name', 'My Home Brewery', 'text', 'Your brewery name', NULL );
INSERT OR IGNORE INTO config VALUES ('buzzer', 16, 'select', 'Buzzer GPIO', '[16,17,18,19,20]'); INSERT OR IGNORE INTO config VALUES ('buzzer', 16, 'select', 'Buzzer GPIO', '[16,17,18,19,20,21,22,23]');
INSERT OR IGNORE INTO config VALUES ('buzzer_beep_level', 'HIGH', 'select', 'Buzzer Logic Beep Level', '["HIGH", "LOW"]');
INSERT OR IGNORE INTO config VALUES ('setup', 'YES', 'select', 'Show the Setup dialog', '["YES","NO"]'); INSERT OR IGNORE INTO config VALUES ('setup', 'YES', 'select', 'Show the Setup dialog', '["YES","NO"]');
INSERT OR IGNORE INTO config VALUES ('brew_name', '', 'text', 'Brew Name', NULL); INSERT OR IGNORE INTO config VALUES ('brew_name', '', 'text', 'Brew Name', NULL);
INSERT OR IGNORE INTO config VALUES ('donation_notification', 'YES', 'select', 'Disable Donation Notification', '["YES","NO"]'); INSERT OR IGNORE INTO config VALUES ('donation_notification', 'YES', 'select', 'Disable Donation Notification', '["YES","NO"]');
+9
View File
@@ -0,0 +1,9 @@
# docker-compose file for development on a pc/mac
version: '3.3'
services:
app:
build: .
ports:
- 5000:5000
volumes:
- $PWD:/usr/src/app
+13 -9
View File
@@ -19,7 +19,8 @@ show_menu () {
"7" "Software Update (git pull)" \ "7" "Software Update (git pull)" \
"8" "Reset File Changes (git reset --hard)" \ "8" "Reset File Changes (git reset --hard)" \
"9" "Clear all logs" \ "9" "Clear all logs" \
"10" "Reboot Raspberry Pi" 3>&1 1>&2 2>&3) "10" "Reboot Raspberry Pi" \
"11" "Stop CraftBeerPi, Clear logs, Start CraftBeerPi" 3>&1 1>&2 2>&3)
BUTTON=$? BUTTON=$?
# Exit if user pressed cancel or escape # Exit if user pressed cancel or escape
@@ -34,14 +35,6 @@ show_menu () {
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"
if [ $? = 0 ]; then
git clone git://git.drogon.net/wiringPi;
cd wiringPi;
./build; cd ..;
rm -rf wiringPi;
fi
apt-get -y install python-setuptools apt-get -y install python-setuptools
easy_install pip easy_install pip
apt-get -y install python-dev apt-get -y install python-dev
@@ -143,6 +136,17 @@ show_menu () {
show_menu show_menu
fi fi
;; ;;
11)
confirmAnswer "Are you sure you want to reboot CraftBeerPi and delete all log files?"
if [ $? = 0 ]; then
sudo /etc/init.d/craftbeerpiboot stop
sudo rm -rf logs/*.log
sudo /etc/init.d/craftbeerpiboot start
show_menu
else
show_menu
fi
;;
esac esac
fi fi
} }
+7 -1
View File
@@ -165,7 +165,11 @@ class BoilStep(StepBase):
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")
hop_4 = Property.Number("Hop 4 Addition", configurable=True)
hop_4_added = Property.Number("", default_value=None, description="Fourth Hop alert")
hop_5 = Property.Number("Hop 5 Addition", configurable=True)
hop_5_added = Property.Number("", default_value=None, description="Fives Hop alert")
def init(self): def init(self):
''' '''
@@ -217,6 +221,8 @@ class BoilStep(StepBase):
self.check_hop_timer(1, self.hop_1) self.check_hop_timer(1, self.hop_1)
self.check_hop_timer(2, self.hop_2) self.check_hop_timer(2, self.hop_2)
self.check_hop_timer(3, self.hop_3) self.check_hop_timer(3, self.hop_3)
self.check_hop_timer(4, self.hop_4)
self.check_hop_timer(5, self.hop_5)
# Check if timer finished and go to next step # Check if timer finished and go to next step
if self.is_timer_finished() == True: if self.is_timer_finished() == True:
self.notify("Boil Step Completed!", "Starting the next step", timeout=None) self.notify("Boil Step Completed!", "Starting the next step", timeout=None)
+5 -5
View File
@@ -36,10 +36,10 @@ class GPIOSimple(ActorBase):
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) frequency = Property.Number("Frequency (Hz)", configurable=True)
p = None p = None
power = 100 power = 100 # duty cycle
def init(self): def init(self):
GPIO.setup(int(self.gpio), GPIO.OUT) GPIO.setup(int(self.gpio), GPIO.OUT)
@@ -50,10 +50,10 @@ class GPIOPWM(ActorBase):
if power is not None: if power is not None:
self.power = int(power) self.power = int(power)
if self.duty_cylce is None: if self.frequency is None:
duty_cylce = 50 self.frequency = 0.5 # 2 sec
self.p = GPIO.PWM(int(self.gpio), int(self.duty_cylce)) self.p = GPIO.PWM(int(self.gpio), float(self.frequency))
self.p.start(int(self.power)) self.p.start(int(self.power))
def set_power(self, power): def set_power(self, power):
@@ -34,7 +34,5 @@ class Hysteresis(KettleController):
self.heater_on(100) self.heater_on(100)
elif self.get_temp() >= self.get_target_temp() - float(self.off): elif self.get_temp() >= self.get_target_temp() - float(self.off):
self.heater_off() self.heater_off()
else:
self.heater_off()
self.sleep(1) self.sleep(1)
+12 -5
View File
@@ -10,10 +10,11 @@ except Exception as e:
class Buzzer(object): class Buzzer(object):
sound = ["H", 0.1, "L", 0.1, "H", 0.1, "L", 0.1, "H", 0.1, "L"] sound = ["H", 0.1, "L", 0.1, "H", 0.1, "L", 0.1, "H", 0.1, "L"]
def __init__(self, gpio): def __init__(self, gpio, beep_level):
try: try:
cbpi.app.logger.info("INIT BUZZER NOW GPIO%s" % gpio) cbpi.app.logger.info("INIT BUZZER NOW GPIO%s" % gpio)
self.gpio = int(gpio) self.gpio = int(gpio)
self.beep_level = beep_level
GPIO.setmode(GPIO.BCM) GPIO.setmode(GPIO.BCM)
GPIO.setup(self.gpio, GPIO.OUT) GPIO.setup(self.gpio, GPIO.OUT)
self.state = True self.state = True
@@ -31,10 +32,14 @@ class Buzzer(object):
try: try:
for i in sound: for i in sound:
if (isinstance(i, str)): if (isinstance(i, str)):
if i == "H": if i == "H" and self.beep_level == "HIGH":
GPIO.output(int(self.gpio), GPIO.HIGH) GPIO.output(int(self.gpio), GPIO.HIGH)
else: elif i == "H" and self.beep_level != "HIGH":
GPIO.output(int(self.gpio), GPIO.LOW) GPIO.output(int(self.gpio), GPIO.LOW)
elif i == "L" and self.beep_level == "HIGH":
GPIO.output(int(self.gpio), GPIO.LOW)
else:
GPIO.output(int(self.gpio), GPIO.HIGH)
else: else:
time.sleep(i) time.sleep(i)
except Exception as e: except Exception as e:
@@ -44,7 +49,9 @@ class Buzzer(object):
@cbpi.initalizer(order=1) @cbpi.initalizer(order=1)
def init(cbpi): def init(cbpi):
gpio = cbpi.get_config_parameter("buzzer", 16) gpio = cbpi.get_config_parameter("buzzer", 22)
cbpi.buzzer = Buzzer(gpio) beep_level = cbpi.get_config_parameter("buzzer_beep_level", "HIGH")
cbpi.buzzer = Buzzer(gpio, beep_level)
cbpi.beep() cbpi.beep()
cbpi.app.logger.info("INIT OK") cbpi.app.logger.info("INIT OK")
+1 -1
View File
@@ -139,7 +139,7 @@ class FermenterController(ControllerBase, ActorController, SensorController):
def heater_on(self, power=100): def heater_on(self, power=100):
f = self.api.cache.get("fermenter").get(self.fermenter_id) f = self.api.cache.get("fermenter").get(self.fermenter_id)
if f.heater is not None: if f.heater is not None:
self.actor_on(int(f.heater)) self.actor_on(power, int(f.heater))
@cbpi.try_catch(None) @cbpi.try_catch(None)
def heater_off(self): def heater_off(self):
-1
View File
@@ -40,7 +40,6 @@ class ActorAPI(object):
value = self.cache.get("actors").get(int(id)) value = self.cache.get("actors").get(int(id))
cfg = value.config.copy() cfg = value.config.copy()
cfg.update(dict(api=self, id=id, name=value.name)) cfg.update(dict(api=self, id=id, name=value.name))
cfg.update(dict(api=self, id=id, name=value.name))
clazz = self.cache.get("actor_types").get(value.type).get("class") clazz = self.cache.get("actor_types").get(value.type).get("class")
value.instance = clazz(**cfg) value.instance = clazz(**cfg)
value.instance.init() value.instance.init()
+3
View File
@@ -77,6 +77,7 @@ class FermenterView(BaseView):
def _post_put_callback(self, m): def _post_put_callback(self, m):
m.state = False m.state = False
self.reset(int(m.id))
@route('/<int:id>/targettemp/<temp>', methods=['POST']) @route('/<int:id>/targettemp/<temp>', methods=['POST'])
def postTargetTemp(self, id, temp): def postTargetTemp(self, id, temp):
@@ -222,6 +223,8 @@ class FermenterView(BaseView):
def run(instance): def run(instance):
instance.run() instance.run()
fermenter.state = not fermenter.state
cbpi.emit("UPDATE_FERMENTER", cbpi.cache.get(self.cache_key).get(id))
t = cbpi.socketio.start_background_task(target=run, instance=instance) t = cbpi.socketio.start_background_task(target=run, instance=instance)
fermenter.state = not fermenter.state fermenter.state = not fermenter.state
+48 -6
View File
@@ -48,6 +48,7 @@ class BeerXMLImport(FlaskView):
steps = self.getSteps(id) steps = self.getSteps(id)
boil_time_alerts = self.getBoilAlerts(id)
name = self.getRecipeName(id) name = self.getRecipeName(id)
self.api.set_config_parameter("brew_name", name) self.api.set_config_parameter("brew_name", name)
boil_time = self.getBoilTime(id) boil_time = self.getBoilTime(id)
@@ -67,10 +68,29 @@ class BeerXMLImport(FlaskView):
for row in steps: for row in steps:
Step.insert(**{"name": row.get("name"), "type": mashstep_type, "config": {"kettle": mash_kettle, "temp": float(row.get("temp")), "timer": row.get("timer")}}) Step.insert(**{"name": row.get("name"), "type": mashstep_type, "config": {"kettle": mash_kettle, "temp": float(row.get("temp")), "timer": row.get("timer")}})
Step.insert(**{"name": "ChilStep", "type": "ChilStep", "config": {"timer": 15}}) Step.insert(**{"name": "ChilStep", "type": "ChilStep", "config": {"timer": 15}})
## Add cooking step ## Add boiling step
Step.insert(**{"name": "Boil", "type": boilstep_type, "config": {"kettle": boil_kettle, "temp": boil_temp, "timer": boil_time}}) Step.insert(**{
"name": "Boil",
"type": boilstep_type,
"config": {
"kettle": boil_kettle,
"temp": boil_temp,
"timer": boil_time,
## Beer XML defines additions as the total time spent in boiling,
## CBP defines it as time-until-alert
## Also, The model supports five boil-time additions.
## Set the rest to None to signal them being absent
"hop_1": boil_time - boil_time_alerts[0] if len(boil_time_alerts) >= 1 else None,
"hop_2": boil_time - boil_time_alerts[1] if len(boil_time_alerts) >= 2 else None,
"hop_3": boil_time - boil_time_alerts[2] if len(boil_time_alerts) >= 3 else None,
"hop_4": boil_time - boil_time_alerts[3] if len(boil_time_alerts) >= 4 else None,
"hop_5": boil_time - boil_time_alerts[4] if len(boil_time_alerts) >= 5 else None
}
})
## Add Whirlpool step ## Add Whirlpool step
Step.insert(**{"name": "Whirlpool", "type": "ChilStep", "config": {"timer": 15}}) Step.insert(**{"name": "Whirlpool", "type": "ChilStep", "config": {"timer": 15}})
StepView().reset()
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:
@@ -87,18 +107,40 @@ class BeerXMLImport(FlaskView):
e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot() e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot()
return float(e.find('./RECIPE[%s]/BOIL_TIME' % (str(id))).text) return float(e.find('./RECIPE[%s]/BOIL_TIME' % (str(id))).text)
def getBoilAlerts(self, id):
e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot()
recipe = e.find('./RECIPE[%s]' % (str(id)))
alerts = []
for e in recipe.findall('./HOPS/HOP'):
use = e.find('USE').text
## Hops which are not used in the boil step should not cause alerts
if use != 'Aroma' and use != 'Boil':
continue
alerts.append(float(e.find('TIME').text))
## There might also be miscelaneous additions during boild time
for e in recipe.findall('MISCS/MISC[USE="Boil"]'):
alerts.append(float(e.find('TIME').text))
## Dedupe and order the additions by their time, to prevent multiple alerts at the same time
alerts = sorted(list(set(alerts)))
## CBP should have these additions in reverse
alerts.reverse()
return alerts
def getSteps(self, id): def getSteps(self, id):
e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot() e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot()
steps = [] steps = []
for e in e.findall('./RECIPE[%s]/MASH/MASH_STEPS/MASH_STEP' % (str(id))): for e in e.findall('./RECIPE[%s]/MASH/MASH_STEPS/MASH_STEP' % (str(id))):
if self.api.get_config_parameter("unit", "C") == "C": if self.api.get_config_parameter("unit", "C") == "C":
temp = float(e.find("STEP_TEMP").text) temp = float(e.find("STEP_TEMP").text)
else: else:
temp = round(9.0 / 5.0 * float(e.find("STEP_TEMP").text) + 32, 2) temp = round(9.0 / 5.0 * float(e.find("STEP_TEMP").text) + 32, 2)
steps.append({"name": e.find("NAME").text, "temp": temp, "timer": float(e.find("STEP_TIME").text)}) steps.append({"name": e.find("NAME").text, "temp": temp, "timer": float(e.find("STEP_TIME").text)})
return steps return steps
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -1,4 +1,4 @@
Flask==0.11.1 Flask==0.12.4
Flask-SocketIO==2.6.2 Flask-SocketIO==2.6.2
eventlet==0.19.0 eventlet==0.19.0
greenlet==0.4.10 greenlet==0.4.10
@@ -6,9 +6,9 @@ python-dateutil==2.5.3
python-engineio==0.9.2 python-engineio==0.9.2
python-mimeparse==1.5.2 python-mimeparse==1.5.2
python-socketio==1.4.4 python-socketio==1.4.4
PyYAML==3.11 PyYAML==4.2b1
requests==2.11.0 requests==2.20.0
Werkzeug==0.11.10 Werkzeug==0.11.10
httplib2==0.9.2 httplib2==0.9.2
flask-classy==0.6.10 flask-classy==0.6.10
GitPython==2.1.3 GitPython==2.1.3