view service/frontDoorMessage/automsg.py @ 331:a94f2a522d41

build and import updates for rdfdb, etc Ignore-this: 233cb2b31f03be51695f0fff40eecca7
author drewp@bigasterisk.com
date Mon, 19 Feb 2018 04:21:28 -0800
parents 912a3dae5c2c
children
line wrap: on
line source

"""
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)