/
initializer.py
57 lines (35 loc) · 1.27 KB
/
initializer.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
"""
Polyglot v3 node server OpenSprinkler
Copyright (C) 2021 Javier Refuerzo
"""
import udi_interface
import sys
from nodes.controller.controller import Controller
LOGGER = udi_interface.LOGGER
# class waitingToStart():
# def __init__(self, polyglot):
# self.poly = polyglot
# polyglot.subscribe(polyglot.START, self.start)
# def start(self):
# LOGGER.info(' start called')
# self.poly.setCustomParamsDoc()
# # Not necessary to call this since profile_version is used from server.json
# self.poly.updateProfile()
# # start processing events and create or add our controller node
# polyglot.ready()
# # Create the controller node
# Controller(polyglot=polyglot)
if __name__ == "__main__":
LOGGER.info('__name__ == "__main__" init called')
try:
polyglot = udi_interface.Interface([])
polyglot.start()
# # Create the controller node
Controller(polyglot=polyglot)
# waitingToStart(polyglot)
# Just sit and wait for events
polyglot.runForever()
except (KeyboardInterrupt, SystemExit):
LOGGER.info(' -JAVI - Error Occured. Most likley this is not on Polisy')
sys.exit(0)