Skip to main content

Python wrapper for getting air quality data from Nettigo Air Monitor devices.

Project description

GitHub Release PyPI PyPI - Downloads Buy me a coffee PayPal_Me

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


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-1.5.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

nettigo_air_monitor-1.5.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file nettigo_air_monitor-1.5.0.tar.gz.

File metadata

  • Download URL: nettigo_air_monitor-1.5.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for nettigo_air_monitor-1.5.0.tar.gz
Algorithm Hash digest
SHA256 77f1b6062ce424f71c33c06435c35938fabe3e227ceaf81381e166684d112374
MD5 487e55ea946afba4e7c4d7d6bcbbd718
BLAKE2b-256 5034ebca480a0c9c90cc230f374520757d464adf40379fc8811b8353d486694d

See more details on using hashes here.

File details

Details for the file nettigo_air_monitor-1.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nettigo_air_monitor-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e632eb7427bb9b75dc80b31babd967c907af6eb87959af13eb11db108696dc3f
MD5 5297c1a4237a0185e3972d2d62f76950
BLAKE2b-256 a863ddcd1e10be8844aeaf7c6c6afab0fdd9fe653e0cfce1742b3d3b8aaf3e3d

See more details on using hashes here.

Supported by

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