Example #1
0
 def render_tempSection(self, ctx, data):
     try:
         temps = dict.fromkeys(["ariBedroom", "downstairs", "livingRoom", "bedroom", "KSQL"])
         temps.update(getAllTemps())
         return T.raw(render.tempsection(temps=temps))
     except Exception, e:
         return T.div["Error creating temperature graph: %s" % e]
Example #2
0
 def render_tempSection(self, ctx, data):
     try:
         temps = dict.fromkeys(
             ['ariBedroom', 'downstairs', 'livingRoom', 'bedroom', 'KSQL'])
         temps.update(getAllTemps())
         return T.raw(render.tempsection(temps=temps))
     except Exception, e:
         return T.div["Error creating temperature graph: %s" % e]
Example #3
0
 def child_tempSection(self, ctx):
     temps = dict.fromkeys(
         ['ariBedroom', 'downstairs', 'livingRoom', 'bedroom', 'KSQL'])
     temps.update(getAllTemps())
     return jsonlib.dumps([
         dict(name=k, val="%.1f °F" % v if v is not None else '?') for
         k, v in sorted(temps.items(), key=lambda (k, tp): tp, reverse=True)
     ])
Example #4
0
 def child_tempSection(self, ctx):
     temps = dict.fromkeys(["ariBedroom", "downstairs", "livingRoom", "bedroom", "KSQL"])
     temps.update(getAllTemps())
     return jsonlib.dumps(
         [
             dict(name=k, val="%.1f °F" % v if v is not None else "?")
             for k, v in sorted(temps.items(), key=lambda (k, tp): tp, reverse=True)
         ]
     )
Example #5
0
"""
write the automatic last line to LCD /lastLine
"""
import sys, time

sys.path.append("/my/site/magma")
from datetime import datetime
from graphitetemp import getAllTemps

import restkit

# needs poller with status report

while True:
    fd = restkit.Resource("http://bang:9081/")

    allTemp = getAllTemps()
    now = datetime.now()

    line = "%02d:%02d %02dF in, %02dF out" % (
        now.hour,
        now.minute,
        allTemp.get("livingRoom", 0),
        allTemp.get("frontDoor", 0),
    )
    fd.put("lastLine", payload=line)
    time.sleep(60)