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-cameras, which depends
on this library.
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"Bridge a camera into go2rtc (or any
RTSP/HTTP consumer) without Home Assistant. Installing the package provides
the aidot-go2rtc console script; for an isolated tool install use pipx or uv:
pipx install "python-aidot-cameras[webrtc]"
# or:
uv tool install "python-aidot-cameras[webrtc]"
aidot-go2rtc --list # discover cameras + their transport
aidot-go2rtc <device_id> '{output}' # stream one camera (as a go2rtc exec: source)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 doneTwo-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).
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-cameras, which depends
on this library. See that repo for installing the component (via HACS or by
copying custom_components/aidot/).
The library reads the following environment variables.
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 |
The most useful knobs read by the camera client (aidot.camera.client). Defaults
are chosen to work out of the box; override only when tuning. Finer-grained
internal knobs (audio normalization, keyframe/PLI cadence, retry timing, SDES
audio, idle release, the sprop cache path) are documented in
docs/CAMERAS.md.
