Mercurial > templog
comparison py/fridge.py @ 254:ffe25107d520
put more things inside "try"
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 08 Jun 2015 22:31:21 +0800 |
parents | 19569cb5ed46 |
children | 26eee8591f61 |
comparison
equal
deleted
inserted
replaced
243:d9b819dcac53 | 254:ffe25107d520 |
---|---|
33 @asyncio.coroutine | 33 @asyncio.coroutine |
34 def run(self): | 34 def run(self): |
35 if self.server.params.disabled: | 35 if self.server.params.disabled: |
36 L("Fridge is disabled") | 36 L("Fridge is disabled") |
37 while True: | 37 while True: |
38 self.do() | |
39 try: | 38 try: |
39 self.do() | |
40 yield from self.server.sleep(config.FRIDGE_SLEEP) | 40 yield from self.server.sleep(config.FRIDGE_SLEEP) |
41 except Exception as e: | 41 except Exception as e: |
42 EX("fridge failed") | 42 EX("fridge failed") |
43 | 43 |
44 def do(self): | 44 def do(self): |
109 self.off() | 109 self.off() |
110 | 110 |
111 else: | 111 else: |
112 # fridge is off | 112 # fridge is off |
113 turn_on = False | 113 turn_on = False |
114 D("fridge %(fridge)f max %(fridge_max)f wort %(wort)f wort_max %(wort_max)f" % locals()) | 114 D("fridge %(fridge)s max %(fridge_max)s wort %(wort)s wort_max %(wort_max)s" % locals()) |
115 if not params.nowort \ | 115 if not params.nowort \ |
116 and wort is not None \ | 116 and wort is not None \ |
117 and wort >= wort_max: | 117 and wort >= wort_max: |
118 L("Wort is too hot %f, max %f" % (wort, wort_max)) | 118 L("Wort is too hot %f, max %f" % (wort, wort_max)) |
119 turn_on = True | 119 turn_on = True |