Giter Site home page Giter Site logo

leospol / aioaseko Goto Github PK

View Code? Open in Web Editor NEW

This project forked from milanmeu/aioaseko

0.0 0.0 0.0 26 KB

Async Python package for the Aseko Pool Live API

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

License: GNU Lesser General Public License v3.0

Python 100.00%

aioaseko's Introduction

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, "[email protected]", "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, "[email protected]", "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())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.