示例#1
0
def index(name=None):
    db = DataStore()
    settings = db.get_settings()
    db.shutdown()
    min_temp = math.floor(settings['target_temp'] - temp_range/2)
    max_temp = math.ceil(settings['target_temp'] + temp_range/2)
    return render_template('index3.html', min_temp=min_temp, max_temp=max_temp, **settings)
示例#2
0
def history(name=None):
    db = DataStore()
    settings = db.get_settings()
    db.shutdown()
    tr = request.args.get('tr')
    if tr is None:
        tr = 8
    min_temp = math.floor(settings['target_temp'] - temp_range/2)
    max_temp = math.ceil(settings['target_temp'] + temp_range/2)
    return render_template('history.html', tr=tr, min_temp=min_temp, max_temp=max_temp, **settings)
示例#3
0
def index(name=None):
    db = DataStore()
    settings = db.get_settings()
    db.shutdown()
    min_temp = math.floor(settings['target_temp'] - temp_range / 2)
    max_temp = math.ceil(settings['target_temp'] + temp_range / 2)
    return render_template('index.html',
                           min_temp=min_temp,
                           max_temp=max_temp,
                           **settings)
示例#4
0
def history(name=None):
    db = DataStore()
    settings = db.get_settings()
    db.shutdown()
    tr = request.args.get('tr')
    if tr is None:
        tr = 8
    min_temp = math.floor(settings['target_temp'] - temp_range / 2)
    max_temp = math.ceil(settings['target_temp'] + temp_range / 2)
    return render_template('history.html',
                           tr=tr,
                           min_temp=min_temp,
                           max_temp=max_temp,
                           **settings)
示例#5
0
def profiles():
    db = DataStore()
    if request.method == 'POST':
        _profiles = request.get_json()
        for _profile in _profiles:
            if 'id' in _profile and _profile['id'] is not u'':
                logging.getLogger('pyro').debug('updating: %s' % _profile)
                db.save_profile(_profile)
            else:
                logging.getLogger('pyro').debug('adding: %s' % _profile)
                db.add_profile(_profile)
        db.shutdown()
        return 'ok'
    elif request.method == 'DELETE':
        _profile = request.get_json()
        logging.getLogger('pyro').debug('deleting: %s' % _profile)
        db.delete_profile(_profile['id'])
        db.shutdown()
        return 'ok'
    else:
        _profiles = db.get_profiles()
        db.shutdown()
        return json.dumps(_profiles)
示例#6
0
def profiles():
    db = DataStore()
    if request.method == 'POST':
        _profiles = request.get_json()
        for _profile in _profiles:
            if 'id' in _profile and _profile['id'] is not u'':
                logging.getLogger('pyro').debug('updating: %s' % _profile)
                db.save_profile(_profile)
            else:
                logging.getLogger('pyro').debug('adding: %s' % _profile)
                db.add_profile(_profile)
        db.shutdown()
        return 'ok'
    elif request.method == 'DELETE':
        _profile = request.get_json()
        logging.getLogger('pyro').debug('deleting: %s' % _profile)
        db.delete_profile(_profile['id'])
        db.shutdown()
        return 'ok'
    else:
        _profiles = db.get_profiles()
        db.shutdown()
        return json.dumps(_profiles)
示例#7
0
def temps(idx=0):
    db = DataStore()
    temps = db.get_temps(idx)
    db.shutdown()
    return json.dumps(temps)
示例#8
0
def temps(idx=0):
    db = DataStore()
    temps = db.get_temps(idx)
    db.shutdown()
    return temps