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.2.0.tar.gz (7.6 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.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyomnisense-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d8b8ccdd31b7e05e79a519f61013a34e9377aa9bad8744c7cd7a3df321332bfb
MD5 165b690eb5d5202df52f5dffed21da88
BLAKE2b-256 a6d0df09c9ebe35edb15e7f33996c26976a24f6566f770fbb8f3ae0ac07fa61a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomnisense-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyomnisense-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9f07452dbdf83e2edef7dcd1e9466041e26348179cd93f5b8d2a0b25dcff49c
MD5 e04c5eece18123723f69c57dabd60a97
BLAKE2b-256 0332e97790ea32dee157bf428b904990f38d2e6be7191f899b50b6545928cedf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyomnisense-0.2.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