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

Uploaded Source

Built Distribution

nettigo_air_monitor-1.3.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nettigo_air_monitor-1.3.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for nettigo_air_monitor-1.3.0.tar.gz
Algorithm Hash digest
SHA256 e50200b2d62bb2497d62960827f02f63f8e196ce251b8fb4c4e2bbc9c953fdf4
MD5 1c58cea6cba306641de1f35563b1f478
BLAKE2b-256 248155ce1607b6dd6cb30d7e4c27183423476cc7cdcd940b81040b1ea44d182c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nettigo_air_monitor-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69a3172c477446d9a4024383068c1d0238f1b637a12c0e0ecda6a78bacf0a31d
MD5 027c831df06e7830ba4a9e6fbf10dd1b
BLAKE2b-256 673eb04100add94279d6f91626a7aeb87613b21f7a6d1e642ceebd722c5d5850

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