changeset 900:531fce163cbd

more laundry webpage Ignore-this: 37af9a1a317728d0e460e5c2a482b4b6 darcs-hash:20130827051129-312f9-80ed32d3f53bffe9e9637fafb48e4c6a5ed5f845
author drewp <drewp@bigasterisk.com>
date Mon, 26 Aug 2013 22:11:29 -0700
parents 2d718e542198
children c06fdb61157f
files service/laundry/index.html service/laundry/static/gui.js
diffstat 2 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/service/laundry/index.html	Sat Aug 24 22:54:34 2013 -0700
+++ b/service/laundry/index.html	Mon Aug 26 22:11:29 2013 -0700
@@ -8,12 +8,23 @@
   <body ng-controller="Ctrl">
     <h1>laundry room pi</h1>
     <div>
+      <div>
+        current <a href="status">/status</a>
+        (as an rdf <a href="graph">graph</a>)
+      </div>
       <div>motion: {{status.motion}}</div>
       <div>switch1: {{status.switch1}}</div>
       <div>switch2: {{status.switch2}}</div>
       <div>switch3: {{status.switch3}}</div>
       <div>doorClosed: {{status.doorClosed}}</div>
-      <div>orange led: {{status.led}}</div>
+      <hr>
+      <div>
+        orange led: {{status.led}}
+        <button ng-click="setLed('on')">on</button>
+        <button ng-click="setLed('off')">off</button>
+      </div>
+      <div>strike: <button>unlock for 3 seconds</button></div>
+      <div>speaker: <button>beep</button></div>
     </div>
     <div>Status: {{status | json}}</div>
   </body>
--- a/service/laundry/static/gui.js	Sat Aug 24 22:54:34 2013 -0700
+++ b/service/laundry/static/gui.js	Mon Aug 26 22:11:29 2013 -0700
@@ -1,7 +1,16 @@
 'use strict';
 
 function Ctrl($scope, $http) {
-    $http.get("status").success(function (data) {
-        $scope.status = data;
-    });
+    function refresh() {
+        $http.get("status").success(function (data) {
+            $scope.status = data;
+        });
+    }
+    refresh();
+    $scope.setLed = function (value) {
+        $http.put("led", value).succeed(function () {
+            refresh();
+        });
+    }
+                                        
 }