listeningdaemon/rule-listener/data.py
2024-11-03 12:04:27 +01:00

157 lines
6.2 KiB
Python

topics = [
"main/fan/one",
"main/fan/two",
"main/printer/one",
"main/printer/two",
"main/lamp/one",
"main/radio/one"]
config = {
"delay": 1,
"probability": 0.8
}
rules = {
"main/printer/one": [
{
"description": "Every time a printer is turned on, make it move 5 minutes later",
"count": 0, # the amount of times
"state": 1, # it has had this state
"doTopic": "main/printer/one", # i will send to topic
"doMessage": 2, # this message
"delay": 60 * 2, # after this amount of seconds
"reset": True, # and i should reset my count afterwards
},
{
"description": "The third time a printer is turned on, change the overall delay",
"count": 0, # the amount of times
"state": 1, # it has had this state
"doTopic": "main/config/delay", # i will send to topic
"doMessage": 45, # this message
"delay": 0, # after this amount of seconds
"reset": True, # and i should reset my count afterwards
},
],
"main/printer/two": [
{
"description": "Every time a printer is turned on, make it move 5 minutes later",
"count": 0, # the amount of times
"state": 1, # it has had this state
"doTopic": "main/printer/two", # i will send to topic
"doMessage": 2, # this message
"delay": 55 * 2, # after this amount of seconds
"reset": True, # and i should reset my count afterwards
},
{
"description": "The third time a printer is turned off, change the overall delay",
"count": 3, # the amount of times
"state": 0, # it has had this state
"doTopic": "main/config/delay", # i will send to topic
"doMessage": 2, # this message
"delay": 0, # after this amount of seconds
"reset": True, # and i should reset my count afterwards
},
],
"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
},
{
"description": "Every time this lamp is turned on, make turn it on again 5 minutes later",
"count": 0, # the amount of times
"state": 1, # it has had this state
"doTopic": "main/lamp/one", # i will send to topic
"doMessage": 1, # this message
"delay": 50 * 2, # 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
},
{
"description": "Always turn the other fan off when this fan is turned on",
"count": 0, # 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": 5, # after this amount of seconds
"reset": True, # and i should reset my count afterwards
},
{
"description": "Always turn this fan on after 5 minutes",
"count": 0, # 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": 45 * 2, # after this amount of seconds
"reset": True, # and i should reset my count afterwards
}
],
"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
},
{
"description": "Always turn this fan on after 5 minutes",
"count": 0, # 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": 40 * 2, # 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
},
{
"description": "Always turn this fan on after 5 minutes",
"count": 0, # the amount of times
"state": 1, # it has had this state
"doTopic": "main/radio/one", # i will send to topic
"doMessage": 1, # this message
"delay": 35 * 2, # 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]
}
}