def get(self): con.row_factory = lite.Row cur = con.cursor() cur.execute("SELECT * FROM recipes") row = cur.fetchone() self.render( "index.html", page_title = "SmartCooker | Home", header_text = "Velkommen til SmartCooker", sub_header = "Dit smarte mad valg", footer_text = "Her kunne man evt. have noget footer tekst", recipe_name = row["Name"], setpoint_grill = row["Grill Target"], setpoint_food = row["Food Target"], cooking_time = row["Cooking Time"], email_alert = "ON", simulation = "ON", grill_temp = sensors.grill_temperature(), pit_temp = sensors.pit_temperature(), elapsed_time = 35, remaining_time = 355 )
__author__ = 'munchp' from twisted.internet import task from twisted.internet import reactor from sensors import sensors from database import db_handler timeout = 60.0 # Sixty seconds pit_temp = sensors.pit_temperature() grill_temp = sensors.grill_temperature() def log_temp(): print "Logging Pit Temperature as: %f" % pit_temp print "Logging Grill Temperature as: %f" % grill_temp db_handler.db_insert_pit(pit_temp) db_handler.db_insert_grill(grill_temp) pass def run(): l = task.LoopingCall(log_temp) l.start(timeout) # call every sixty seconds reactor.run()