Mercurial > code > home > repos > homeauto
annotate service/reasoning/rules.n3 @ 1581:137ba2d6d016 0.5.0
release 0.5.0
author | drewp@bigasterisk.com |
---|---|
date | Sun, 29 Aug 2021 13:36:08 -0700 |
parents | 098ea942aefe |
children | 3c18ec6cb6ef |
rev | line source |
---|---|
129
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
1 # rules only! statements in this file will not be considered in the graph |
745eff67ad40
reasoning actions: generalize them a bit but then add a bunch of special cases for mpd for now
drewp@bigasterisk.com
parents:
118
diff
changeset
|
2 |
21 | 3 @prefix : <http://projects.bigasterisk.com/room/>. |
4 @prefix bigast: <http://bigasterisk.com/>. | |
5 @prefix dev: <http://projects.bigasterisk.com/device/>. | |
6 @prefix foaf: <http://xmlns.com/foaf/0.1/> . | |
7 @prefix env: <http://projects.bigasterisk.com/device/environment>. | |
54
42411726a7ca
screen out more values that change on every update
drewp@bigasterisk.com
parents:
31
diff
changeset
|
8 @prefix math: <http://www.w3.org/2000/10/swap/math#> . |
21 | 9 |
248 | 10 @prefix star: <http://bigasterisk.com/host/star/> . |
328 | 11 @prefix bang: <http://bigasterisk.com/host/bang/> . |
248 | 12 @prefix dash: <http://bigasterisk.com/host/dash/> . |
13 @prefix slash: <http://bigasterisk.com/host/slash/> . | |
14 | |
321
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
15 @prefix sensor: <http://bigasterisk.com/homeauto/sensor/> . |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
16 |
750 | 17 # { ?d :deviceName "drew-phone"; :connected bigast:wifiAccessPoints . } => { :auth :near :home } . |
18 # { ?d :deviceName "Kelsis-iPhone"; :connected bigast:wifiAccessPoints . } => { :auth :near :home } . | |
21 | 19 |
20 { env: :localHour 8 } => { env: :localHour :awakeTime } . | |
21 { env: :localHour 9 } => { env: :localHour :awakeTime } . | |
22 { env: :localHour 10 } => { env: :localHour :awakeTime } . | |
23 { env: :localHour 11 } => { env: :localHour :awakeTime } . | |
24 { env: :localHour 12 } => { env: :localHour :awakeTime } . | |
25 { env: :localHour 13 } => { env: :localHour :awakeTime } . | |
26 { env: :localHour 14 } => { env: :localHour :awakeTime } . | |
27 { env: :localHour 15 } => { env: :localHour :awakeTime } . | |
28 { env: :localHour 16 } => { env: :localHour :awakeTime } . | |
29 { env: :localHour 17 } => { env: :localHour :awakeTime } . | |
30 { env: :localHour 18 } => { env: :localHour :awakeTime } . | |
31 { env: :localHour 19 } => { env: :localHour :awakeTime } . | |
32 { env: :localHour 20 } => { env: :localHour :awakeTime } . | |
33 { env: :localHour 21 } => { env: :localHour :awakeTime } . | |
34 { env: :localHour 22 } => { env: :localHour :awakeTime } . | |
35 { env: :localHour 23 } => { env: :localHour :awakeTime } . | |
36 | |
753 | 37 #{ |
38 # # this won't update right, currently, since I don't let the exact | |
39 # # idle time into the rules recalculator. This threshold should be | |
40 # # applied upstream. | |
41 # | |
42 # dash:xidle :idleTimeMinutes ?idle . | |
43 # # broken with new fuxi- needs review: ?idle math:lessThan 30 . | |
44 #} => { | |
45 # :drew :at :desk . | |
46 # # the plan here is that as soon as we can show that I'm not at my | |
47 # # desk (cell phone wifi, asleep, etc), power the screen off | |
48 #} . | |
49 # | |
50 #@prefix shuttle: <http://bigasterisk.com/room/livingRoom/shuttlepro/> . | |
51 #@prefix mpd: <http://bigasterisk.com/host/slash/mpd> . | |
52 # | |
53 #{ ?button :state :press . ?button :playsMusic ?song } => { mpd: :startMusic ?song } . | |
54 ## the rest of this modeling is still a mess. Handled completely by special case in reasoning.py | |
55 #{ shuttle:button12 :state :press } => { mpd: :playState :pause } . | |
56 #{ shuttle:dial :change :clockwise } => { mpd: :audioState :volumeStepUp } . | |
57 #{ shuttle:dial :change :counterclockwise } => { mpd: :audioState :volumeStepDown } . | |
58 # | |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
59 |
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
60 |
321
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
61 { sensor:motionStorage :seesRecently :motion . } => { |
750 | 62 :storageCeilingLedCross :brightness 1.0 . |
63 :storageCeilingLedLong :brightness 1.0 . | |
181
71577a849628
new reasoning config for storage motion.
drewp@bigasterisk.com
parents:
129
diff
changeset
|
64 } . |
247 | 65 |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
66 { sensor:bedGreenButton :buttonState :press } => { |
276 | 67 :headboardWhite :brightness 0.0 . |
321
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
68 :anim1 :position :end . |
247 | 69 } . |
70 | |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
71 { sensor:bedRedButton :buttonState :press . :headboardWhite :brightness 0.0 . } => { |
284
95f72a22965d
rules become simple-looking again; fix the ambiguity in memory after loading them.
drewp@bigasterisk.com
parents:
283
diff
changeset
|
72 :headboardWhite :brightness 0.2 . |
278
4b0282900fd3
try a 2-mode rule for redButton, but this can't work as-is
drewp@bigasterisk.com
parents:
277
diff
changeset
|
73 } . |
4b0282900fd3
try a 2-mode rule for redButton, but this can't work as-is
drewp@bigasterisk.com
parents:
277
diff
changeset
|
74 |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
75 { sensor:bedRedButton :buttonState :press . :headboardWhite :brightness 0.2 . } => { |
750 | 76 :headboardWhite :brightness 1.0 . |
254
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
77 } . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
78 |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
79 @prefix sensor: <http://bigasterisk.com/homeauto/sensor/> . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
80 { sensor:buttonAriBed :buttonState :press } => { |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
81 :starTrekLight :brightness 0.0 . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
82 } . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
83 |
277
960a587e51d7
updates to changingtable motion rules
drewp@bigasterisk.com
parents:
276
diff
changeset
|
84 { sensor:motionChanging :seesRecently30 :noMotion } => { |
254
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
85 :changingWhite :brightness 0.0 . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
86 } . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
87 |
277
960a587e51d7
updates to changingtable motion rules
drewp@bigasterisk.com
parents:
276
diff
changeset
|
88 { sensor:motionChanging :seesRecently30 :motion } => { |
960a587e51d7
updates to changingtable motion rules
drewp@bigasterisk.com
parents:
276
diff
changeset
|
89 :changingWhite :brightness 0.3 . |
254
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
90 } . |
ba1149814877
pi device support for motionStart edge trigger
drewp@bigasterisk.com
parents:
251
diff
changeset
|
91 |
321
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
92 { sensor:motionChanging :sees :motionStart90 . dev:calendar :twilight :daytime .} => { |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
93 :changingCam :grab <http://bang:9057/changing-day.jpg> . |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
94 } . |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
95 |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
96 { sensor:motionChanging :sees :motionStart90 . dev:calendar :twilight :withinTwilight .} => { |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
97 :changingCam :grab <http://bang:9057/changing-night.jpg> . |
264 | 98 } . |
99 | |
100 { :bookSwitch :buttonState :press . :livingRoomLamp1 :brightness 0.0 . } => { | |
284
95f72a22965d
rules become simple-looking again; fix the ambiguity in memory after loading them.
drewp@bigasterisk.com
parents:
283
diff
changeset
|
101 :livingRoomLamp1 :brightness 1.0 . |
95f72a22965d
rules become simple-looking again; fix the ambiguity in memory after loading them.
drewp@bigasterisk.com
parents:
283
diff
changeset
|
102 :livingRoomLamp2 :brightness 1.0 . |
750 | 103 :livingRoomLamp3 :brightness 1.0 . |
284
95f72a22965d
rules become simple-looking again; fix the ambiguity in memory after loading them.
drewp@bigasterisk.com
parents:
283
diff
changeset
|
104 } . |
264 | 105 { :bookSwitch :buttonState :press . :livingRoomLamp1 :brightness 1.0 . } => { |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
106 :livingRoomLamp1 :brightness 0.0 . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
107 :livingRoomLamp2 :brightness 0.0 . |
750 | 108 :livingRoomLamp3 :brightness 0.0 . |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
109 } . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
110 |
750 | 111 # { :frontBedPostSwitch1 :buttonState :press . :starTrekLight :brightness 0.0 . } => { |
112 # :starTrekLight :brightness 1.0 . | |
113 # } . | |
114 # { :frontBedPostSwitch1 :buttonState :press . :starTrekLight :brightness 1.0 . } => { | |
115 # :starTrekLight :brightness 0.0 . | |
116 # } . | |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
117 |
598 | 118 { :frontBedPostSwitch1 :buttonState :press . } => { :loftDeskStrip :x 99.0 |
119 . } . | |
750 | 120 { :frontBedPostSwitch2 :buttonState :press . } => { :loftDeskStrip :x 84.0 |
598 | 121 . } . |
750 | 122 { :frontBedPostSwitch3 :buttonState :press . } => { :loftDeskStrip :x 53.0 |
598 | 123 . } . |
750 | 124 { :frontBedPostSwitch4 :buttonState :press . } => { :loftDeskStrip :x 15.0 |
598 | 125 . } . |
126 { :frontBedPostSwitch5 :buttonState :press . } => { :loftDeskStrip :x 0.0 . } . | |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
127 |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
128 #{ :change :down . } => { star:slideshow :postAction <http://brace:9049/effects/beep1> . } . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
129 #{ sensor:kitchenCounterButton1 :buttonState :press . } => { |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
130 # bang: :postAction <http://10.2.0.62/rpc/motor> . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
131 #} . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
132 |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
133 { sensor:kitchenCounterButton1 :buttonState :press . :kitchenLight :brightness 0.0 . } => { |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
134 :kitchenLight :brightness 1.0 . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
135 :kitchenCounterLight :brightness 0.5 . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
136 # and skylight rgb/rgb/set '200,255,200' |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
137 } . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
138 { sensor:kitchenCounterButton1 :buttonState :press . :kitchenLight :brightness 1.0 . } => { |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
139 :kitchenLight :brightness 0.0 . |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
140 :kitchenCounterLight :brightness 0.0 . |
284
95f72a22965d
rules become simple-looking again; fix the ambiguity in memory after loading them.
drewp@bigasterisk.com
parents:
283
diff
changeset
|
141 } . |
276 | 142 |
284
95f72a22965d
rules become simple-looking again; fix the ambiguity in memory after loading them.
drewp@bigasterisk.com
parents:
283
diff
changeset
|
143 |
321
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
144 { <http://bigasterisk.com/homeauto/sensor/motionGarageDoorInside> :seesRecently :motion . } => { |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
145 :garageOverhead :brightness 1.0 . |
321
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
146 } . |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
147 |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
148 { sensor:motionBed :sees :motion . } => { :anim1 :playback :start . } . |
79efb6fdcb95
rules updates for storage and changing
drewp@bigasterisk.com
parents:
284
diff
changeset
|
149 |
328 | 150 |
598 | 151 { sensor:motionFrontDoorInside :seesRecently30 :motion } => { |
750 | 152 <http://bigasterisk.com/host/frontdoor/monitor> :powerState "on" . |
328 | 153 } . |
154 | |
392
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
155 |
79d041273e26
mqtt has two devices now. various older cleanups.
drewp@bigasterisk.com
parents:
328
diff
changeset
|
156 |
328 | 157 { <http://projects.bigasterisk.com/room/remoteButton/KEY_POWER> :state :press } => { |
750 | 158 #star:slideshow :postAction <http://dash:9049/effects/question> . |
159 bang: :postAction <http://10.2.0.62/rpc/motor> . | |
328 | 160 } . |
483 | 161 |
750 | 162 # { <http://bigasterisk.com/homeauto/sensor/tempHumidKitchen> :temperatureF ?t . |
163 # <http://bigasterisk.com/homeauto/thermostatSetTemp> :temperatureF ?setTemp . | |
164 # ?t math:lessThan ?setTemp . | |
165 # } => { | |
166 # :fakeHeater :state :on . | |
167 # } . | |
485 | 168 |
483 | 169 { :frontDoorLockRequest :state :unlocked . |
170 } => { | |
171 :frontDoorLock :putState :unlocked . | |
172 :frontDoorLock :putAgent :someStateRequest . | |
173 } . | |
174 | |
175 {:frontDoorLock :state :locked .} => {:frontDoorOled :state :locked .}. | |
598 | 176 {:frontDoorLock :state :unlocked .} => { |
177 :frontDoorOled :state :unlockNews . | |
178 :frontWindow :line2 "Unlocked" . | |
179 }. | |
483 | 180 |
181 { | |
598 | 182 :cardReader :currentRead ?card . # mailslot reader |
183 } => { | |
184 :frontWindow :line1 "Card found" . | |
185 }. | |
186 | |
187 { | |
188 :cardReader :currentRead ?card . # mailslot reader | |
189 # :frontDoorWindowRfid :reading ?card . # glass reader | |
190 # ?card :cardText ?text . # id only | |
483 | 191 ?card :owner ?agent . |
192 } => { | |
598 | 193 # :frontWindow :line2 "Access granted" . |
483 | 194 :frontDoorLock :putState :unlocked . |
195 :frontDoorLock :putAgent ?agent . | |
196 } . | |
598 | 197 |
198 { | |
199 :frontDoorOpenSwitch :buttonState :pressed . | |
200 } => { | |
201 :frontWindow :line3 "Open" . | |
202 } . | |
203 |