listeningdaemon/rule-listener/data.py

157 lines
6.2 KiB
Python
Raw Permalink 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"]
2024-11-03 11:04:27 +00:00
config = {
"delay": 1,
"probability": 0.8
2024-11-02 17:33:01 +00:00
}
2024-10-28 22:32:02 +00:00
rules = {
2024-11-02 17:33:01 +00:00
"main/printer/one": [
{
2024-11-03 11:04:27 +00:00
"description": "Every time a printer is turned on, make it move 5 minutes later",
2024-11-02 17:33:01 +00:00
"count": 0, # the amount of times
"state": 1, # it has had this state
2024-11-03 11:04:27 +00:00
"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
2024-11-02 17:33:01 +00:00
"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/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-03 11:04:27 +00:00
{
"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
}
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-03 11:04:27 +00:00
{
"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
}
2024-11-02 17:33:01 +00:00
],
"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-03 11:04:27 +00:00
{
"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
}
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-11-03 11:04:27 +00:00
{
"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
}
2024-11-02 17:33:01 +00:00
],
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
}