# HG changeset patch # User drewp # Date 1359359310 28800 # Node ID 379cefec542ee9df260cddbf6f7407874fe1ca24 # Parent 8887a0778a1f8e3a26752d07234a97ee7f5798d6 screen out more values that change on every update Ignore-this: 3f50a271af00e18be0ba7facbfc425a8 darcs-hash:20130128074830-312f9-18689c92487fd3a86a8a6193a9495586fcdd83da diff -r 8887a0778a1f -r 379cefec542e service/reasoning/reasoning.py --- 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", diff -r 8887a0778a1f -r 379cefec542e service/reasoning/rules.n3 --- 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: . @prefix foaf: . @prefix env: . +@prefix math: . { :connected bigast:wifiAccessPoints . } => { :auth :near :home } . { :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 } => { :powerState ?s } . +{ :darkKey :state :press } => { + :powerState :off . +} . + +#{ :playstation :powerState ?s } => { :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. + + :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 +} .