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())
Development
Example script for Linux how to run everything.
git clone https://github.com/CorantGmbH/aioairq
cd aioairq
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
pip install -e ".[dev]"
vim hello-air-q.py
python hello-air-q.py
Testing
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
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