-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·34 lines (25 loc) · 726 Bytes
/
Copy pathmain.py
File metadata and controls
executable file
·34 lines (25 loc) · 726 Bytes
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import json
from TogglDelegate import TogglDelegate
from zei.Zei import Zei
from zei.ZeiDiscovery import ZeiDiscovery
import logging
_log = logging.getLogger(__name__)
_log.addHandler(logging.StreamHandler())
_log.setLevel(logging.INFO)
def main():
config = json.load(open("./config.json", "r"))
zei = Zei(config["zei"]["mac"], "random", iface=0)
zei.withDelegate(TogglDelegate(zei, config))
scanner = ZeiDiscovery(zei)
while True:
try:
zei.waitForNotifications(timeout=None)
except Exception as e:
_log.exception(e)
scanner.reconnect()
zei.disconnect()
if __name__ == "__main__":
main()