-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathwatermeter.py
More file actions
23 lines (16 loc) · 667 Bytes
/
Copy pathwatermeter.py
File metadata and controls
23 lines (16 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# pylint: disable=W0621
"""Asynchronous Python client for the P1 Monitor API."""
import asyncio
from p1monitor import P1Monitor, WaterMeter
async def main() -> None:
"""Show example on getting P1 Monitor data."""
async with P1Monitor(host="127.0.0.1") as client:
watermeter: WaterMeter = await client.watermeter()
print(watermeter)
print()
print("--- P1 Monitor | WaterMeter ---")
print(f"Consumption Day: {watermeter.consumption_day}")
print(f"Consumption Total: {watermeter.consumption_total}")
print(f"Pulse Count: {watermeter.pulse_count}")
if __name__ == "__main__":
asyncio.run(main())