Mercurial > code > home > repos > homeauto
view service/reasoning/rules.n3 @ 1754:92999dfbf321 default tip
add shelly support
author | drewp@bigasterisk.com |
---|---|
date | Tue, 04 Jun 2024 13:03:43 -0700 |
parents | 3c18ec6cb6ef |
children |
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 } . #{ # # 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 :motion . } => { :storageCeilingLedCross :brightness 1.0 . :storageCeilingLedLong :brightness 1.0 . } . { sensor:bedGreenButton :buttonState :press } => { :headboardWhite :brightness 0.0 . :bedHeadboard :color "#000000" . :anim1 :position :end . } . { sensor:bedRedButton :buttonState :press . :headboardWhite :brightness 0.0 . } => { :headboardWhite :brightness 0.2 . :bedHeadboard :color "#333333" . } . { sensor:bedRedButton :buttonState :press . :headboardWhite :brightness 0.2 . } => { :headboardWhite :brightness 1.0 . :bedHeadboard :color "#ffffff" . } . { 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/snapshot/changing-day.jpg> . } . { sensor:motionChanging :sees :motionStart90 . dev:calendar :twilight :withinTwilight .} => { :changingCam :grab <http://bang:9057/snapshot/changing-night.jpg> . } . { :bookSwitch :buttonState :press . :livingRoomLamp3 :brightness 0.0 . } => { :livingRoomLamp1 :brightness 1.0 . :livingRoomLamp2 :brightness 1.0 . :livingRoomLamp3 :brightness 1.0 . :livingLampShelf :brightness 1.0 . :livingLampMantleEntry :brightness 1.0 . :livingLampMantleChair :brightness 1.0 . :livingLampToyShelf :brightness 1.0 . :livingLampPiano :brightness 1.0 . } . { :bookSwitch :buttonState :press . :livingRoomLamp3 :brightness 1.0 . } => { :livingRoomLamp1 :brightness 0.0 . :livingRoomLamp2 :brightness 0.0 . :livingRoomLamp3 :brightness 0.0 . :livingLampShelf :brightness 0.0 . :livingLampMantleEntry :brightness 0.0 . :livingLampMantleChair :brightness 0.0 . :livingLampToyShelf :brightness 0.0 . :livingLampPiano :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 84.0 . } . { :frontBedPostSwitch3 :buttonState :press . } => { :loftDeskStrip :x 53.0 . } . { :frontBedPostSwitch4 :buttonState :press . } => { :loftDeskStrip :x 15.0 . } . { :frontBedPostSwitch5 :buttonState :press . } => { :loftDeskStrip :x 0.0 . } . #{ :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/beep1> . } . #{ sensor:kitchenCounterButton1 :buttonState :press . } => { # bang: :postAction <http://10.2.0.62/rpc/motor> . #} . { sensor:kitchenCounterButton1 :buttonState :press . :kitchenLight :brightness 0.0 . } => { :kitchenLight :brightness 1.0 . :kitchenCounterLight :brightness 0.5 . # and skylight rgb/rgb/set '200,255,200' } . { sensor:kitchenCounterButton1 :buttonState :press . :kitchenLight :brightness 1.0 . } => { :kitchenLight :brightness 0.0 . :kitchenCounterLight :brightness 0.0 . } . { sensor:motionGarageDoorInside :seesRecently :motion . } => { :garageOverhead :brightness 1.0 . } . { 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> . } . # { <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 . } => { :frontDoorLock :putState :unlocked . :frontDoorLock :putAgent :someStateRequest . } . {:frontDoorLock :state :locked .} => {:frontDoorOled :state :locked .}. {:frontDoorLock :state :unlocked .} => { :frontDoorOled :state :unlockNews . :frontWindow :line2 "Unlocked" . }. { :cardReader :currentRead ?card . # mailslot reader } => { :frontWindow :line1 "Card found" . }. { :cardReader :currentRead ?card . # mailslot reader # :frontDoorWindowRfid :reading ?card . # glass reader # ?card :cardText ?text . # id only ?card :owner ?agent . } => { # :frontWindow :line2 "Access granted" . :frontDoorLock :putState :unlocked . :frontDoorLock :putAgent ?agent . } . { :frontDoorOpenSwitch :buttonState :pressed . } => { :frontWindow :line3 "Open" . } . { :wallButton1 :state :pressed } => { :yay :button :b1 }. { :wallButton2 :state :pressed } => { :yay :button :b2 }. { :wallButton3 :state :pressed } => { :yay :button :b3 }. { :wallButton4 :state :pressed } => { :yay :button :b4 }.