- added command line arguments for receipe and config file
- added receipe "sud_0010"

git-svn-id: http://moon:8086/svn/projects/HendiControl@282 fda53097-d464-4ada-af97-ba876c37ca34
This commit is contained in:
2019-05-03 18:22:28 +00:00
parent aaff3914cd
commit d3bdc4a550
2 changed files with 57 additions and 3 deletions
+17 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/python3
import argparse
import signal
import json
from controller import Controller, commands
@@ -49,6 +49,20 @@ def results_plot(self):
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Brew some beer.')
parser.add_argument('--receipe', help='the name of the receipe')
parser.add_argument('--config', help='the name of the configuration file')
args = parser.parse_args()
if args.receipe is None:
raise Exception("Invalid receipe")
config = "brewpi.json"
if args.config is not None:
config = args.config
stirr_isOn = False
def handler(signum, frame):
@@ -75,7 +89,7 @@ if __name__ == '__main__':
signal.signal(signal.SIGUSR1, handler)
signal.signal(signal.SIGHUP, handler)
fp = open("brewpi.json")
fp = open(config)
configJson = json.load(fp)
plant_class = globals()[configJson["Controller"]['plant_name']]
@@ -85,7 +99,7 @@ if __name__ == '__main__':
ablauf = Controller(configJson["Controller"], plant, ruehrer)
fp = open("Rezept-001.json")
fp = open(args.receipe)
recipeJson = json.load(fp)
ablauf.setRecipe(recipeJson)