File: phases.py

package info (click to toggle)
python-p1monitor 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 512 kB
  • sloc: python: 571; makefile: 8; sh: 5
file content (35 lines) | stat: -rw-r--r-- 1,331 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# pylint: disable=W0621
"""Asynchronous Python client for the P1 Monitor API."""

import asyncio

from p1monitor import P1Monitor, Phases


async def main() -> None:
    """Show example on getting P1 Monitor data."""
    async with P1Monitor(host="127.0.0.1") as client:
        phases: Phases = await client.phases()

        print(phases)
        print()
        print("--- P1 Monitor | Phases ---")
        print(f"Voltage Phase L1: {phases.voltage_phase_l1}")
        print(f"Voltage Phase L2: {phases.voltage_phase_l2}")
        print(f"Voltage Phase L3: {phases.voltage_phase_l3}")
        print()
        print(f"Current Phase L1: {phases.current_phase_l1}")
        print(f"Current Phase L2: {phases.current_phase_l2}")
        print(f"Current Phase L3: {phases.current_phase_l3}")
        print()
        print(f"Power Consumed Phase L1: {phases.power_consumed_phase_l1}")
        print(f"Power Consumed Phase L2: {phases.power_consumed_phase_l2}")
        print(f"Power Consumed Phase L3: {phases.power_consumed_phase_l3}")
        print()
        print(f"Power Produced Phase L1: {phases.power_produced_phase_l1}")
        print(f"Power Produced Phase L2: {phases.power_produced_phase_l2}")
        print(f"Power Produced Phase L3: {phases.power_produced_phase_l3}")


if __name__ == "__main__":
    asyncio.run(main())