-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (27 loc) · 1.01 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import asyncio
import logging
from logging.handlers import RotatingFileHandler
from components.basebridge import BaseBridge
from components.controller import Controller
from components.picklepersistence import PicklePersistence
try:
from components.rpigpiobridge import RPiGPIOBridge
bridge: BaseBridge = RPiGPIOBridge(rgb_clock=3, rgb_data=2, white_clock=6, white_data=5)
except ImportError:
from components.mutebridge import MuteBridge
bridge = MuteBridge()
logging.basicConfig(
handlers=[RotatingFileHandler("./led-alarm.log", maxBytes=100000, backupCount=10)],
level=logging.WARNING,
format="[%(asctime)s] %(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s",
datefmt="%Y-%m-%dT%H:%M:%S",
)
logging.getLogger("apscheduler").setLevel(logging.DEBUG)
async def main() -> None:
controller = Controller(
bridge=bridge,
persistence=PicklePersistence("persistence.pickle"),
)
await controller.run(host="0.0.0.0")
if __name__ == "__main__":
asyncio.run(main())