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
import async_timeout
from aiohttp import ClientConnectorError, ClientError, ClientSession
from nettigo_air_monitor import (
ApiError,
AuthFailed,
ConnectionOptions,
InvalidSensorData,
NettigoAirMonitor,
)
logging.basicConfig(level=logging.DEBUG)
async def main():
"""Main."""
websession = ClientSession()
options = ConnectionOptions(host="nam", username="user", password="password")
try:
nam = await NettigoAirMonitor.create(websession, options)
async with async_timeout.timeout(10):
data = await nam.async_update()
mac = await nam.async_get_mac_address()
except (
ApiError,
AuthFailed,
ClientConnectorError,
ClientError,
InvalidSensorData,
asyncio.exceptions.TimeoutError,
) as error:
print(f"Error: {error}")
else:
print(f"Firmware: {nam.software_version}")
print(f"MAC address: {mac}")
print(f"Data: {data}")
await websession.close()
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
Built Distribution
File details
Details for the file nettigo_air_monitor-1.2.4.tar.gz
.
File metadata
- Download URL: nettigo_air_monitor-1.2.4.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ceceafebdf2ac1be0271773496a06984d0bbe8faa2693da5638be64fa2cc2863 |
|
MD5 | 5113dc65b3b310e4983ce80075ff2969 |
|
BLAKE2b-256 | 00904b36259fb98d35660c69899c7e1c9d14caa971ebc6c33e30c4d69b2d632f |
File details
Details for the file nettigo_air_monitor-1.2.4-py3-none-any.whl
.
File metadata
- Download URL: nettigo_air_monitor-1.2.4-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37a66bbc10ec0ca9c7e8c6c7acc8a8a55e74bdaac5907a14ab1f2f06be2dbf19 |
|
MD5 | 10fad2ff0c6af76652947e03b45bfd02 |
|
BLAKE2b-256 | 46dafa50d4ece172d111e4f2b9260924e6782d1b6d65cf9d2f187965e3ac57b7 |