listeningdaemon/rule-listener/data.py

113 lines
3.8 KiB
Python
Raw Normal View History

2024-11-02 17:33:01 +00:00
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": ""
}
2024-10-28 22:32:02 +00:00
rules = {
2024-11-02 17:33:01 +00:00
"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
2024-10-28 22:32:02 +00:00
},
2024-11-02 17:33:01 +00:00
],
"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
2024-10-28 22:32:02 +00:00
},
2024-11-02 17:33:01 +00:00
],
"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
2024-10-28 22:32:02 +00:00
},
2024-11-02 17:33:01 +00:00
# { # 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
2024-10-28 22:32:02 +00:00
},
2024-11-02 17:33:01 +00:00
],
"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
},
],
2024-10-28 22:32:02 +00:00
}
2024-10-31 16:45:52 +00:00
gestures = {
"hi": {
"on": "0",
"off": "1",
"delay": 1,
"multiplier": 0.7,
"range": [4, 8]
}
2024-11-02 17:33:01 +00:00
}