Skip to main content

python-aidot-cameras

Control AIDOT WiFi lights and cameras from Python.

This is a camera-capable fork of the upstream lights-only python-aidot. It adds live WebRTC video streaming (DTLS and SDES-SRTP paths), snapshots, PTZ, camera controls, cloud recordings/thumbnails, and two-way (push-to-talk) audio.

This repository is the library (distribution name python-aidot-cameras). The Home Assistant custom component (custom_components/aidot/) lives in the companion integration repo cbrightly/hass-AiDot, which depends on this library.

Library install

Install from PyPI (the simplest, recommended method):

# lights + camera cloud/control only:
pip install python-aidot-cameras
# add live WebRTC streaming, snapshots, and two-way audio:
pip install python-aidot-cameras[webrtc]

[webrtc] pulls in the extra dependencies (aiortc, av, …) needed for live streaming, snapshots, and two-way audio. Without it you still get lights plus the camera cloud/control APIs, but not live media.

For the latest unreleased code, install straight from the GitHub repo instead:

# lights + camera cloud/control only:
pip install "git+https://github.com/cbrightly/python-aidot-cameras"
# add live WebRTC streaming, snapshots, and two-way audio:
pip install "python-aidot-cameras[webrtc] @ git+https://github.com/cbrightly/python-aidot-cameras"

Usage

Open a live WebRTC stream from a camera device client:

session = await device_client.async_open_webrtc_stream(on_frame=cb, timeout=30.0)
# ... session.stop() when done

Two-way (push-to-talk) audio:

session = await device_client.async_open_webrtc_stream(..., talk=True)
await session.async_start_talk(pcm_provider)   # provider() -> 320B s16le PCM (20ms @ 8kHz), or None
# ... speak ...
await session.async_stop_talk()

See docs/CAMERAS.md for the full camera API (streaming, snapshots, recordings, motion polling, two-way audio, and LAN-direct media).

Home Assistant component and CLI

The Home Assistant custom component (custom_components/aidot/) is not part of this library repo - it lives in the companion integration repo cbrightly/hass-AiDot, which depends on this library. See that repo for installing the component (via HACS or by copying custom_components/aidot/).

The test_camera.py CLI harness and the scripts under tools/ are local developer/diagnostic tools (they carry hardcoded LAN IPs and are gitignored), so they are not shipped with the published library.

Environment variables

The library reads the following environment variables.

Credentials

Used by the credential helper (aidot.credentials); they take priority over any stored credentials file. See src/aidot/credentials.py.

Variable Purpose Default
AIDOT_USERNAME AiDot account username/email. Used with AIDOT_PASSWORD. (none)
AIDOT_PASSWORD AiDot account password. Used with AIDOT_USERNAME. (none)
AIDOT_COUNTRY Account region/country code. US

Camera streaming / tuning

Optional knobs read by the camera client (aidot.camera.client). Defaults are chosen to work out of the box; override only when tuning.

Variable Purpose Default
AIDOT_SPROP_DIR Directory where captured SPS/PPS (sprop) parameter sets are cached. Set this to a writable path (e.g. for Home Assistant) if the default location is read-only. <package dir>
AIDOT_DISABLE_HIGHPORT_FIX If set (any value), disables the DTLS high-port USE-CANDIDATE nomination fix and falls back to upstream aioice behavior (used to measure the baseline connect rate). unset (fix enabled)
AIDOT_FAST_CONNECT Enables LAN-direct "fast connect" mode (STUN-only, skips several cloud signaling waits) when set to a truthy value. unset (off)
AIDOT_MAX_CONCURRENT_OPENS Caps how many stream opens run concurrently. 2
AIDOT_MAX_CONCURRENT_STREAMS Caps how many cameras stream at once. 3
AIDOT_STREAM_IDLE_S Seconds of stream idle before an idle release. 120
AIDOT_SDES_IDLE_RELEASE Set to 0 to disable idle release for SDES streams. 1 (enabled)
AIDOT_ICE_DISCONNECT_S ICE-disconnect debounce, in seconds, before tearing down. 8
AIDOT_DTLS_RETRY_GATE_S Minimum spacing, in seconds, between DTLS open retries. 15
AIDOT_BUSY_RETRY_S Delay, in seconds, before retrying when a camera reports busy. 45
AIDOT_GOP_PLI_S Interval, in seconds, between PLI (keyframe) requests. 2.0
AIDOT_AUDIO_TARGET_DBFS Target loudness (dBFS) for two-way audio normalization. -15
AIDOT_AUDIO_MAXGAIN_DB Maximum gain (dB) applied by the audio normalizer. 30
AIDOT_AUDIO_MINGAIN_DB Minimum gain (dB) applied by the audio normalizer. -12
AIDOT_AUDIO_GATE_DBFS Noise-gate threshold (dBFS) for two-way audio. -45
AIDOT_SDES_SERVE_AUDIO Set to 1 to serve audio on SDES cameras (off by default). 0 (off)
AIDOT_SDES_AUDIO_GAIN_DB Gain (dB) applied when SDES audio is served. -8

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_aidot_cameras-0.7.15.tar.gz (216.0 kB view details)

Uploaded Source

Built Distribution

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

python_aidot_cameras-0.7.15-py3-none-any.whl (205.6 kB view details)

Uploaded Python 3

File details

Details for the file python_aidot_cameras-0.7.15.tar.gz.

File metadata

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

File hashes

Hashes for python_aidot_cameras-0.7.15.tar.gz
Algorithm Hash digest
SHA256 980d32746f9d8110f957a781d96ed382a2a692a2a5a6bf11a5cdce1d99002ca7
MD5 a4136436b0ac45c85c6df85c946fe36c
BLAKE2b-256 95ea90408f90ba8995fe238bff10ee167bb4f154c8c1c5962710fcae5e634e01

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_aidot_cameras-0.7.15.tar.gz:

Publisher: publish.yml on cbrightly/python-aidot-cameras

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

File details

Details for the file python_aidot_cameras-0.7.15-py3-none-any.whl.

File metadata

File hashes

Hashes for python_aidot_cameras-0.7.15-py3-none-any.whl
Algorithm Hash digest
SHA256 5405f559026a5fd0ee88195e3e649266e1040f485df6400aa76c8b1660171917
MD5 d2b290db8e1a78d5aaf949aabd57e65d
BLAKE2b-256 775a24926e65b93e79bb960f48ad7c6bcb5404a65e9227839a97bc38816a266b

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_aidot_cameras-0.7.15-py3-none-any.whl:

Publisher: publish.yml on cbrightly/python-aidot-cameras

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

Release history Release notifications | RSS feed

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