comparison py/tempserver.py @ 148:b32e5a11a4cb

few updates, seems to run
author Matt Johnston <matt@ucc.asn.au>
date Sat, 15 Dec 2012 23:49:08 +0800
parents 6517ddee3187
children d686b111dab4
comparison
equal deleted inserted replaced
147:ab1e7bf77d69 148:b32e5a11a4cb
1 #!/usr/bin/env python2.7 1 #!/home/matt/templog/venv/bin/python
2 2
3 import sys 3 import sys
4 import os 4 import os
5 import gevent 5 import gevent
6 import gevent.monkey 6 import gevent.monkey
37 37
38 def now(self): 38 def now(self):
39 return utils.monotonic_time() 39 return utils.monotonic_time()
40 40
41 def set_sensors(self, sensors): 41 def set_sensors(self, sensors):
42 if self.hasattr(self, 'sensors'): 42 if hasattr(self, 'sensors'):
43 self.sensors.kill() 43 self.sensors.kill()
44 self.sensors = sensors 44 self.sensors = sensors
45 self.wort_name = sensors.wort_name() 45 self.wort_name = sensors.wort_name()
46 self.fridge_name = sensors.fridge_name() 46 self.fridge_name = sensors.fridge_name()
47 47
62 self.current = (reading.get(self.wort_name, None), 62 self.current = (reading.get(self.wort_name, None),
63 reading.get(self.fridge_name, None)) 63 reading.get(self.fridge_name, None))
64 64
65 def current_temps(self): 65 def current_temps(self):
66 """ returns (wort_temp, fridge_temp) tuple """ 66 """ returns (wort_temp, fridge_temp) tuple """
67 return current 67 return self.current
68 68
69 def setup_logging(): 69 def setup_logging():
70 logging.basicConfig(format='%(asctime)s %(message)s', 70 logging.basicConfig(format='%(asctime)s %(message)s',
71 datefmt='%m/%d/%Y %I:%M:%S %p', 71 datefmt='%m/%d/%Y %I:%M:%S %p',
72 level=logging.INFO) 72 level=logging.INFO)