def debug(): mySensorIDs = p.getSensorIDs() temp1 = p.readTemps(mySensorIDs) timeStamp = '{0:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()) data = {'id1': mySensorIDs[0], 't1': temp1, 'ts': timeStamp} return render_template('debug.html', data=data)
def index(): if 'username' in session: mySensorIDs = p.getSensorIDs() temps = p.readTemps(mySensorIDs) timeStamp = '{0:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()) data = { 'temps': temps, 'ts': timeStamp, 'user': escape(session['username']) } return render_template('index.html', data=data) else: return redirect(url_for('login'))
def debug(): uptime1 = p.uptime() uptime_new = round(uptime1, 2) temp1, temp2 = p.readTemps(mySensorIDs, c.TEMPUNIT) cpu1 = p.cpu() sensorIDs = p.getSensorIDs() mode, status, booststart = p.getStatus() hours = p.getSchedule() target = p.getTarget() target2 = p.getTarget2() target3 = p.getTarget3() target4 = p.getTarget4() target5 = p.getTarget5() target6 = p.getTarget6() timeStamp = '{0:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()) if mode == "boost": boostremain = 900 + booststart - time.time() else: boostremain = 0 data = { 'id1': sensorIDs[0], 'id2': sensorIDs[1], 't1': temp1, 't2': temp2, 'cu': cpu1, 'tu': c.TEMPUNIT, 'pm': mode, 'ps': status, 'hrs': hours, 'tar': target, 'ta2': target2, 'ta3': target3, 'ta4': target4, 'ta5': target5, 'ta6': target6, 'up': uptime_new, 'ts': timeStamp, 'bt': booststart, 'br': boostremain } return render_template('debug.html', data=data)
level=logging.WARNING) logging.info('Main start') # Check current saved status and create pickle files # if they don't already exist p.checkStatus() p.checkSchedule() p.checkTarget() p.checkTarget2() p.checkTarget3() p.checkTarget4() p.checkTarget5() p.checkTarget6() # Get the IDs of the DS18B20 temp sensors mySensorIDs = p.getSensorIDs() # Set number of seconds to wait between loops loopDelay = c.LOOPDELAY # Set number of loops to wait before updating relay loopSendData = c.LOOPSENDDATA loopCounter = 0 if __name__ == '__main__': while True: # Read temperatures in C or F and send to # Emoncms every 1 loops temp1, temp2 = p.readTemps(mySensorIDs, c.TEMPUNIT)