Mercurial > templog
diff web/log.py @ 182:e731c0d30b09
set nearly working
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 04 Feb 2014 22:49:16 +0800 |
parents | 30390852cb5d |
children | 177f616893e6 |
line wrap: on
line diff
--- a/web/log.py Thu Jan 30 22:56:17 2014 +0800 +++ b/web/log.py Tue Feb 04 22:49:16 2014 +0800 @@ -252,3 +252,28 @@ timedelta = time.time() - start_time debugf.write("Updated sensors in %.2f secs\n" % timedelta) debugf.flush() + +def get_params(): + _FIELD_DEFAULTS = { + 'fridge_setpoint': 16, + 'fridge_difference': 0.2, + 'overshoot_delay': 720, # 12 minutes + 'overshoot_factor': 1, # ÂșC + 'disabled': False, + 'nowort': False, + 'fridge_range_lower': 3, + 'fridge_range_upper': 3, + } + + r = [] + for k, v in _FIELD_DEFAULTS.iteritems(): + n = {'name': k, 'value': v} + if type(v) is bool: + if v: + n['value'] = "true" + kind = 'yesno' + else: + kind = 'number' + n['kind'] = kind + r.append(n) + return json.dumps(r, sort_keys=True, indent=4)