-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdebug.py
49 lines (35 loc) · 1.17 KB
/
debug.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
import opentherm_app
from opentherm_rp2 import opentherm_exchange
import time
async def readtest(a, b):
print(await opentherm_exchange(opentherm_app.MSG_TYPE_READ_DATA, a, b))
async def writetest(a, b):
print(await opentherm_exchange(opentherm_app.MSG_TYPE_WRITE_DATA, a, b))
async def status():
while True:
try:
print(await opentherm_app.status_exchange())
except Exception as ex:
print("error", ex)
time.sleep(1)
async def status_ch():
while True:
try:
print(await opentherm_app.status_exchange(ch_enabled=True, dhw_enabled=True))
except Exception as ex:
print("error", ex)
time.sleep(1)
async def scan():
for i in range(0, 256):
while True:
try:
msg_type, data_id, data_value = await opentherm_exchange(opentherm_app.MSG_TYPE_READ_DATA, i, 0, debug=False)
if msg_type == opentherm_app.MSG_TYPE_READ_ACK:
print("OK", data_id, hex(data_value))
break
except:
time.sleep(1)
time.sleep(1)
import debug
import asyncio
asyncio.run(debug.readtest(0, 0))