view service/reasoning/rules.n3 @ 1147:ef494fe0499f

forgot devices_shared.py Ignore-this: 210e7777d9d4d11f148bb7e63f5de65a darcs-hash:8dd34afc9d00fe796f94da254519e22ca1fa7d03
author drewp <drewp@bigasterisk.com>
date Wed, 04 Apr 2018 14:58:27 -0700
parents 114ca7fd9d01
children 79d041273e26
line wrap: on
line source

# rules only! statements in this file will not be considered in the graph

@prefix : <http://projects.bigasterisk.com/room/>.
@prefix bigast: <http://bigasterisk.com/>.
@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#> .

@prefix star: <http://bigasterisk.com/host/star/> .
@prefix bang: <http://bigasterisk.com/host/bang/> .
@prefix dash: <http://bigasterisk.com/host/dash/> .
@prefix slash: <http://bigasterisk.com/host/slash/> .

@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 } .

{ env: :localHour 8 } => { env: :localHour :awakeTime } .
{ env: :localHour 9 } => { env: :localHour :awakeTime } .
{ env: :localHour 10 } => { env: :localHour :awakeTime } .
{ env: :localHour 11 } => { env: :localHour :awakeTime } .
{ env: :localHour 12 } => { env: :localHour :awakeTime } .
{ env: :localHour 13 } => { env: :localHour :awakeTime } .
{ env: :localHour 14 } => { env: :localHour :awakeTime } .
{ env: :localHour 15 } => { env: :localHour :awakeTime } .
{ env: :localHour 16 } => { env: :localHour :awakeTime } .
{ env: :localHour 17 } => { env: :localHour :awakeTime } .
{ env: :localHour 18 } => { env: :localHour :awakeTime } .
{ env: :localHour 19 } => { env: :localHour :awakeTime } .
{ env: :localHour 20 } => { env: :localHour :awakeTime } .
{ env: :localHour 21 } => { env: :localHour :awakeTime } .
{ env: :localHour 22 } => { env: :localHour :awakeTime } .
{ env: :localHour 23 } => { env: :localHour :awakeTime } .

{
  :auth :near :home .
  dev:theaterDoorOutsideMotion :state :sustainedMotion .
  dev:theaterDoorOpen :state :closed .
  env: :localHour :awakeTime .
} => { dev:theaterDoorLock :state :unlocked } .

{ dev:frontDoorOpen :state :closed } => { dev:frontDoorOpenIndicator :text "_" } .
{ dev:frontDoorOpen :state :open } => { dev:frontDoorOpenIndicator :text "D" } .

{ dev:frontDoorMotion :state :noMotion } => { 
  dev:frontDoorMotionIndicator :text "_" .
  dev:frontDoorLcd :brightness 0 .
} .
{ dev:frontDoorMotion :state :motion } => { 
  dev:frontDoorMotionIndicator :text "D" .
  dev:frontDoorLcd :brightness 255 .
} .

{ :darkKey :state :press } => {
  dash:monitor :powerState :off .
} .

{ <http://projects.bigasterisk.com/room/star/button/blu> :change :down . } =>
{
  star:slideshow :postAction star:slideshowadvance .
  star:slideshow :postAction <http://star:9049/effects/beep2> .
} .


{ <http://projects.bigasterisk.com/room/star/button/yel> :change :down . } =>
{
  star:slideshow :postAction star:slideshowtoggleFeeder .
  star:slideshow :postAction <http://star:9049/effects/beep1> .
} .

{ <http://projects.bigasterisk.com/room/barcodeScan> <http://projects.bigasterisk.com/room/read> <http://projects.bigasterisk.com/room/barcode/UPC-A/4984343881945> } =>
{
  star:slideshow :postAction <http://star:9049/effects/troyandabed> .
} .

@prefix bed: <http://projects.bigasterisk.com/room/ariBed/> . 
{ bed:button1 :change :down . } => {
  star:slideshow :postAction <http://brace:9055/starTrekLight/toggle> .
  star:slideshow :postAction <http://brace:9049/effects/highlight> .
} .
{ bed:button2 :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/troyandabed> . } .
{ bed:button3 :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/beep1> . } .
{ bed:button4 :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/beep1> . } .
{ bed:button5 :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/jazztrumpet> . } .


# sound wasn't responding; waiting for other button fixes
# { <http://projects.bigasterisk.com/room/star/button/yel> :change :down . } =>
# {
#   star:sound :postAction <http://star:9049/sound?filename=/my/music/ubuntuone/Daft+Punk/Discovery/Harder+Better+Faster+Stronger.mp3> .
# } .

{ <http://projects.bigasterisk.com/room/livingRoom/shuttlepro/dial> :change :up . } => {
  slash:sound :postAction <http://slash:9049/volume?offset=.05&max=.6> .
} .

{ <http://projects.bigasterisk.com/room/livingRoom/shuttlepro/dial> :change :down . } => {
  slash:sound :postAction <http://slash:9049/volume?offset=-.05&max=.6> .
} .

{
  # 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 .
} .

#{ sensor:motionStorage :sees :motionStart . } => {
#  :storageCeilingLedCross :brightness 1 .
#  :storageCeilingLedLong :brightness 1 .
#} .

@prefix bed: <http://bigasterisk.com/homeauto/sensor/bed/> .

{ bed:greenButton :buttonState :press } => {
  :headboardWhite :brightness 0.0 .
  :anim1 :position :end .
} .

{ bed:redButton :buttonState :press . :headboardWhite :brightness 0.0 . } => {
  :headboardWhite :brightness 0.2 . 
} .

{ bed:redButton :buttonState :press . :headboardWhite :brightness 0.2 . } => {
  :headboardWhite :brightness 1 .
} .

@prefix sensor:   <http://bigasterisk.com/homeauto/sensor/> .
{ sensor:buttonAriBed :buttonState :press } => {
  :starTrekLight :brightness 0.0 .
} .

{ sensor:motionChanging :seesRecently30 :noMotion } => {
  :changingWhite :brightness 0.0 .
  } .

{ sensor:motionChanging :seesRecently30 :motion } => {
  :changingWhite :brightness 0.3 .
} .

{ sensor:motionChanging :sees :motionStart90 . dev:calendar :twilight :daytime .} => {
  :changingCam :grab <http://bang:9057/changing-day.jpg> .
  } .

{ sensor:motionChanging :sees :motionStart90 . dev:calendar :twilight :withinTwilight .} => {
  :changingCam :grab <http://bang:9057/changing-night.jpg> .
  } .

{ :bookSwitch :buttonState :press . :livingRoomLamp1 :brightness 0.0 . } => {
  :livingRoomLamp1 :brightness 1.0 .
  :livingRoomLamp2 :brightness 1.0 .
} .
{ :bookSwitch :buttonState :press . :livingRoomLamp1 :brightness 1.0 . } => {
  :livingRoomLamp1 :brightness 0 .
  :livingRoomLamp2 :brightness 0 .
} .



{ <http://bigasterisk.com/homeauto/sensor/motionGarageDoorInside> :seesRecently :noMotion . } => {
  :garageOverhead :brightness 0 .
} .

{ <http://bigasterisk.com/homeauto/sensor/motionGarageDoorInside> :seesRecently :motion . } => {
  :garageOverhead :brightness 1 .
} .

{ sensor:motionBed :sees :motion . } => { :anim1 :playback :start . } .


{ sensor:motionFrontdoorInside :seesRecently30 :motion } => {
  <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> .
} .