diff service/garageArduino/garageArduino.py @ 809:bebb8f7c5a3e

move a bunch of services into this tree, give them all web status pages Ignore-this: a11e90f9d2cd9470565c743f54943c4b darcs-hash:20110808073131-312f9-a7f420d66388cedae458276d672a27a9249f1e2f.gz
author drewp <drewp@bigasterisk.com>
date Mon, 08 Aug 2011 00:31:31 -0700
parents 9e99114dde57
children 4c44c80a6a72
line wrap: on
line diff
--- a/service/garageArduino/garageArduino.py	Sun Aug 07 21:50:21 2011 -0700
+++ b/service/garageArduino/garageArduino.py	Mon Aug 08 00:31:31 2011 -0700
@@ -93,8 +93,12 @@
     """
     def get(self):
         self.set_header("Content-Type", "application/javascript")
-        self.settings.poller.assertIsCurrent()
-        self.write(json.dumps({"irLevels" : [[t1, lev1], [t2,lev2], ]}))
+        pts = []
+        for i in range(60):
+            level = self.settings.arduino.lastLevel()
+            pts.append((round(time.time(), 3), level))
+
+        self.write(json.dumps({"irLevels" : pts}))
 
 class HousePowerThreshold(PrettyErrorHandler, cyclone.web.RequestHandler):
     """
@@ -116,8 +120,8 @@
             (r"/graph", GraphPage),
             (r"/frontDoorMotion", FrontDoorMotion),
             (r'/housePower', HousePower),
-            (r'/housepower/raw', HousePowerRaw),
-            (r'/housepower/threshold', HousePowerThreshold),
+            (r'/housePower/raw', HousePowerRaw),
+            (r'/housePower/threshold', HousePowerThreshold),
         ]
         settings = {"arduino" : ard, "poller" : poller}
         cyclone.web.Application.__init__(self, handlers, **settings)