work: добавил автоматический режим
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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())
|
||||
Reference in New Issue
Block a user