示例#1
0
def navigate():
    current = request.form.get('here')
    location = request.form.get('location')
    if network.validSession() == True:
        pass
    else:
        return render_template('login.html',)
示例#2
0
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',)
示例#3
0
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()
示例#4
0
def pauseSchedule():
    if network.validSession() == True:
        schedule.pauseSchedule()
    return jsonify()
示例#5
0
def applianceSwitch():
    if network.validSession() == True:
        appliance = str(request.form['appliance'])
        confirm = str(request.form['confirm'])
        appliances.switch(appliance, confirm)
    return jsonify()
示例#6
0
def heaterSwitch(heater):
    if network.validSession() == True:
        heating.switch(str(heater))
    return jsonify()
示例#7
0
def lightSwitch(light):
    if network.validSession() == True:
        lighting.switch(str(light))
    return jsonify()
示例#8
0
def powerRelay():
    if network.validSession() == True:
        circuit = str(request.form['circuit'])
        confirm = str(request.form['confirm'])
        power.powerRelays(circuit, confirm)
    return jsonify()
示例#9
0
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()