topics = [ "main/fan/one", "main/fan/two", "main/printer/one", "main/printer/two", "main/lamp/one", "main/radio/one"] walkDelay = 1 baseRule = { "state": 1, "count": 1, "doMessage": 1, "delay": 30, "reset": False, "doTopic": "" } rules = { "main/printer/one": [ { "description": "Every time a printer is turned on, plan the gesture for 5 minutes later", "count": 0, # the amount of times "state": 1, # it has had this state "doTopic": "main/gesture/printer/one", # i will send to topic "doMessage": 1, # this message "delay": 60 * 5, # after this amount of seconds "reset": True, # and i should reset my count afterwards }, ], "main/printer/two": [], "main/lamp/one": [ { "description": "after the lamp has been on 2 times, another fan should be turned on", "count": 3, # the amount of times "state": 1, # it has had this state "doTopic": "main/fan/two", # i will send to topic "doMessage": 1, # this message "delay": False, # after this amount of seconds "reset": True, # and i should reset my count afterwards }, ], "main/fan/one": [ { "description": "after the fan has been on 2 times, another fan should be turned on", "count": 2, # the amount of times "state": 1, # it has had this state "doTopic": "main/fan/two", # i will send to topic "doMessage": 1, # this message "delay": False, # after this amount of seconds "reset": True, # and i should reset my count afterwards }, # { # After the fan is turned off, the next fan should be turned on # "count": 4, # the amount of times # "state": 0, # it has had this state # "doTopic": "main/fan/two", # i will send to topic # "doMessage": 1, # this message # "delay": 4, # after this amount of seconds # "reset": True, # and i should reset my count afterwards # }, # { # Turn the fan off every time after 1 minute # "count": 0, # "state": 1, # it has had this state # "doTopic": "main/fan/three", # i will send to topic # "doMessage": 0, # this message # "delay": 4, # after this amount of seconds # "reset": False, # and i should reset my count afterwards # }, # { # Every 5 minutes, do gesture X # "state": 1, # "count": 1, # "doTopic": "gesture/fan/one", # "doMessage": 1, # "delay": 5 * 60, # "reset": True # }, ], "main/fan/two": [ { "description": "after the fan has been on 2 times, another fan should be turned on", "count": 2, # the amount of times "state": 1, # it has had this state "doTopic": "main/fan/one", # i will send to topic "doMessage": 1, # this message "delay": False, # after this amount of seconds "reset": True, # and i should reset my count afterwards }, ], "main/radio/one": [ { "description": "after the radio has been on 2 times, another fan should be turned on", "count": 2, # the amount of times "state": 1, # it has had this state "doTopic": "main/fan/two", # i will send to topic "doMessage": 1, # this message "delay": 10, # after this amount of seconds "reset": True, # and i should reset my count afterwards }, ], } gestures = { "hi": { "on": "0", "off": "1", "delay": 1, "multiplier": 0.7, "range": [4, 8] } }