Mercurial > code > home > repos > homeauto
changeset 750:35048f629f77
rule updates
Ignore-this: aed200759cd4678d35957590d497a76f
author | drewp@bigasterisk.com |
---|---|
date | Thu, 13 Feb 2020 10:24:23 -0800 |
parents | fc1f330b5a4b |
children | a564f6edbca5 |
files | service/reasoning/input/devices.n3 service/reasoning/rules.n3 |
diffstat | 2 files changed, 112 insertions(+), 102 deletions(-) [+] |
line wrap: on
line diff
--- 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" . -<http://bigasterisk.com/host/bang/monitor> :putUrl "http://bang:9095/monitor"; :zeroValue "off" . -<http://bigasterisk.com/host/dash/monitor> :putUrl "http://dash:9095/monitor" . -<http://bigasterisk.com/host/frontdoor/monitor> :putUrl "http://frontdoor:9095/monitor" . +#<http://bigasterisk.com/host/bang/monitor> :putUrl "http://bang:9095/monitor"; :zeroValue "off" . +#<http://bigasterisk.com/host/dash/monitor> :putUrl "http://dash:9095/monitor" . +<http://bigasterisk.com/host/frontdoor/monitor> :putUrl "http://frontdoor:9095/monitor"; :matchPredicate :powerState . +reasoning:defaultOutput reasoning:default [ + :subject <http://bigasterisk.com/host/frontdoor/monitor>; + :predicate :powerState; + :defaultObject "off" +] . -:storageCeilingLedCross - :putUrl <http://bang:9059/output?s=http://projects.bigasterisk.com/room/storageCeilingLedCross&p=http://projects.bigasterisk.com/room/brightness>; - :zeroValue 0.0 . +:storageCeilingLedCross :putUrl <http://bang:9059/output>; :putPredicate :brightness . +reasoning:defaultOutput reasoning:default [ + :subject :storageCeilingLedCross; + :predicate :brightness; + :defaultObject 0.0 +] . -:storageCeilingLedLong - :putUrl <http://bang:9059/output?s=http://projects.bigasterisk.com/room/storageCeilingLedLong&p=http://projects.bigasterisk.com/room/brightness>; - :zeroValue 0.0 . +:storageCeilingLedLong :putUrl <http://bang:9059/output>; :putPredicate :brightness . +reasoning:defaultOutput reasoning:default [ + :subject :storageCeilingLedLong; + :predicate :brightness; + :defaultObject 0.0 +] . -:garageOverhead - :putUrl <http://garage.vpn-home.bigasterisk.com:9059/output?s=http://projects.bigasterisk.com/room/garageOverhead&p=http://projects.bigasterisk.com/room/brightness> . -:headboardWhite - :putUrl <http://bed.vpn-home.bigasterisk.com:9059/output?s=http://projects.bigasterisk.com/room/headboardWhite&p=http://projects.bigasterisk.com/room/brightness> . -:bedLedStrip - :putUrl <http://bed.vpn-home.bigasterisk.com:9059/output?s=http://projects.bigasterisk.com/room/bedLedStrip&p=http://projects.bigasterisk.com/room/color> . - -:starTrekLight - :putUrl <http://frontbed:9059/output?s=http://projects.bigasterisk.com/room/starTrekLight&p=http://projects.bigasterisk.com/room/brightness> . +:garageOverhead :putUrl <http://garage.vpn-home.bigasterisk.com:9059/output>; :putPredicate :brightness . +reasoning:defaultOutput reasoning:default [ + :subject :garageOverhead; + :predicate :brightness; + :defaultObject 0.0 +] . + +:headboardWhite :putUrl <http://bed.vpn-home.bigasterisk.com:9059/output>; :putPredicate :brightness . +# no default, follows switch (which should be moved to edit /store) -:kitchenLight - :putUrl <http://bang:10008/output?s=http://projects.bigasterisk.com/room/kitchenLight&p=http://projects.bigasterisk.com/room/brightness> . +:bedLedStrip :putUrl <http://bed.vpn-home.bigasterisk.com:9059/output>; :putPredicate :color . +reasoning:defaultOutput reasoning:default [ + :subject :bedLedStrip; + :predicate :color; + :defaultObject "#000000" +] . + +:starTrekLight :putUrl <http://frontbed:9059/output>; :putPredicate :brightness . -:kitchenCounterLight - :putUrl <http://bang:10008/output?s=http://projects.bigasterisk.com/room/kitchenCounterLight&p=http://projects.bigasterisk.com/room/brightness> . +:kitchenLight :putUrl <http://bang:10008/output>; :putPredicate :brightness . +# no default, follows switch + +:kitchenCounterLight :putUrl <http://bang:10008/output>; :putPredicate :brightness . +# no default, follows switch -:changingWhite - :putUrl <http://changing:9059/output?s=http://projects.bigasterisk.com/room/changingWhite&p=http://projects.bigasterisk.com/room/brightness> . +:changingWhite :putUrl <http://changing:9059/output>; :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 <http://living:9059/output?s=http://projects.bigasterisk.com/room/livingRoomLamp1&p=http://projects.bigasterisk.com/room/brightness> . - -:livingRoomLamp2 - :putUrl <http://living:9059/output?s=http://projects.bigasterisk.com/room/livingRoomLamp2&p=http://projects.bigasterisk.com/room/brightness> . +:livingRoomLamp1 :putUrl <http://living:9059/output>; :putPredicate :brightness . +# no default, follows switch -:loftDeskStrip - :putUrl <http://frontbed:9059/output>; :putPredicate :x . -#reasoning:defaultOutput reasoning:default [ :subject :loftDeskStrip; :predicate :x; :defaultObject 0.0 ] . +:loftDeskStrip :putUrl <http://frontbed:9059/output>; :putPredicate :x . +# no default, follows switch -:frontDoorOled :putUrl <http://frontdoor:10013/output>; :putPredicate :state . -:frontWindow :putPredicate :line1; :putUrl <http://bang:10008/output> . -:frontWindow :putPredicate :line2; :putUrl <http://bang:10008/output> . -:frontWindow :putPredicate :line3; :putUrl <http://bang:10008/output> . -:frontWindow :putPredicate :line4; :putUrl <http://bang:10008/output> . - -# newer style, with distinct :putState. :frontDoorLock :matchPredicate :putState; :putUrl <http://bang:10011/output>; + :refreshPutValue "2s"; :putPredicate :state . +reasoning:defaultOutput reasoning:default [ + :subject :frontDoorLock; + :predicate :putState; + :defaultObject :locked +] . + +:frontDoorOled :putUrl <http://frontdoor:10013/output>; :putPredicate :state . +:frontWindow :putPredicate :line1, :line2, :line3, :line4; :putUrl <http://bang:10008/output> .
--- 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: <http://bigasterisk.com/homeauto/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: <http://bigasterisk.com/room/livingRoom/shuttlepro/> . -#@prefix mpd: <http://bigasterisk.com/host/slash/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: <http://bigasterisk.com/room/livingRoom/shuttlepro/> . +# #@prefix mpd: <http://bigasterisk.com/host/slash/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: <http://bigasterisk.com/homeauto/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 @@ } . - -{ <http://bigasterisk.com/homeauto/sensor/motionGarageDoorInside> :seesRecently :noMotion . } => { - :garageOverhead :brightness 0.0. -} . - { <http://bigasterisk.com/homeauto/sensor/motionGarageDoorInside> :seesRecently :motion . } => { :garageOverhead :brightness 1.0 . } . @@ -165,22 +149,22 @@ { sensor:motionFrontDoorInside :seesRecently30 :motion } => { - <http://bigasterisk.com/host/frontdoor/monitor> :powerState :on . + <http://bigasterisk.com/host/frontdoor/monitor> :powerState "on" . } . { <http://projects.bigasterisk.com/room/remoteButton/KEY_POWER> :state :press } => { -#star:slideshow :postAction <http://dash:9049/effects/question> . -bang: :postAction <http://10.2.0.62/rpc/motor> . + #star:slideshow :postAction <http://dash:9049/effects/question> . + bang: :postAction <http://10.2.0.62/rpc/motor> . } . -{ <http://bigasterisk.com/homeauto/sensor/tempHumidKitchen> :temperatureF ?t . - <http://bigasterisk.com/homeauto/thermostatSetTemp> :temperatureF ?setTemp . - ?t math:lessThan ?setTemp . -} => { - :fakeHeater :state :on . -} . +# { <http://bigasterisk.com/homeauto/sensor/tempHumidKitchen> :temperatureF ?t . +# <http://bigasterisk.com/homeauto/thermostatSetTemp> :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 . +# } .