view service/frontDoorMessage/automsg.py @ 1139:db955e7943af

arduinonode reads config from etcd. use pushConfig.py to inform all nodes Ignore-this: 3155d873bb30ca82b48ace7531a550e5 darcs-hash:0b2be13fbb4dc2571bb1bb8ac97f6a1350f36e77
author drewp <drewp@bigasterisk.com>
date Sat, 03 Mar 2018 17:53:37 -0800
parents afc74853a1a4
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)