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.1.tar.gz (8.7 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.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyomnisense-0.3.1.tar.gz
  • Upload date:
  • Size: 8.7 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.1.tar.gz
Algorithm Hash digest
SHA256 27ead621eb4ff88d699156353250e74328277a470fdaf5f5e8ffc2436d9b2d50
MD5 dd5244de648b69f4370c254a2d3946a4
BLAKE2b-256 2f846bdaba5121b995fda2a9d662d50a96a7a498d17a08bda00c775cb23cfc76

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyomnisense-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba1fade4df51a6546e81c9f5facb4197ceac7aa3e1df019e364b9dead7389774
MD5 fda3efcfad0b0bb5279036f7bece32e2
BLAKE2b-256 404fc03a2aa63035adc3127d96f6d7d3c2c098001c462107826878ae0306bbce

See more details on using hashes here.

Provenance

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