# HG changeset patch # User drewp # Date 1581618263 28800 # Node ID 5409427730284340e251a535d8c6052a0ff1b8d8 # Parent 5a04e8cd1cd7e450ad852d8184b63e796a899278 rule updates Ignore-this: aed200759cd4678d35957590d497a76f darcs-hash:151d4196657acbb55249b16bba919bd10ac69f59 diff -r 5a04e8cd1cd7 -r 540942773028 service/reasoning/input/devices.n3 --- a/service/reasoning/input/devices.n3 Thu Feb 13 10:22:12 2020 -0800 +++ b/service/reasoning/input/devices.n3 Thu Feb 13 10:24:23 2020 -0800 @@ -11,58 +11,80 @@ :off :putValue "off" . - :putUrl "http://bang:9095/monitor"; :zeroValue "off" . - :putUrl "http://dash:9095/monitor" . - :putUrl "http://frontdoor:9095/monitor" . +# :putUrl "http://bang:9095/monitor"; :zeroValue "off" . +# :putUrl "http://dash:9095/monitor" . + :putUrl "http://frontdoor:9095/monitor"; :matchPredicate :powerState . +reasoning:defaultOutput reasoning:default [ + :subject ; + :predicate :powerState; + :defaultObject "off" +] . -:storageCeilingLedCross - :putUrl ; - :zeroValue 0.0 . +:storageCeilingLedCross :putUrl ; :putPredicate :brightness . +reasoning:defaultOutput reasoning:default [ + :subject :storageCeilingLedCross; + :predicate :brightness; + :defaultObject 0.0 +] . -:storageCeilingLedLong - :putUrl ; - :zeroValue 0.0 . +:storageCeilingLedLong :putUrl ; :putPredicate :brightness . +reasoning:defaultOutput reasoning:default [ + :subject :storageCeilingLedLong; + :predicate :brightness; + :defaultObject 0.0 +] . -:garageOverhead - :putUrl . -:headboardWhite - :putUrl . -:bedLedStrip - :putUrl . - -:starTrekLight - :putUrl . +:garageOverhead :putUrl ; :putPredicate :brightness . +reasoning:defaultOutput reasoning:default [ + :subject :garageOverhead; + :predicate :brightness; + :defaultObject 0.0 +] . + +:headboardWhite :putUrl ; :putPredicate :brightness . +# no default, follows switch (which should be moved to edit /store) -:kitchenLight - :putUrl . +:bedLedStrip :putUrl ; :putPredicate :color . +reasoning:defaultOutput reasoning:default [ + :subject :bedLedStrip; + :predicate :color; + :defaultObject "#000000" +] . + +:starTrekLight :putUrl ; :putPredicate :brightness . -:kitchenCounterLight - :putUrl . +:kitchenLight :putUrl ; :putPredicate :brightness . +# no default, follows switch + +:kitchenCounterLight :putUrl ; :putPredicate :brightness . +# no default, follows switch -:changingWhite - :putUrl . +:changingWhite :putUrl ; :putPredicate :brightness . +reasoning:defaultOutput reasoning:default [ + :subject :changingWhite; + :predicate :brightness; + :defaultObject 0.0 +] . :changingCamPost a :OneShotPost; :subject :changingCam; :predicate :grab . bang: a :OneShotPost; :subject bang:; :predicate :postAction . -:livingRoomLamp1 - :putUrl . - -:livingRoomLamp2 - :putUrl . +:livingRoomLamp1 :putUrl ; :putPredicate :brightness . +# no default, follows switch -:loftDeskStrip - :putUrl ; :putPredicate :x . -#reasoning:defaultOutput reasoning:default [ :subject :loftDeskStrip; :predicate :x; :defaultObject 0.0 ] . +:loftDeskStrip :putUrl ; :putPredicate :x . +# no default, follows switch -:frontDoorOled :putUrl ; :putPredicate :state . -:frontWindow :putPredicate :line1; :putUrl . -:frontWindow :putPredicate :line2; :putUrl . -:frontWindow :putPredicate :line3; :putUrl . -:frontWindow :putPredicate :line4; :putUrl . - -# newer style, with distinct :putState. :frontDoorLock :matchPredicate :putState; :putUrl ; + :refreshPutValue "2s"; :putPredicate :state . +reasoning:defaultOutput reasoning:default [ + :subject :frontDoorLock; + :predicate :putState; + :defaultObject :locked +] . + +:frontDoorOled :putUrl ; :putPredicate :state . +:frontWindow :putPredicate :line1, :line2, :line3, :line4; :putUrl . diff -r 5a04e8cd1cd7 -r 540942773028 service/reasoning/rules.n3 --- a/service/reasoning/rules.n3 Thu Feb 13 10:22:12 2020 -0800 +++ b/service/reasoning/rules.n3 Thu Feb 13 10:24:23 2020 -0800 @@ -14,8 +14,8 @@ @prefix sensor: . -{ ?d :deviceName "drew-phone"; :connected bigast:wifiAccessPoints . } => { :auth :near :home } . -{ ?d :deviceName "Kelsis-iPhone"; :connected bigast:wifiAccessPoints . } => { :auth :near :home } . +# { ?d :deviceName "drew-phone"; :connected bigast:wifiAccessPoints . } => { :auth :near :home } . +# { ?d :deviceName "Kelsis-iPhone"; :connected bigast:wifiAccessPoints . } => { :auth :near :home } . { env: :localHour 8 } => { env: :localHour :awakeTime } . { env: :localHour 9 } => { env: :localHour :awakeTime } . @@ -34,45 +34,35 @@ { env: :localHour 22 } => { env: :localHour :awakeTime } . { env: :localHour 23 } => { env: :localHour :awakeTime } . -#{ -# # 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. -# -# dash:xidle :idleTimeMinutes ?idle . -# # broken with new fuxi- needs review: ?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 -#} . -# -#@prefix shuttle: . -#@prefix mpd: . -# -#{ ?button :state :press . ?button :playsMusic ?song } => { mpd: :startMusic ?song } . -## the rest of this modeling is still a mess. Handled completely by special case in reasoning.py -#{ shuttle:button12 :state :press } => { mpd: :playState :pause } . -#{ shuttle:dial :change :clockwise } => { mpd: :audioState :volumeStepUp } . -#{ shuttle:dial :change :counterclockwise } => { mpd: :audioState :volumeStepDown } . -# +# #{ +# # # 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. +# # +# # dash:xidle :idleTimeMinutes ?idle . +# # # broken with new fuxi- needs review: ?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 +# #} . +# # +# #@prefix shuttle: . +# #@prefix mpd: . +# # +# #{ ?button :state :press . ?button :playsMusic ?song } => { mpd: :startMusic ?song } . +# ## the rest of this modeling is still a mess. Handled completely by special case in reasoning.py +# #{ shuttle:button12 :state :press } => { mpd: :playState :pause } . +# #{ shuttle:dial :change :clockwise } => { mpd: :audioState :volumeStepUp } . +# #{ shuttle:dial :change :counterclockwise } => { mpd: :audioState :volumeStepDown } . +# # -#{ sensor:motionStorage :seesRecently :noMotion . } => { -# :storageCeilingLedCross :brightness 0 . -# :storageCeilingLedLong :brightness 0 . -#} . - { sensor:motionStorage :seesRecently :motion . } => { - :storageCeilingLedCross :brightness 1 . - :storageCeilingLedLong :brightness 1 . + :storageCeilingLedCross :brightness 1.0 . + :storageCeilingLedLong :brightness 1.0 . } . -#{ sensor:motionStorage :sees :motionStart . } => { -# :storageCeilingLedCross :brightness 1 . -# :storageCeilingLedLong :brightness 1 . -#} . - { sensor:bedGreenButton :buttonState :press } => { :headboardWhite :brightness 0.0 . :anim1 :position :end . @@ -83,7 +73,7 @@ } . { sensor:bedRedButton :buttonState :press . :headboardWhite :brightness 0.2 . } => { - :headboardWhite :brightness 1 . + :headboardWhite :brightness 1.0 . } . @prefix sensor: . @@ -110,29 +100,28 @@ { :bookSwitch :buttonState :press . :livingRoomLamp1 :brightness 0.0 . } => { :livingRoomLamp1 :brightness 1.0 . :livingRoomLamp2 :brightness 1.0 . + :livingRoomLamp3 :brightness 1.0 . } . { :bookSwitch :buttonState :press . :livingRoomLamp1 :brightness 1.0 . } => { :livingRoomLamp1 :brightness 0.0 . :livingRoomLamp2 :brightness 0.0 . + :livingRoomLamp3 :brightness 0.0 . } . -{ :frontBedPostSwitch1 :buttonState :press . :starTrekLight :brightness 0.0 . } => { - :starTrekLight :brightness 1.0 . -} . -{ :frontBedPostSwitch1 :buttonState :press . :starTrekLight :brightness 1.0 . } => { - :starTrekLight :brightness 0.0 . -} . +# { :frontBedPostSwitch1 :buttonState :press . :starTrekLight :brightness 0.0 . } => { +# :starTrekLight :brightness 1.0 . +# } . +# { :frontBedPostSwitch1 :buttonState :press . :starTrekLight :brightness 1.0 . } => { +# :starTrekLight :brightness 0.0 . +# } . { :frontBedPostSwitch1 :buttonState :press . } => { :loftDeskStrip :x 99.0 . } . -{ :frontBedPostSwitch2 :buttonState :press . } => { :loftDeskStrip :x 15 -#84.0 +{ :frontBedPostSwitch2 :buttonState :press . } => { :loftDeskStrip :x 84.0 . } . -{ :frontBedPostSwitch3 :buttonState :press . } => { :loftDeskStrip :x 15 -#53.0 +{ :frontBedPostSwitch3 :buttonState :press . } => { :loftDeskStrip :x 53.0 . } . -{ :frontBedPostSwitch4 :buttonState :press . } => { :loftDeskStrip :x 15 -#30.0 +{ :frontBedPostSwitch4 :buttonState :press . } => { :loftDeskStrip :x 15.0 . } . { :frontBedPostSwitch5 :buttonState :press . } => { :loftDeskStrip :x 0.0 . } . @@ -152,11 +141,6 @@ } . - -{ :seesRecently :noMotion . } => { - :garageOverhead :brightness 0.0. -} . - { :seesRecently :motion . } => { :garageOverhead :brightness 1.0 . } . @@ -165,22 +149,22 @@ { sensor:motionFrontDoorInside :seesRecently30 :motion } => { - :powerState :on . + :powerState "on" . } . { :state :press } => { -#star:slideshow :postAction . -bang: :postAction . + #star:slideshow :postAction . + bang: :postAction . } . -{ :temperatureF ?t . - :temperatureF ?setTemp . - ?t math:lessThan ?setTemp . -} => { - :fakeHeater :state :on . -} . +# { :temperatureF ?t . +# :temperatureF ?setTemp . +# ?t math:lessThan ?setTemp . +# } => { +# :fakeHeater :state :on . +# } . { :frontDoorLockRequest :state :unlocked . } => { @@ -217,3 +201,7 @@ :frontWindow :line3 "Open" . } . +# { :switch1 :buttonState :pressed . +# } => { +# :switch1 :demo :received . +# } .