Skip to main content

Python library for accessing Omnisense sensor data from omnisense.com

Project description

pyomnisense

pyomnisense is a Python library for accessing Omnisense sensor data directly from the omnisense.com website. It supports logging into the service, retrieving site lists, and fetching sensor data.

Features

  • Login to the Omnisense website
  • Retrieve a list of sites with sensor data
  • Fetch detailed sensor data for a selected site
  • Asynchronous methods using aiohttp
  • Transparent re-login if the server expires the session between calls

Install this repo

Clone the repository and install in editable mode:

git clone https://github.com/sslivins/pyomnisense.git
cd pyomnisense
pip install -e .

Install from pypi.org

pip install pyomnisense

Usage

import asyncio
from pyomnisense import Omnisense, OmnisenseAuthError

async def main():
    async with Omnisense() as omnisense:
        try:
            await omnisense.login("your_username", "your_password")
        except OmnisenseAuthError as err:
            print(f"Login failed: {err}")
            return

        sites = await omnisense.get_site_list()
        print("Available sites:", sites)

        sensor_data = await omnisense.get_sensor_data(sites)
        print("Sensor data:", sensor_data)

asyncio.run(main())

Replace "your_username" and "your_password" with your actual Omnisense credentials. The async with block guarantees the underlying HTTP session is closed even on errors.

Testing

Tests are written using pytest and pytest-asyncio. You can run tests as follows:

pytest -m offline

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

pyomnisense-0.3.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyomnisense-0.3.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file pyomnisense-0.3.0.tar.gz.

File metadata

  • Download URL: pyomnisense-0.3.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyomnisense-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5fffff0733e23cf8ee0be7060a18b85ec8c4578ade6f4ba05e5d3a560b4547af
MD5 27189188272919e95930a7d6a805ffac
BLAKE2b-256 bb6e1c6d14c84129417c5d97795fa7fa5a00e2b1bb2c5b2d91b8f9f80fba6b5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomnisense-0.3.0.tar.gz:

Publisher: publish_to_pypi.yml on sslivins/pyomnisense

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyomnisense-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyomnisense-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyomnisense-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b85f40538f6d1aa265b1b3b895a365362179c77556cb52621e74f32db022f0f9
MD5 8441d9880802fe00c6fb614f4fc90af8
BLAKE2b-256 eed68bad0eecb90077e6dff0cdc7afac14f15ea3ff92fe05c59dc006fb46f9f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomnisense-0.3.0-py3-none-any.whl:

Publisher: publish_to_pypi.yml on sslivins/pyomnisense

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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