File: watermeter.py

package info (click to toggle)
python-p1monitor 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 536 kB
  • sloc: python: 571; makefile: 3
file content (23 lines) | stat: -rw-r--r-- 667 bytes parent folder | download | duplicates (2)
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())