File: inverters.py

package info (click to toggle)
python-autarco 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 808 kB
  • sloc: python: 742; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,047 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
36
37
38
"""Asynchronous Python client for the Autarco API."""

import asyncio

from autarco import AccountSite, Autarco


async def main() -> None:
    """Show example on getting Autarco - inverters data."""
    async with Autarco(
        email="test@autarco.com",
        password="password",
    ) as client:
        account_sites: list[AccountSite] = await client.get_account()
        inverters = await client.get_inverters(account_sites[0].public_key)
        power = await client.get_power_statistics(
            account_sites[0].public_key,
            query_range="day",
        )
        energy = await client.get_energy_statistics(
            account_sites[0].public_key,
            query_range="month",
        )

        print("--- INVERTERS ---")
        print(inverters)
        print()

        print("--- POWER STATS ---")
        print(power.generate_power_stats_inverter)
        print()

        print("--- ENERGY STATS ---")
        print(energy.generate_energy_stats_inverter)


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