File: smartbridge.py

package info (click to toggle)
python-gridnet 5.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 632 kB
  • sloc: python: 302; makefile: 8; sh: 5
file content (23 lines) | stat: -rw-r--r-- 635 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
# pylint: disable=W0621
"""Asynchronous Python client for a NET2GRID device."""

import asyncio

from gridnet import GridNet, SmartBridge


async def main() -> None:
    """Test smartbridge output."""
    async with GridNet(
        host="127.0.0.1",
    ) as gridnet:
        smartbridge: SmartBridge = await gridnet.smartbridge()
        print(smartbridge)
        print()
        print(f"Power flow: {smartbridge.power_flow}")
        print(f"Energy consumption: {smartbridge.energy_consumption_total}")
        print(f"Energy production: {smartbridge.energy_production_total}")


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