changeset 54:42411726a7ca

screen out more values that change on every update Ignore-this: 3f50a271af00e18be0ba7facbfc425a8
author drewp@bigasterisk.com
date Sun, 27 Jan 2013 23:48:30 -0800
parents 0141467893bf
children 0cffbf171a97
files service/reasoning/reasoning.py service/reasoning/rules.n3
diffstat 2 files changed, 25 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/service/reasoning/reasoning.py	Wed Jan 09 20:22:51 2013 -0800
+++ b/service/reasoning/reasoning.py	Sun Jan 27 23:48:30 2013 -0800
@@ -112,6 +112,8 @@
                 URIRef("http://bigasterisk.com/map#lastSeenAgoSec"),
                 URIRef("http://bigasterisk.com/map#lastSeenAgo"),
                 URIRef("http://projects.bigasterisk.com/room/usingPower"),
+                URIRef("http://projects.bigasterisk.com/room/idleTimeMinutes"),
+                URIRef("http://projects.bigasterisk.com/room/idleTimeMs"),
                 ])):
             log.debug("  remote graph changed")
             self.onChange(self)
@@ -323,6 +325,9 @@
 
         Using PUT because this is idempotent and retryable and
         everything.
+
+        todo: this should do the right thing when many requests come
+        in very quickly
         """
         print self.request.headers
         log.info("immediateUpdate from %s",
--- a/service/reasoning/rules.n3	Wed Jan 09 20:22:51 2013 -0800
+++ b/service/reasoning/rules.n3	Sun Jan 27 23:48:30 2013 -0800
@@ -3,6 +3,7 @@
 @prefix dev: <http://projects.bigasterisk.com/device/>.
 @prefix foaf: <http://xmlns.com/foaf/0.1/> .
 @prefix env: <http://projects.bigasterisk.com/device/environment>.
+@prefix math: <http://www.w3.org/2000/10/swap/math#> .
 
 { <http://bigasterisk.com/wifiDevice/x> :connected bigast:wifiAccessPoints . } => { :auth :near :home } .
 { <http://bigasterisk.com/wifiDevice/x> :connected bigast:wifiAccessPoints . } => { :auth :near :home } .
@@ -27,7 +28,7 @@
 
 {
   :auth :near :home .
-  dev:theaterDoorOutsideMotionRecent :state :motion.
+  dev:theaterDoorOutsideMotion :state :motion.
   dev:theaterDoorOpen :state :closed .
   env: :localHour :awakeTime .
 } => { dev:theaterDoorLock :state :unlocked } .
@@ -44,4 +45,21 @@
   dev:frontDoorLcd :brightness 255 .
 } .
 
-{ :playstation :powerState ?s } => { <http://bigasterisk.com/host/bang/monitor> :powerState ?s } .
+{ :darkKey :state :press } => {
+  <http://bigasterisk.com/host/dash/monitor> :powerState :off .
+} .
+
+#{ :playstation :powerState ?s } => { <http://bigasterisk.com/host/bang/monitor> :powerState ?s } .
+
+{
+  # this won't update right, currently, since I don't let the exact
+  # idle time into the rules recalculator. This threshold should be
+  # applied upstream.
+ 
+  <http://bigasterisk.com/host/dash/xidle> :idleTimeMinutes ?idle .
+  ?idle math:lessThan 30 .
+} => {
+  :drew :at :desk .
+  # the plan here is that as soon as we can show that I'm not at my
+  # desk (cell phone wifi, asleep, etc), power the screen off
+} .