30 lines
571 B
Python
30 lines
571 B
Python
import asyncio
|
|
|
|
from app.my_dataclasses import QINGPING_MAC
|
|
from app.qingping.service import QingpingService
|
|
|
|
|
|
async def main():
|
|
service = QingpingService(
|
|
QINGPING_MAC
|
|
)
|
|
|
|
async with service:
|
|
print("Qingping service started")
|
|
|
|
while True:
|
|
state = service.state
|
|
|
|
print(
|
|
"online:",
|
|
service.online,
|
|
"| state:",
|
|
state.to_dict()
|
|
if state
|
|
else None,
|
|
)
|
|
|
|
await asyncio.sleep(5)
|
|
|
|
|
|
asyncio.run(main()) |