32 lines
554 B
Python
32 lines
554 B
Python
import asyncio
|
|
import json
|
|
|
|
from app.qingping.service import QingpingService
|
|
|
|
|
|
async def main():
|
|
service = QingpingService(
|
|
host="192.168.7.3",
|
|
port=1883,
|
|
mac="CCB5D131BA93",
|
|
)
|
|
|
|
await service.start()
|
|
|
|
try:
|
|
while True:
|
|
await asyncio.sleep(15)
|
|
|
|
print(
|
|
json.dumps(
|
|
service.status(),
|
|
indent=2,
|
|
ensure_ascii=False,
|
|
)
|
|
)
|
|
|
|
finally:
|
|
await service.stop()
|
|
|
|
|
|
asyncio.run(main()) |