def navigate(): current = request.form.get('here') location = request.form.get('location') if network.validSession() == True: pass else: return render_template('login.html',)
def piPower(): if network.validSession() == True: action = str(request.form.get('action')) confirmR = str(request.form.get('confirmRestart')) confirmSD = str(request.form.get('confirmShutDown')) if power.switch(action, confirmR, confirmSD) == True: return render_template('login.html',) else: return render_template('piControl.html',) else: return render_template('login.html',)
def saveSchedule(): times = {'mondayMorning': '', 'mondayEvening': '', 'mondayWeekend': '', 'tuesdayMorning': '', 'tuesdayEvening': '', 'tuesdayWeekend': '', 'wednesdayMorning': '', 'wednesdayEvening': '', 'wednesdayWeekend': '', 'thursdayMorning': '', 'thursdayEvening': '', 'thursdayWeekend': '', 'fridayMorning': '', 'fridayEvening': '', 'fridayWeekend': '', 'saturdayMorning': '', 'saturdayEvening': '', 'saturdayWeekend': '', 'sundayMorning': '', 'sundayEvening': '', 'sundayWeekend': ''} extra = {'morningLightLevel': '', 'eveningLightLevel': '', 'weekendLightLevel': ''} for key in times: times[key] = str(request.form[key]) for key in extra: extra[key] = str(request.form[key]) checkboxData = ast.literal_eval(str(request.form['checkboxSelection'])) if network.validSession() == True: schedule.setSchedule(times, extra, checkboxData) return jsonify()
def pauseSchedule(): if network.validSession() == True: schedule.pauseSchedule() return jsonify()
def applianceSwitch(): if network.validSession() == True: appliance = str(request.form['appliance']) confirm = str(request.form['confirm']) appliances.switch(appliance, confirm) return jsonify()
def heaterSwitch(heater): if network.validSession() == True: heating.switch(str(heater)) return jsonify()
def lightSwitch(light): if network.validSession() == True: lighting.switch(str(light)) return jsonify()
def powerRelay(): if network.validSession() == True: circuit = str(request.form['circuit']) confirm = str(request.form['confirm']) power.powerRelays(circuit, confirm) return jsonify()
def saveSettings(): backgroundColour = str(request.form['backgroundColour']) backgroundOpacity = str(round(float(str(request.form['backgroundOpacity']))/100, 2)) if network.validSession() == True: userControl.setStyle(backgroundColour, backgroundOpacity) return jsonify()