From 3eee952a04272655cc7d7be56e97e1c824856aab Mon Sep 17 00:00:00 2001 From: swimIan Date: Tue, 8 Aug 2017 22:48:23 -0700 Subject: [PATCH 1/8] Add mashinstep, import mashin temp(infuse_temp) from beerxml, and put boil step ahead of whirlpool and chill steps. --- modules/recipe_import/beerxml.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/recipe_import/beerxml.py b/modules/recipe_import/beerxml.py index e9f17e0..91335d4 100644 --- a/modules/recipe_import/beerxml.py +++ b/modules/recipe_import/beerxml.py @@ -51,6 +51,8 @@ class BeerXMLImport(FlaskView): name = self.getRecipeName(id) self.api.set_config_parameter("brew_name", name) boil_time = self.getBoilTime(id) + infuse = self.getMashinTemp(id) + mashinstep_type = cbpi.get_config_parameter("step_mashin", "MashInStep") mashstep_type = cbpi.get_config_parameter("step_mash", "MashStep") mash_kettle = cbpi.get_config_parameter("step_mash_kettle", None) @@ -64,6 +66,8 @@ class BeerXMLImport(FlaskView): try: + ## Add Mashin step + Step.insert(**{"name": "MashIn", "type": mashinstep_type, "config": {"kettle": mash_kettle, "temp": infuse}}) 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": "ChilStep", "type": "ChilStep", "config": {"timer": 15}}) @@ -87,6 +91,14 @@ class BeerXMLImport(FlaskView): e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot() return float(e.find('./RECIPE[%s]/BOIL_TIME' % (str(id))).text) +def getMashinTemp(self, id): + e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot() + tempstr = e.find('./RECIPE[%s]/MASH/MASH_STEPS/MASH_STEP/INFUSE_TEMP' % (str(id))).text + val = tempstr[:-1] + infuse = float(val.rstrip()) + + return infuse + def getSteps(self, id): From ae7e3a2e7b13cdc753b12e9535b2c33458f12f79 Mon Sep 17 00:00:00 2001 From: swimIan Date: Tue, 8 Aug 2017 23:36:18 -0700 Subject: [PATCH 2/8] 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). --- modules/base_plugins/brew_steps/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/base_plugins/brew_steps/__init__.py b/modules/base_plugins/brew_steps/__init__.py index f46da69..8dcd82f 100644 --- a/modules/base_plugins/brew_steps/__init__.py +++ b/modules/base_plugins/brew_steps/__init__.py @@ -198,8 +198,8 @@ class BoilStep(StepBase): def check_hop_timer(self, number, value): - if self.__getattribute__("hop_%s_added" % number) is not True and time.time() > ( - self.timer_end - (int(self.timer) * 60 - int(value) * 60)): + if self.__getattribute__("hop_%s_added" % number) is not True and (int(value) * 60) == ( + self.timer_end - int(time.time())): self.__setattr__("hop_%s_added" % number, True) self.notify("Hop Alert", "Please add Hop %s" % number, timeout=None) From 5fc5684e5624781c837fb665e68804b81d43fd89 Mon Sep 17 00:00:00 2001 From: swimIan Date: Sat, 9 Sep 2017 10:51:37 -0700 Subject: [PATCH 3/8] update boilstep and reorder steps in beerxml recipe import --- modules/base_plugins/brew_steps/__init__.py | 13 ++++++++++++- modules/recipe_import/beerxml.py | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/base_plugins/brew_steps/__init__.py b/modules/base_plugins/brew_steps/__init__.py index 8dcd82f..fb7c2b6 100644 --- a/modules/base_plugins/brew_steps/__init__.py +++ b/modules/base_plugins/brew_steps/__init__.py @@ -165,7 +165,9 @@ class BoilStep(StepBase): hop_2 = Property.Number("Hop 2 Addition", configurable=True, description="Second Hop alert") hop_2_added = Property.Number("", default_value=None) 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") + fining = Property.Number("Fining Addition", configurable=True, default_value=15) + fining_added = Property.Number("",default_value=None, description="Fining Agent Alert") def init(self): ''' @@ -203,6 +205,13 @@ class BoilStep(StepBase): self.__setattr__("hop_%s_added" % number, True) self.notify("Hop Alert", "Please add Hop %s" % number, timeout=None) + def check_fining_timer(self, value): + + if self.__getattribute__("fining_added") is not True and (int(value) * 60) == ( + self.timer_end - int(time.time())): + self.__setattr__("fining_added", True) + self.notify("Fining Alert", "Please add fining agent", timeout=None) + def execute(self): ''' This method is execute in an interval @@ -212,11 +221,13 @@ class BoilStep(StepBase): if self.get_kettle_temp(self.kettle) >= float(self.temp): # Check if Timer is Running if self.is_timer_finished() is None: + self.notify("Boil Temp Reached", "Starting the boil timer") self.start_timer(int(self.timer) * 60) else: self.check_hop_timer(1, self.hop_1) self.check_hop_timer(2, self.hop_2) self.check_hop_timer(3, self.hop_3) + self.check_fining_timer(self.fining) # Check if timer finished and go to next step if self.is_timer_finished() == True: self.notify("Boil Step Completed!", "Starting the next step", timeout=None) diff --git a/modules/recipe_import/beerxml.py b/modules/recipe_import/beerxml.py index 91335d4..8883cb3 100644 --- a/modules/recipe_import/beerxml.py +++ b/modules/recipe_import/beerxml.py @@ -70,9 +70,9 @@ class BeerXMLImport(FlaskView): Step.insert(**{"name": "MashIn", "type": mashinstep_type, "config": {"kettle": mash_kettle, "temp": infuse}}) 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": "ChilStep", "type": "ChilStep", "config": {"timer": 15}}) ## Add cooking step Step.insert(**{"name": "Boil", "type": boilstep_type, "config": {"kettle": boil_kettle, "temp": boil_temp, "timer": boil_time}}) + Step.insert(**{"name": "ChilStep", "type": "ChilStep", "config": {"timer": 15}}) ## Add Whirlpool step Step.insert(**{"name": "Whirlpool", "type": "ChilStep", "config": {"timer": 15}}) self.api.emit("UPDATE_ALL_STEPS", Step.get_all()) From d637c08eba91d67be08666aab38693225db71e89 Mon Sep 17 00:00:00 2001 From: swimIan Date: Fri, 29 Sep 2017 13:12:03 -0700 Subject: [PATCH 4/8] update to reflect changes in the master branch --- modules/base_plugins/brew_steps/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/base_plugins/brew_steps/__init__.py b/modules/base_plugins/brew_steps/__init__.py index fb7c2b6..d674817 100644 --- a/modules/base_plugins/brew_steps/__init__.py +++ b/modules/base_plugins/brew_steps/__init__.py @@ -166,6 +166,10 @@ class BoilStep(StepBase): hop_2_added = Property.Number("", default_value=None) hop_3 = Property.Number("Hop 3 Addition", configurable=True) 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="Fifth Hop alert") fining = Property.Number("Fining Addition", configurable=True, default_value=15) fining_added = Property.Number("",default_value=None, description="Fining Agent Alert") @@ -227,6 +231,8 @@ class BoilStep(StepBase): self.check_hop_timer(1, self.hop_1) self.check_hop_timer(2, self.hop_2) self.check_hop_timer(3, self.hop_3) + self.check_hop_timer(4, self.hop_4) + self.check_hop_timer(5, self.hop_5) self.check_fining_timer(self.fining) # Check if timer finished and go to next step if self.is_timer_finished() == True: From 8d2c5c916a16ce5f16c7c1c384e367b9cace3a0c Mon Sep 17 00:00:00 2001 From: swimIan Date: Fri, 29 Sep 2017 13:40:55 -0700 Subject: [PATCH 5/8] Updated again --- modules/base_plugins/brew_steps/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/base_plugins/brew_steps/__init__.py b/modules/base_plugins/brew_steps/__init__.py index d674817..d534746 100644 --- a/modules/base_plugins/brew_steps/__init__.py +++ b/modules/base_plugins/brew_steps/__init__.py @@ -160,16 +160,16 @@ class BoilStep(StepBase): 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") + hop_1 = Property.Number("Hop 1 Addition", configurable=True, description="First Hop alert") hop_1_added = Property.Number("",default_value=None) hop_2 = Property.Number("Hop 2 Addition", configurable=True, description="Second Hop alert") hop_2_added = Property.Number("", default_value=None) - hop_3 = Property.Number("Hop 3 Addition", configurable=True) - 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="Fifth Hop alert") + hop_3 = Property.Number("Hop 3 Addition", configurable=True, description="Third Hop alert") + hop_3_added = Property.Number("", default_value=None) + hop_4 = Property.Number("Hop 4 Addition", configurable=True, description="Fourth Hop alert") + hop_4_added = Property.Number("", default_value=None) + hop_5 = Property.Number("Hop 5 Addition", configurable=True, description="Fifth Hop alert") + hop_5_added = Property.Number("", default_value=None) fining = Property.Number("Fining Addition", configurable=True, default_value=15) fining_added = Property.Number("",default_value=None, description="Fining Agent Alert") From 211edc1bbc0f53bc337d53519eb5ed5399aae5e9 Mon Sep 17 00:00:00 2001 From: JamFfm Date: Sun, 1 Oct 2017 14:11:52 +0200 Subject: [PATCH 6/8] Added a combinaton of stop-del logfiles-start This one makes it easier to test plugins. --- install.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index d9f7d22..82193cb 100755 --- a/install.sh +++ b/install.sh @@ -19,7 +19,8 @@ show_menu () { "7" "Software Update (git pull)" \ "8" "Reset File Changes (git reset --hard)" \ "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=$? # Exit if user pressed cancel or escape @@ -136,13 +137,24 @@ show_menu () { fi ;; 10) - confirmAnswer "Are you sure you want to reboo the Raspberry Pi?" + confirmAnswer "Are you sure you want to reboot the Raspberry Pi?" if [ $? = 0 ]; then sudo reboot else show_menu 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 fi } From a1740074acadba2b788c68ac151fe890d592591a Mon Sep 17 00:00:00 2001 From: Manuel83 Date: Sun, 15 Oct 2017 14:48:24 +0200 Subject: [PATCH 7/8] Revert "Updates the boilstep and beerxml recipe import" --- modules/base_plugins/brew_steps/__init__.py | 30 +++++++-------------- modules/recipe_import/beerxml.py | 14 +--------- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/modules/base_plugins/brew_steps/__init__.py b/modules/base_plugins/brew_steps/__init__.py index b0eb86f..16dd65b 100644 --- a/modules/base_plugins/brew_steps/__init__.py +++ b/modules/base_plugins/brew_steps/__init__.py @@ -160,18 +160,16 @@ class BoilStep(StepBase): 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 = Property.Number("Hop 1 Addition", configurable=True, description="Fist Hop alert") hop_1_added = Property.Number("",default_value=None) hop_2 = Property.Number("Hop 2 Addition", configurable=True, description="Second Hop alert") hop_2_added = Property.Number("", default_value=None) - hop_3 = Property.Number("Hop 3 Addition", configurable=True, description="Third Hop alert") - hop_3_added = Property.Number("", default_value=None) - hop_4 = Property.Number("Hop 4 Addition", configurable=True, description="Fourth Hop alert") - hop_4_added = Property.Number("", default_value=None) - hop_5 = Property.Number("Hop 5 Addition", configurable=True, description="Fifth Hop alert") - hop_5_added = Property.Number("", default_value=None) - fining = Property.Number("Fining Addition", configurable=True, default_value=15) - fining_added = Property.Number("",default_value=None, description="Fining Agent Alert") + hop_3 = Property.Number("Hop 3 Addition", configurable=True) + 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): ''' @@ -204,18 +202,11 @@ class BoilStep(StepBase): def check_hop_timer(self, number, value): - if self.__getattribute__("hop_%s_added" % number) is not True and (int(value) * 60) == ( - self.timer_end - int(time.time())): + if self.__getattribute__("hop_%s_added" % number) is not True and time.time() > ( + self.timer_end - (int(self.timer) * 60 - int(value) * 60)): self.__setattr__("hop_%s_added" % number, True) self.notify("Hop Alert", "Please add Hop %s" % number, timeout=None) - def check_fining_timer(self, value): - - if self.__getattribute__("fining_added") is not True and (int(value) * 60) == ( - self.timer_end - int(time.time())): - self.__setattr__("fining_added", True) - self.notify("Fining Alert", "Please add fining agent", timeout=None) - def execute(self): ''' This method is execute in an interval @@ -225,7 +216,6 @@ class BoilStep(StepBase): if self.get_kettle_temp(self.kettle) >= float(self.temp): # Check if Timer is Running if self.is_timer_finished() is None: - self.notify("Boil Temp Reached", "Starting the boil timer") self.start_timer(int(self.timer) * 60) else: self.check_hop_timer(1, self.hop_1) @@ -233,8 +223,6 @@ class BoilStep(StepBase): self.check_hop_timer(3, self.hop_3) self.check_hop_timer(4, self.hop_4) self.check_hop_timer(5, self.hop_5) - self.check_fining_timer(self.fining) - # Check if timer finished and go to next step if self.is_timer_finished() == True: self.notify("Boil Step Completed!", "Starting the next step", timeout=None) diff --git a/modules/recipe_import/beerxml.py b/modules/recipe_import/beerxml.py index 8883cb3..e9f17e0 100644 --- a/modules/recipe_import/beerxml.py +++ b/modules/recipe_import/beerxml.py @@ -51,8 +51,6 @@ class BeerXMLImport(FlaskView): name = self.getRecipeName(id) self.api.set_config_parameter("brew_name", name) boil_time = self.getBoilTime(id) - infuse = self.getMashinTemp(id) - mashinstep_type = cbpi.get_config_parameter("step_mashin", "MashInStep") mashstep_type = cbpi.get_config_parameter("step_mash", "MashStep") mash_kettle = cbpi.get_config_parameter("step_mash_kettle", None) @@ -66,13 +64,11 @@ class BeerXMLImport(FlaskView): try: - ## Add Mashin step - Step.insert(**{"name": "MashIn", "type": mashinstep_type, "config": {"kettle": mash_kettle, "temp": infuse}}) 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": "ChilStep", "type": "ChilStep", "config": {"timer": 15}}) ## Add cooking step Step.insert(**{"name": "Boil", "type": boilstep_type, "config": {"kettle": boil_kettle, "temp": boil_temp, "timer": boil_time}}) - Step.insert(**{"name": "ChilStep", "type": "ChilStep", "config": {"timer": 15}}) ## Add Whirlpool step Step.insert(**{"name": "Whirlpool", "type": "ChilStep", "config": {"timer": 15}}) self.api.emit("UPDATE_ALL_STEPS", Step.get_all()) @@ -91,14 +87,6 @@ class BeerXMLImport(FlaskView): e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot() return float(e.find('./RECIPE[%s]/BOIL_TIME' % (str(id))).text) -def getMashinTemp(self, id): - e = xml.etree.ElementTree.parse(self.BEER_XML_FILE).getroot() - tempstr = e.find('./RECIPE[%s]/MASH/MASH_STEPS/MASH_STEP/INFUSE_TEMP' % (str(id))).text - val = tempstr[:-1] - infuse = float(val.rstrip()) - - return infuse - def getSteps(self, id): From e0e3aff9299351c8cdb9d64a690e7c5db3d1aff3 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 28 Oct 2017 22:08:30 +0200 Subject: [PATCH 8/8] Buzzer Beep Level --- config/schema.sql | 1 + modules/buzzer/__init__.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/config/schema.sql b/config/schema.sql index ce62c26..f10ed2b 100644 --- a/config/schema.sql +++ b/config/schema.sql @@ -85,6 +85,7 @@ INSERT OR IGNORE INTO config VALUES ('sensor_cols', 4, 'select', 'Adjust the wid 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 ('buzzer', 16, 'select', 'Buzzer GPIO', '[16,17,18,19,20]'); +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 ('brew_name', '', 'text', 'Brew Name', NULL); INSERT OR IGNORE INTO config VALUES ('donation_notification', 'YES', 'select', 'Disable Donation Notification', '["YES","NO"]'); diff --git a/modules/buzzer/__init__.py b/modules/buzzer/__init__.py index 5120587..d0140a6 100644 --- a/modules/buzzer/__init__.py +++ b/modules/buzzer/__init__.py @@ -10,10 +10,11 @@ except Exception as e: class Buzzer(object): 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: cbpi.app.logger.info("INIT BUZZER NOW GPIO%s" % gpio) self.gpio = int(gpio) + self.beep_level = beep_level GPIO.setmode(GPIO.BCM) GPIO.setup(self.gpio, GPIO.OUT) self.state = True @@ -31,10 +32,14 @@ class Buzzer(object): try: for i in sound: if (isinstance(i, str)): - if i == "H": + if i == "H" and self.beep_level == "HIGH": GPIO.output(int(self.gpio), GPIO.HIGH) - else: + elif i == "H" and self.beep_level != "HIGH": + 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: time.sleep(i) except Exception as e: @@ -45,6 +50,8 @@ class Buzzer(object): @cbpi.initalizer(order=1) def init(cbpi): gpio = cbpi.get_config_parameter("buzzer", 16) - cbpi.buzzer = Buzzer(gpio) + beep_level = cbpi.get_config_parameter("buzzer_beep_level", "HIGH") + + cbpi.buzzer = Buzzer(gpio, beep_level) cbpi.beep() cbpi.app.logger.info("INIT OK")