| 1 |
import asyncio |
| 2 |
|
| 3 |
from aioacaia import AcaiaScale |
| 4 |
|
| 5 |
|
| 6 |
async def main() -> None: |
| 7 |
with open("mac.txt", encoding="utf-8") as mac_file: |
| 8 |
mac = mac_file.read().strip() |
| 9 |
|
| 10 |
scale = AcaiaScale(address_or_ble_device=mac) |
| 11 |
await scale.connect() |
| 12 |
try: |
| 13 |
await asyncio.sleep(300) |
| 14 |
|
| 15 |
await asyncio.sleep(1) |
| 16 |
print("starting Timer...") |
| 17 |
await scale.start_stop_timer() |
| 18 |
|
| 19 |
await asyncio.sleep(21) |
| 20 |
|
| 21 |
print("stopping Timer...") |
| 22 |
await scale.start_stop_timer() |
| 23 |
|
| 24 |
await asyncio.sleep(5) |
| 25 |
print("resetting Timer...") |
| 26 |
await scale.reset_timer() |
| 27 |
await asyncio.sleep(5) |
| 28 |
print("starting Timer...") |
| 29 |
await scale.start_stop_timer() |
| 30 |
await asyncio.sleep(30) |
| 31 |
print("stopping Timer...") |
| 32 |
await scale.start_stop_timer() |
| 33 |
finally: |
| 34 |
await scale.disconnect() |
| 35 |
|
| 36 |
|
| 37 |
asyncio.run(main()) |