-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanager.py
40 lines (29 loc) · 1.07 KB
/
manager.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
import asyncio
import json
from xknx import XKNX
from xknx.io import ConnectionConfig, ConnectionType
from core.ups import UPS
async def telegram_received_cb(telegram):
print("Telegram received: {0}".format(telegram))
async def main():
# rasbery py 192.168.1.233
xknx = XKNX(
daemon_mode=True,
connection_config=ConnectionConfig(
connection_type=ConnectionType.TUNNELING,
gateway_ip="192.168.1.9", gateway_port=3671,
local_ip="192.168.1.233")
)
with open("configuration/config.json") as f:
json_configuration = json.load(f)
ups1 = UPS(xknx=xknx, name='UPS1', config_json=json_configuration)
# # ups2 = UPS(xknx=xknx, name='UPS2', config_json=json_configuration['UPS2'])
# # ups3 = UPS(xknx=xknx, name='UPS3', config_json=json_configuration['UPS3'])
#
await ups1.initialize()
# # await ups2.initialize()
# # await ups3.initialize()
await xknx.start()
await xknx.stop()
asyncio.run(main())
# cd "/home/pi/Desktop/Calugareni/XKNK-Automatisation" && python manager.py &