leospol / aioaseko

Async Python package for the Aseko Pool Live API

Home Page:https://pypi.org/project/aioaseko/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aioAseko package

PyPI PyPI - Downloads PyPI - License

An async Python wrapper for the Aseko Pool Live API.

The library is currently limited to the features available on pool.aseko.com.

Account

The library provides a MobileAccount and WebAccount class to make authenticated requests to the mobile and web API, respectively. In this version of aioAseko, WebAccount can only be used to obtain AccountInfo and retrieve the account units. The mobile API does not provide AccountInfo, so MobileAccount.login() will return None.

Installation

pip install aioaseko

Usage

Import

from aioaseko import MobileAccount

Create a aiohttp.ClientSession to make requests

from aiohttp import ClientSession
session = ClientSession()

Create a MobileAccount instance and login

account = MobileAccount(session, "aioAseko@example.com", "passw0rd")
await account.login()

Example

from aiohttp import ClientSession
from asyncio import run

import aioaseko

async def main():
    async with ClientSession() as session:
        account = aioaseko.MobileAccount(session, "aioAseko@example.com", "passw0rd")
        try:
            await account.login()
        except aioaseko.InvalidAuthCredentials:
            print("The username or password you entered is wrong.")
            return
        units = await account.get_units()
        for unit in units:
            print(unit.name)
            await unit.get_state()
            print(f"Water flow: {unit.water_flow}")
            for variable in unit.variables:
                print(variable.name, variable.current_value, variable.unit)
        await account.logout()
run(main())

About

Async Python package for the Aseko Pool Live API

https://pypi.org/project/aioaseko/

License:GNU Lesser General Public License v3.0


Languages

Language:Python 100.0%