2018-12-11 22:42:13 +01:00
|
|
|
import knx
|
|
|
|
import time
|
|
|
|
import sys
|
|
|
|
|
2018-12-22 14:53:31 +01:00
|
|
|
def updated(g1):
|
|
|
|
print(g1.value)
|
|
|
|
|
2018-12-11 22:42:13 +01:00
|
|
|
print("start")
|
2018-12-22 01:55:08 +01:00
|
|
|
gos = knx.GroupObjectList()
|
|
|
|
gos.append(knx.GroupObject(2))
|
|
|
|
gos.append(knx.GroupObject(2))
|
|
|
|
gos.append(knx.GroupObject(2))
|
|
|
|
gos.append(knx.GroupObject(1))
|
|
|
|
curr = gos[0]
|
2018-12-22 14:53:31 +01:00
|
|
|
min = gos[1]
|
|
|
|
max = gos[2]
|
|
|
|
reset = gos[3]
|
|
|
|
reset.callBack(updated)
|
|
|
|
|
2018-12-22 01:55:08 +01:00
|
|
|
knx.RegisterGroupObjects(gos)
|
|
|
|
knx.Start()
|
2018-12-11 22:42:13 +01:00
|
|
|
while True:
|
|
|
|
time.sleep(1)
|
|
|
|
cmd = sys.stdin.read(1)
|
|
|
|
if cmd == 'q':
|
|
|
|
break
|
|
|
|
elif cmd == 'p':
|
|
|
|
currentMode = knx.ProgramMode(not knx.ProgramMode())
|
|
|
|
print("set programming mode to " + str(currentMode))
|
2018-12-22 01:55:08 +01:00
|
|
|
elif cmd == 'w':
|
|
|
|
cmd = sys.stdin.read(4)
|
|
|
|
value = float(cmd)
|
|
|
|
curr.objectWrite(value)
|
|
|
|
print("wrote " + str(value) + " to curr")
|
2018-12-11 22:42:13 +01:00
|
|
|
print("end")
|