Skip to main content

Async client for the Noonlight Dispatch API

Project description

noonlight-dispatch

A small, typed, async Python client for the Noonlight Dispatch API (/dispatch/v1). Built on httpx, it accepts a shared client/session so it slots cleanly into apps like Home Assistant.

It handles the Noonlight wire-format quirks for you: phone numbers are sent as digits with a country code but no leading +, and US states as the uppercase 2-letter code.

Install

pip install noonlight-dispatch

Usage

import httpx
from noonlight_dispatch import NoonlightClient, SANDBOX_BASE_URL

async def main():
    async with httpx.AsyncClient() as session:
        client = NoonlightClient(session, "YOUR_TOKEN", base_url=SANDBOX_BASE_URL)

        alarm = await client.create_alarm(
            services=["police"],
            name="Jane Doe",
            phone="+1 (202) 555-0142",   # stored/sent as 12025550142
            address="123 Main St",
            city="Springfield",
            state="va",                  # sent as VA
            zip_code="62704",
            instructions="Triggered by Front Door motion",  # -> instructions.entry
            owner_id="Site A",           # caller-defined site identifier
        )
        alarm_id = alarm["id"]

        status = await client.get_alarm_status(alarm_id)
        await client.cancel_alarm(alarm_id)

SANDBOX_BASE_URL never alerts real responders — use it for testing. PRODUCTION_BASE_URL is the default.

Errors

All failures raise a subclass of NoonlightError:

  • NoonlightAuthError — token rejected (401/403)
  • NoonlightConnectionError — unreachable / timeout
  • NoonlightResponseError — unexpected status or body (carries .status_code)

Development

pip install -e ".[test]"
pytest

License

MIT

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

noonlight_dispatch-0.1.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

noonlight_dispatch-0.1.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file noonlight_dispatch-0.1.2.tar.gz.

File metadata

  • Download URL: noonlight_dispatch-0.1.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for noonlight_dispatch-0.1.2.tar.gz
Algorithm Hash digest
SHA256 22d6b3bd0fa8114245302999a7982c374795625418ea017205c295de5de0314c
MD5 b57919a047d0b22bc5016c20cc394cad
BLAKE2b-256 f487a546a742dd6d20987ee7de5355d5cd18d6a569bae576f834c0c3fe572904

See more details on using hashes here.

File details

Details for the file noonlight_dispatch-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for noonlight_dispatch-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba69414c403c38471a23af3e8cbb0ed08af10ceb052e0c8ac79c138719853bb0
MD5 8b0bbd0d4b2e689838264d7ed07f8918
BLAKE2b-256 40fdc11d81905ddf5b54ba1ba53d0bf1a169e31f30fea2e0233dc39fd03090ce

See more details on using hashes here.

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