Python wrapper for getting air quality data from Nettigo Air Monitor devices.
Project description
nettigo-air-monitor
Python wrapper for getting air quality data from Nettigo Air Monitor devices.
How to use package
"""An example of using Nettigo Air Monitor package."""
import asyncio
import logging
from aiohttp import ClientConnectorError, ClientError, ClientSession
from nettigo_air_monitor import (
ApiError,
AuthFailedError,
ConnectionOptions,
InvalidSensorDataError,
NettigoAirMonitor,
)
logging.basicConfig(level=logging.DEBUG)
HOST = "nam"
USERNAME = "user"
PASSWORD = "password"
async def main():
"""Run main function."""
options = ConnectionOptions(host=HOST, username=USERNAME, password=PASSWORD)
async with ClientSession() as websession:
nam = await NettigoAirMonitor.create(websession, options)
try:
data = await nam.async_update()
mac = await nam.async_get_mac_address()
except (
ApiError,
AuthFailedError,
ClientConnectorError,
ClientError,
InvalidSensorDataError,
asyncio.TimeoutError,
) as error:
print(f"Error: {error}")
else:
print(f"Auth enabled: {nam.auth_enabled}")
print(f"Firmware: {nam.software_version}")
print(f"MAC address: {mac}")
print(f"Data: {data}")
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nettigo_air_monitor-3.1.0.tar.gz
(12.2 kB
view details)
Built Distribution
File details
Details for the file nettigo_air_monitor-3.1.0.tar.gz
.
File metadata
- Download URL: nettigo_air_monitor-3.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6a3b4588ff75cb9db00d1605a702ea200c8c49c1e6ca3d13a9b0b4ec67de04e |
|
MD5 | 08258b625437d44026adba5be92ef112 |
|
BLAKE2b-256 | 391fbd69fdb59387bfa4eed283f3ded2f007c1422e13bc2f22f24d92cae2ba0a |
File details
Details for the file nettigo_air_monitor-3.1.0-py3-none-any.whl
.
File metadata
- Download URL: nettigo_air_monitor-3.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e0a78f8f08dd1204a013345ccd4b588be0e7b6ca8514d15a377e684135dc820 |
|
MD5 | 28b44310529f1d6822fd9ed5b7a4d460 |
|
BLAKE2b-256 | 64ebd8d3c2ab8c2ec87fe525b694696d11b67ceaf52a1f809596274ba9f04a32 |