|
@@ -16,14 +16,10 @@ def print_bar(value, start, end, unit):
|
16
|
16
|
print("{}{} -> {}{} -> {}{}".format(start, unit, value, unit, end, unit))
|
17
|
17
|
|
18
|
18
|
def sleep(t):
|
19
|
|
- w = terminal_width
|
20
|
|
- if t < w:
|
21
|
|
- w = int(t)
|
22
|
|
- print_bar(0, 0, w, "s")
|
23
|
|
- for i in range(0, w):
|
24
|
|
- time.sleep(t / w)
|
25
|
|
- print_bar(i + 1, 0, w, "s")
|
26
|
|
- print()
|
|
19
|
+ print_bar(0, 0, t, "s")
|
|
20
|
+ for i in range(0, t):
|
|
21
|
+ time.sleep(1.0)
|
|
22
|
+ print_bar(i + 1, 0, t, "s")
|
27
|
23
|
|
28
|
24
|
async def wait_for_temp(client, temp):
|
29
|
25
|
print("Setting temperature {}".format(temp))
|
|
@@ -56,21 +52,24 @@ async def flow(client):
|
56
|
52
|
print("Turning on heater")
|
57
|
53
|
await set_state(client, (True, False))
|
58
|
54
|
|
59
|
|
- await flow_step(client, 190.0, 20.0, 5.0)
|
60
|
|
- await flow_step(client, 205.0, 10.0, 20.0)
|
61
|
|
- await flow_step(client, 220.0, 10.0, 20.0)
|
|
55
|
+ await flow_step(client, 190.0, 20.0, 5.0 - 4.9)
|
|
56
|
+ await flow_step(client, 205.0, 10.0, 20.0 - 7)
|
|
57
|
+ await flow_step(client, 220.0, 10.0, 20.0 - 7)
|
62
|
58
|
|
63
|
|
- print("Notification by pumping three times...")
|
64
|
|
- for i in range(0, 3):
|
65
|
|
- time.sleep(1.0)
|
66
|
|
- await set_state(client, (True, True)) # turn on pump
|
67
|
|
- time.sleep(1.0)
|
68
|
|
- await set_state(client, (True, False)) # turn off pump
|
|
59
|
+ #print("Notification by pumping three times...")
|
|
60
|
+ #for i in range(0, 3):
|
|
61
|
+ # time.sleep(1.0 / 3)
|
|
62
|
+ # await set_state(client, (True, True)) # turn on pump
|
|
63
|
+ # time.sleep(1.0 / 3)
|
|
64
|
+ # await set_state(client, (True, False)) # turn off pump
|
69
|
65
|
|
70
|
66
|
print("Turning heater off")
|
71
|
67
|
await set_state(client, (False, False)) # turn off heater and pump
|
72
|
68
|
|
73
|
|
-if __name__ == "__main__":
|
|
69
|
+ print("Setting temperature back to 190")
|
|
70
|
+ await set_target_temp(client, 190.0)
|
|
71
|
+
|
|
72
|
+if True:#__name__ == "__main__":
|
74
|
73
|
async def main(address):
|
75
|
74
|
client = await ble_conn(address)
|
76
|
75
|
|