Skip to main content

Asynchronous library to retrieve data from air-Q devices.

Project description

PyPI pyversions PyPI downloads

PyPI package aioairq

Python library for asynchronous data access to local air-Q devices.

Retrieve data from air-Q

At its present state, AirQ requires an aiohttp session to be provided by the user:

import asyncio
import aiohttp
from aioairq import AirQ

ADDRESS = "123ab_air-q.local"
PASSWORD = "airqsetup"

async def main():
    async with aiohttp.ClientSession() as session:
        airq = AirQ(ADDRESS, PASSWORD, session)

        config = await airq.config
        print(f"Available sensors: {config['sensors']}")

        data = await airq.data
        print(f"Momentary data: {data}")

asyncio.run(main())

Logging

Since version 0.4.4, aioairq supports a very verbose logging at the DEBUG level, especially in AirQ.get_latest_data method, which can cache the previous data and log the difference between the latest and the previous sensor readings. Note that this caching and difference calculation does not happen when the logging is set up to a higher level than DEBUG, incurring no additional overhead when not requested.

Development

Example script for Linux how to run everything.

# Checkout the repository
git clone https://github.com/CorantGmbH/aioairq
cd aioairq

# Create a virtual environment
#
# We assume that your system has Python in version 3.9 or higher installed
# and accessible via `python3`. 
# - If this command is not found or references an older version, consult your distribution.
# - Depending on the distribution, you may need to install an additional package, e.g. `python3-venv`.
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -e .
# Optionally, you may install developmental dependencies
# which include testing, linting/formatting, and pre-commit
pip install -e ".[dev]" # if errors, see below

# You can now create a script (see example above) and run it
vim hello-air-q.py
python hello-air-q.py

Testing

# If you get an error message about incompatible version, when attempting
# pip install -e ".[dev]", you may try to install the packages separately:
#
# pip install pytest
# pip install pytest-asyncio

# Prepare an environment file
# (You don't want to type your passwords into the shell)
cat <<EOF >.env
export AIRQ_IP=192.168.168.42
export AIRQ_PASS=12345678
export AIRQ_MDNS=abcde_air-q.local
export AIRQ_HOSTNAME=air-q-livingroom
EOF

# Run the tests
source .env
pytest

Contributing

This repository uses pre-commit primarily to ensure linting and formatting using Ruff (besides codespell and yamlling). If you want to commit changes to this repository, make sure you have pre-commit installed (included among the dev extras). Then initialise the git hooks by running

pre-commit install

Once successfully installed, ruff git hook will be triggered upon git commit and it will lint and try to fix the code you are about to commit. Should any changes be made, the commit will be aborted and you will need to address the lints and stage the modified files to your commit before trying again.

Linting

Ruff's rule list is far less exhaustive than that of pylint, so if you want, you can gain additional insight by running pylint (not installed as a part of the dev extras).

pip install pylint
pylint aioairq/*.py

Once done, you may leave the virtual environment

deactivate

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioairq-0.4.7.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aioairq-0.4.7-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file aioairq-0.4.7.tar.gz.

File metadata

  • Download URL: aioairq-0.4.7.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.11

File hashes

Hashes for aioairq-0.4.7.tar.gz
Algorithm Hash digest
SHA256 8729450f6d1bcd9da9abb5ca3ab0e45f92fc414c06f2b09b1812c385de4efa7f
MD5 4d57118a545b7db92e97e91d6315bb79
BLAKE2b-256 8c04bf3513ae174040a98aafc390e0d689801f8d562165ecb1ef3471a0af8c82

See more details on using hashes here.

File details

Details for the file aioairq-0.4.7-py3-none-any.whl.

File metadata

  • Download URL: aioairq-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.11

File hashes

Hashes for aioairq-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9df4cc88ca9e20893222a29dce910dc9cd768d543fae97c94ac496ca53e91a5a
MD5 4be1d4fc92add29c2611d3ff5a7db2c4
BLAKE2b-256 fe91e5c3320aa3ce017abec6489e549589e1368538fdd431412a43281d52aad0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page