Skip to content

Camera

Camera config, frames, streaming sessions, detection events, runtime device API.

camera_ui_sdk.camera

CameraPublicProperties module-attribute

CameraPublicProperties = Literal['_id', 'nativeId', 'pluginInfo', 'name', 'disabled', 'isCloud', 'info', 'type', 'snapshotSettings', 'detectionZones', 'detectionSettings', 'ptzAutotrack', 'frameWorkerSettings', 'interfaceSettings', 'recording', 'plugins', 'assignments', 'sources']

Camera public property names for observation.

EVENT_TRIGGER_TYPES module-attribute

EVENT_TRIGGER_TYPES: tuple[str, ...] = ('motion', 'audio', 'contact', 'doorbell', 'switch', 'light', 'siren', 'security_system', 'line-crossing')

All event trigger types as a runtime-accessible tuple.

AudioCodec module-attribute

AudioCodec = Literal['PCMU', 'PCMA', 'MPEG4-GENERIC', 'opus', 'G722', 'G726', 'MPA', 'PCM', 'FLAC', 'ELD', 'PCML', 'L16']

Supported audio codecs (RTP/SDP format names).

AudioFFmpegCodec module-attribute

AudioFFmpegCodec = Literal['pcm_mulaw', 'pcm_alaw', 'aac', 'libopus', 'g722', 'g726', 'mp3', 'pcm_s16be', 'pcm_s16le', 'flac']

FFmpeg audio codec names for transcoding.

CameraAspectRatio module-attribute

CameraAspectRatio = Literal['16:9', '9:16', '8:3', '4:3', '1:1']

Camera aspect ratio for UI display.

CameraRole module-attribute

CameraRole = Literal['high-resolution', 'mid-resolution', 'low-resolution', 'snapshot']

Camera stream resolution role. Used to identify different quality streams from the same camera.

CameraType module-attribute

CameraType = Literal['camera', 'doorbell']

Camera device type. - camera: Standard surveillance camera - doorbell: Doorbell camera

DetectionEventState module-attribute

DetectionEventState = Literal['active', 'ended']

Event lifecycle state.

DetectionEventType module-attribute

DetectionEventType = Literal['start', 'end', 'update', 'segment-start', 'segment-update', 'segment-end']

Detection event message type (lifecycle phase).

EventTriggerType module-attribute

EventTriggerType = Literal['motion', 'audio', 'contact', 'doorbell', 'switch', 'light', 'siren', 'security_system', 'line-crossing']

Event trigger type.

LineDirection module-attribute

LineDirection = Literal['both', 'a-to-b', 'b-to-a']

Line crossing direction filter. - both: Trigger on crossings in either direction - a-to-b: Trigger only when crossing from A side to B side - b-to-a: Trigger only when crossing from B side to A side

MotionResolution module-attribute

MotionResolution = Literal['low', 'medium', 'high']

Motion detection resolution setting. Higher resolution = more accurate but slower.

Point module-attribute

Point = tuple[float, float]

Zone polygon coordinate as [x, y] tuple (0-100 percentage).

ProbeAudioCodec module-attribute

ProbeAudioCodec = Literal['aac', 'opus', 'pcma']

Audio codecs supported for stream probing.

RTSPAudioCodec module-attribute

RTSPAudioCodec = Literal['aac', 'opus', 'pcma']

Audio codecs supported for RTSP streaming.

StreamDirection module-attribute

StreamDirection = Literal['sendonly', 'recvonly', 'sendrecv', 'inactive']

Stream direction (from SDP).

StreamingRole module-attribute

StreamingRole = Literal['high-resolution', 'mid-resolution', 'low-resolution']

Streaming roles (excludes snapshot).

VideoCodec module-attribute

VideoCodec = Literal['H264', 'H265', 'VP8', 'VP9', 'AV1', 'JPEG', 'RAW']

Supported video codecs (RTP/SDP format names).

VideoFFmpegCodec module-attribute

VideoFFmpegCodec = Literal['h264', 'hevc', 'vp8', 'vp9', 'av1', 'mjpeg', 'rawvideo']

FFmpeg video codec names for transcoding.

VideoStreamingMode module-attribute

VideoStreamingMode = Literal['auto', 'webrtc', 'mse', 'webrtc/tcp']

Video streaming mode for UI playback. - auto: Automatically select best method - webrtc: WebRTC with UDP (lowest latency) - webrtc/tcp: WebRTC with TCP fallback - mse: Media Source Extensions (browser native)

ZoneFilter module-attribute

ZoneFilter = Literal['include', 'exclude']

Detection zone filter mode. - include: Only consider detections inside this zone - exclude: Only consider detections outside this zone

ZoneType module-attribute

ZoneType = Literal['intersect', 'contain']

Detection zone intersection type. - intersect: Trigger when object touches the zone boundary - contain: Trigger only when object is fully inside the zone

AssignedPlugin

Bases: TypedDict

Plugin assignment info.

id instance-attribute

id: str

Plugin ID.

name instance-attribute

name: str

Plugin display name.

BaseCamera

Bases: TypedDict

Base camera data structure (stored in database).

nativeId instance-attribute

nativeId: str | None

Native device ID from plugin.

pluginInfo instance-attribute

pluginInfo: CameraPluginInfo | None

Source plugin information.

name instance-attribute

name: str

Camera display name.

room instance-attribute

room: str

Room this camera belongs to.

disabled instance-attribute

disabled: bool

Whether camera is disabled.

isCloud instance-attribute

isCloud: bool

Whether camera streams from cloud.

info instance-attribute

info: CameraInformation

Camera hardware information.

type instance-attribute

type: CameraType

Camera type (camera/doorbell).

snapshotSettings instance-attribute

snapshotSettings: SnapshotSettings

Snapshot settings.

detectionZones instance-attribute

detectionZones: list[DetectionZone]

Detection zone configurations.

detectionLines instance-attribute

detectionLines: list[DetectionLine]

Detection line configurations (virtual tripwires).

detectionSettings instance-attribute

detectionSettings: CameraDetectionSettings

Detection settings.

ptzAutotrack instance-attribute

ptzAutotrack: PtzAutotrackSettings

PTZ autotracking settings.

frameWorkerSettings instance-attribute

frameWorkerSettings: CameraFrameWorkerSettings

Frame worker settings.

interfaceSettings instance-attribute

interfaceSettings: CameraUiSettings

UI display settings.

plugins instance-attribute

plugins: list[AssignedPlugin]

Installed plugins.

assignments instance-attribute

assignments: PluginAssignments

Sensor-to-plugin assignments.

BaseCameraConfig

Bases: TypedDict

Base camera configuration (shared fields).

name instance-attribute

name: str

Camera display name.

nativeId instance-attribute

nativeId: NotRequired[str]

Native device ID from plugin.

isCloud instance-attribute

isCloud: NotRequired[bool]

Whether camera streams from cloud.

disabled instance-attribute

disabled: NotRequired[bool]

Disable this camera.

info instance-attribute

info: NotRequired[CameraInformation]

Camera hardware information.

Camera

Bases: BaseCamera

Camera with resolved video sources.

sources instance-attribute

sources: list[CameraInput]

Video input sources.

CameraConfig

Bases: BaseCameraConfig

Full camera configuration with sources.

sources instance-attribute

sources: list[CameraConfigInputSettings]

Video input sources.

CameraConfigInputSettings

Bases: TypedDict

Camera input settings for config.

name instance-attribute

name: str

Source display name.

role instance-attribute

role: CameraRole

Resolution role.

useForSnapshot instance-attribute

useForSnapshot: bool

Use this source for snapshots.

hotMode instance-attribute

hotMode: bool

Keep connection always active.

preload instance-attribute

preload: bool

Preload stream on startup.

childSourceId instance-attribute

childSourceId: NotRequired[str]

Child source ID (for snapshot fallback).

CameraInformation

Bases: TypedDict

Camera hardware/firmware information.

model instance-attribute

model: str

Camera model name.

manufacturer instance-attribute

manufacturer: str

Manufacturer name.

hardware instance-attribute

hardware: str

Hardware version/revision.

serialNumber instance-attribute

serialNumber: str

Device serial number.

firmwareVersion instance-attribute

firmwareVersion: str

Current firmware version.

supportUrl instance-attribute

supportUrl: str

Manufacturer support URL.

CameraInput

Bases: TypedDict

Camera video input/source with resolved URLs.

name instance-attribute

name: str

Source display name.

role instance-attribute

role: CameraRole

Resolution role.

useForSnapshot instance-attribute

useForSnapshot: bool

Use this source for snapshots.

hotMode instance-attribute

hotMode: bool

Keep connection always active.

preload instance-attribute

preload: bool

Preload stream on startup.

urls instance-attribute

urls: StreamUrls

Generated streaming URLs.

childSourceId instance-attribute

childSourceId: NotRequired[str]

Child source ID (for snapshot fallback).

CameraPluginInfo

Bases: TypedDict

Camera source plugin information.

id instance-attribute

id: str

Plugin ID.

name instance-attribute

name: str

Plugin display name.

CameraPropertyObservableObject

Bases: TypedDict

Camera property change event.

property instance-attribute

property: str

Property name that changed.

old_state instance-attribute

old_state: Any

Previous value.

new_state instance-attribute

new_state: Any

New value.

CameraUiSettings

Bases: TypedDict

UI display settings for a camera.

streamingMode instance-attribute

streamingMode: VideoStreamingMode

Preferred streaming method.

streamingSource instance-attribute

streamingSource: StreamingRole

Preferred stream quality.

aspectRatio instance-attribute

aspectRatio: CameraAspectRatio

Display aspect ratio.

PluginAssignments

Bases: TypedDict

Plugin assignments for camera sensors/features. Maps sensor types to their assigned plugin(s).

motion instance-attribute

motion: AssignedPlugin

Motion detection plugin.

object instance-attribute

object: AssignedPlugin

Object detection plugin.

audio instance-attribute

audio: AssignedPlugin

Audio detection plugin.

face instance-attribute

face: AssignedPlugin

Face detection plugin.

licensePlate instance-attribute

licensePlate: AssignedPlugin

License plate detection plugin.

ptz instance-attribute

ptz: AssignedPlugin

PTZ control plugin.

battery instance-attribute

battery: AssignedPlugin

Battery info plugin.

cameraController instance-attribute

cameraController: AssignedPlugin

Camera controller plugin.

light instance-attribute

light: list[AssignedPlugin]

Light control plugins.

siren instance-attribute

siren: list[AssignedPlugin]

Siren control plugins.

contact instance-attribute

contact: list[AssignedPlugin]

Contact sensor plugins.

doorbell instance-attribute

doorbell: list[AssignedPlugin]

Doorbell trigger plugins.

hub instance-attribute

hub: list[AssignedPlugin]

Hub/bridge plugins.

SensorEventData

Bases: TypedDict

Emitted when a sensor is added or removed.

sensorId instance-attribute

sensorId: str

Sensor ID.

sensorType instance-attribute

sensorType: SensorType

Sensor type.

AudioDetectionSettings

Bases: TypedDict

Audio detection settings.

minDecibels instance-attribute

minDecibels: float

Minimum volume threshold in dBFS (-100 to 0). Audio below this level is skipped.

timeout instance-attribute

timeout: int

Audio dwell time in seconds.

CameraDetectionSettings

Bases: TypedDict

Combined detection settings for a camera.

motion instance-attribute

motion: MotionDetectionSettings

Motion detection settings.

object instance-attribute

object: ObjectDetectionSettings

Object detection settings.

audio instance-attribute

audio: AudioDetectionSettings

Audio detection settings.

sensor instance-attribute

sensor: SensorTriggerSettings

Sensor trigger settings.

cascadeDetection instance-attribute

cascadeDetection: NotRequired[bool]

Whether the detection cascade is enabled

cascadeTimeout instance-attribute

cascadeTimeout: NotRequired[int]

Cascade hold-open window in seconds

snooze instance-attribute

snooze: NotRequired[bool]

Whether detections are snoozed (paused).

DetectionLine

Bases: TypedDict

Detection line configuration. Defines a virtual tripwire for line crossing detection. The two points define grab-handle positions; the actual crossing line is perpendicular through their midpoint.

name instance-attribute

name: str

Line display name.

points instance-attribute

points: list[Point]

Grab-handle positions (0-100%). Crossing line is perpendicular through midpoint.

direction instance-attribute

direction: LineDirection

Which crossing direction(s) trigger events.

labels instance-attribute

labels: list[DetectionLabel]

Labels to filter (empty = all labels).

color instance-attribute

color: str

Line display color (hex).

DetectionZone

Bases: TypedDict

Detection zone configuration. Defines areas for detection filtering or privacy masking.

name instance-attribute

name: str

Zone display name.

points instance-attribute

points: list[Point]

Polygon points (0-100 percentage coordinates).

type instance-attribute

type: ZoneType

Intersection detection type.

filter instance-attribute

filter: ZoneFilter

Include/exclude filter mode.

labels instance-attribute

labels: list[DetectionLabel]

Labels to filter (empty = all labels).

isPrivacyMask instance-attribute

isPrivacyMask: bool

Whether this is a privacy mask (blur/block area).

color instance-attribute

color: str

Zone display color (hex).

MotionDetectionSettings

Bases: TypedDict

Motion detection settings.

resolution instance-attribute

resolution: MotionResolution

Detection resolution quality.

timeout instance-attribute

timeout: int

Motion dwell time in seconds.

ObjectDetectionSettings

Bases: TypedDict

Object detection settings.

confidence instance-attribute

confidence: float

Minimum confidence threshold (0-1).

PtzAutotrackSettings

Bases: TypedDict

PTZ autotracking settings — automatically follow detected objects.

enabled instance-attribute

enabled: bool

Whether PTZ autotracking is enabled.

targetLabels instance-attribute

targetLabels: list[str]

Object labels to track (e.g. 'person', 'vehicle').

minConfidence instance-attribute

minConfidence: float

Minimum detection confidence to track (0.3 - 1.0).

triggerDeadZone instance-attribute

triggerDeadZone: float

Dead zone around frame center (0 - 0.3). No motor command while the target is inside this zone.

returnToHome instance-attribute

returnToHome: bool

Return to home position when no target is found for homeWaitMs.

homeWaitMs instance-attribute

homeWaitMs: int

How long to wait (ms) without a target before returning home.

SensorTriggerRef

Bases: TypedDict

Stable reference to a sensor for cascade trigger configuration. Uses composite key (sensorType + sensorName + pluginId) instead of UUID so references survive plugin restarts.

sensorType instance-attribute

sensorType: SensorType

Sensor type (e.g. 'contact', 'doorbell').

sensorName instance-attribute

sensorName: str

Sensor name (stable across restarts).

pluginId instance-attribute

pluginId: str

Plugin ID that provides this sensor.

SensorTriggerSettings

Bases: TypedDict

Sensor trigger settings (contact, doorbell, switch, light, etc.).

timeout instance-attribute

timeout: int

Sensor trigger timeout in seconds.

triggers instance-attribute

triggers: list[SensorTriggerRef]

Sensors that also trigger the detection cascade (in addition to motion/audio).

CameraDevice

Bases: Protocol

Main camera device interface. Provides access to camera streams, sensors, and services.

id property

id: str

Unique camera ID.

nativeId property

nativeId: str | None

Native device ID from plugin.

pluginInfo property

pluginInfo: CameraPluginInfo | None

Source plugin information.

disabled property

disabled: bool

Whether camera is disabled.

name property

name: str

Camera display name.

room property

room: str

Room this camera belongs to.

type property

type: CameraType

Camera type (camera/doorbell).

snapshotSettings property

snapshotSettings: SnapshotSettings

Snapshot settings.

info property

info: CameraInformation

Camera hardware information.

isCloud property

isCloud: bool

Whether camera streams from cloud.

detectionZones property

detectionZones: list[DetectionZone]

Detection zone configurations.

detectionLines property

detectionLines: list[DetectionLine]

Detection line configurations (virtual tripwires).

detectionSettings property

detectionSettings: CameraDetectionSettings

Detection settings.

ptzAutotrack property

ptzAutotrack: PtzAutotrackSettings

PTZ autotracking settings.

snooze property

snooze: bool

Whether detections are snoozed (paused).

frameWorkerSettings property

frameWorkerSettings: CameraFrameWorkerSettings

Frame worker settings.

interfaceSettings property

interfaceSettings: CameraUiSettings

UI display settings.

sources property

sources: list[CameraDeviceSource]

All video sources.

streamSource property

streamSource: CameraDeviceSource

Primary streaming source.

highResolutionSource property

highResolutionSource: CameraDeviceSource | None

High resolution source (if available).

midResolutionSource property

midResolutionSource: CameraDeviceSource | None

Mid resolution source (if available).

lowResolutionSource property

lowResolutionSource: CameraDeviceSource | None

Low resolution source (if available).

snapshotSource property

snapshotSource: CameraSource | None

Snapshot source (if available).

connected property

connected: bool

Whether camera is connected.

frameWorkerConnected property

frameWorkerConnected: bool

Whether frame worker is connected.

onConnected property

onConnected: Observable[bool]

Observable for connection state changes.

onFrameWorkerConnected property

onFrameWorkerConnected: Observable[bool]

Observable for frame worker state changes.

logger property

logger: LoggerService

Logger service for this camera.

onSensorAdded property

onSensorAdded: Observable[SensorEventData]

Observable for sensor additions. Emits SensorEventData when a sensor from another plugin is added.

onSensorRemoved property

onSensorRemoved: Observable[SensorEventData]

Observable for sensor removals. Emits SensorEventData when a sensor from another plugin is removed.

onDetectionEvent property

onDetectionEvent: Observable[DetectionEventPayload]

Observable for detection events (start/update/end). Thumbnails in segments are only populated on 'end' events.

getSourceById

getSourceById(id: str) -> CameraDeviceSource | None

Get a source by its ID.

Parameters:

Name Type Description Default
id str

The source ID.

required

Returns:

Type Description
CameraDeviceSource | None

The matching source, or None if not found.

connect async

connect() -> None

Tell the server this camera is online.

Only the plugin that owns this camera (via pluginInfo) may connect it.

disconnect async

disconnect() -> None

Tell the server this camera is offline.

Only the plugin that owns this camera (via pluginInfo) may disconnect it.

onPropertyChange

onPropertyChange(property: CameraPublicProperties | list[CameraPublicProperties]) -> Observable[CameraPropertyObservableObject]

Observe camera property changes.

Parameters:

Name Type Description Default
property CameraPublicProperties | list[CameraPublicProperties]

Property name(s) to observe.

required

Returns:

Type Description
Observable[CameraPropertyObservableObject]

Observable emitting old and new values.

getSensors

getSensors() -> list[SensorLike]

Get all sensors attached to this camera (owned + foreign).

getSensor

getSensor(sensorId: str) -> SensorLike | None

Get sensor by ID (checks owned and foreign sensors).

getSensorsByType

getSensorsByType(sensorType: SensorType) -> list[SensorLike]

Get all sensors of a specific type (owned + foreign).

onSensorProperty

onSensorProperty(sensor_type: SensorType, property: str, callback: Callable[[Any, int, SensorLike], None]) -> Disposable

Subscribe to a specific property on a sensor type with full lifecycle management. Automatically subscribes/unsubscribes when sensors of the given type are added/removed.

Parameters:

Name Type Description Default
sensor_type SensorType

The sensor type to watch.

required
property str

The property name to observe.

required
callback Callable[[Any, int, SensorLike], None]

Called with (value, timestamp_ms, sensor) when the property changes.

required

Returns:

Type Description
Disposable

Disposable to stop all subscriptions.

addSensor async

addSensor(sensor: Sensor[Any, Any, Any]) -> None

Add a sensor to this camera.

Parameters:

Name Type Description Default
sensor Sensor[Any, Any, Any]

Sensor instance to add.

required

removeSensor async

removeSensor(sensorId: str) -> None

Remove a sensor from this camera.

Parameters:

Name Type Description Default
sensorId str

ID of sensor to remove.

required

implement async

implement(impl: CameraImplementation) -> None

Register a camera implementation for streaming and/or snapshot.

The impl value should implement StreamingInterface, SnapshotInterface, or both.

Parameters:

Name Type Description Default
impl CameraImplementation

Object or class implementing camera interfaces

required

createStorage

createStorage(schemas: list[JsonSchema]) -> DeviceStorage

Create storage for plugin-specific camera configuration.

Parameters:

Name Type Description Default
schemas list[JsonSchema]

Schema definitions for the storage

required

Returns:

Type Description
DeviceStorage

Typed device storage instance

CameraDeviceSource

Bases: CameraSource, Protocol

Camera source with full streaming capabilities.

generateRTSPUrl

generateRTSPUrl(options: RTSPUrlOptions | None = None) -> str

Generate RTSP URL with specified options.

Parameters:

Name Type Description Default
options RTSPUrlOptions | None

URL generation options.

None

Returns:

Type Description
str

RTSP URL string.

CameraSource

Bases: Protocol

Camera source with snapshot and probe capabilities.

name instance-attribute

name: str

Source display name.

role instance-attribute

role: CameraRole

Resolution role.

useForSnapshot instance-attribute

useForSnapshot: bool

Use this source for snapshots.

hotMode instance-attribute

hotMode: bool

Keep connection always active.

preload instance-attribute

preload: bool

Preload stream on startup.

urls instance-attribute

urls: StreamUrls

Generated streaming URLs.

childSourceId instance-attribute

childSourceId: str | None

Child source ID (for snapshot fallback).

snapshot async

snapshot(forceNew: bool = False) -> bytes | None

Get camera snapshot image.

Parameters:

Name Type Description Default
forceNew bool

Force fresh snapshot (ignore cache).

False

Returns:

Type Description
bytes | None

JPEG image data or None if unavailable.

probeStream async

probeStream(probeConfig: ProbeConfig | None = None, refresh: bool = False) -> ProbeStream | None

Probe stream for codec and track information.

Parameters:

Name Type Description Default
probeConfig ProbeConfig | None

What to probe for.

None
refresh bool

Force fresh probe (ignore cache).

False

Returns:

Type Description
ProbeStream | None

Stream information or None if unavailable.

getStreamStatus async

getStreamStatus() -> str

Get the current stream connection status.

Returns:

Type Description
str

Status string: 'connected', 'connecting', 'error', or 'idle'.

generateSnapshotUrl

generateSnapshotUrl(options: SnapshotUrlOptions | None = None) -> str

Generate Snapshot URL with specified options.

Parameters:

Name Type Description Default
options SnapshotUrlOptions | None

URL generation options.

None

Returns:

Type Description
str

Snapshot URL string.

SnapshotInterface

Bases: Protocol

snapshot async

snapshot(source_id: str, force_new: bool = False) -> bytes | None

Get a snapshot image from the camera.

Parameters:

Name Type Description Default
source_id str

The source ID to get the snapshot from

required
force_new bool

If True, bypass cache and get a fresh snapshot

False

Returns:

Type Description
bytes | None

Image data as bytes, or None if unavailable

StreamingInterface

Bases: Protocol

streamUrl async

streamUrl(source_id: str) -> str

Get the streaming URL for a source.

Parameters:

Name Type Description Default
source_id str

The ID of the source

required

Returns:

Type Description
str

The streaming URL (e.g., rtsp://, rtmp://, or custom protocol)

DetectionEvent

Bases: TypedDict

Aggregated detection event with lifecycle (start -> update -> end). Groups individual sensor detections into structured events.

id instance-attribute

id: str

Unique event ID.

cameraId instance-attribute

cameraId: str

Camera that produced this event.

state instance-attribute

state: Literal['active', 'ended']

Event lifecycle state.

startTime instance-attribute

startTime: int

Event start time (Unix ms).

endTime instance-attribute

endTime: NotRequired[int]

Event end time (Unix ms, only when ended).

lastUpdate instance-attribute

lastUpdate: int

Last activity timestamp (Unix ms).

types instance-attribute

types: list[str]

Detection types present in this event (for filtering).

triggers instance-attribute

triggers: list[EventTrigger]

Event triggers (motion/audio).

segments instance-attribute

segments: list[EventSegment]

Detection segments (object detection phases). For segment-* messages: contains only the current segment. For start/end messages: empty.

segmentIndex instance-attribute

segmentIndex: NotRequired[int]

Index of the segment in segments[0] for segment-* messages.

expectedEndTime instance-attribute

expectedEndTime: NotRequired[int]

Expected event end time (Unix ms) — the latest dwell expiry across all currently-active triggers. Monotonically non-decreasing during the event lifetime. Updated on each update / segment-* message.

thumbnail instance-attribute

thumbnail: NotRequired[bytes]

Full-frame downscaled JPEG captured at event start. Inline only on the first message that delivers it (start or the first update); the NVR plugin persists it and clients fetch it on demand via getEventThumbnails.

DetectionEventPayload

Bases: TypedDict

Emitted for detection events (start/update/end).

type instance-attribute

type: DetectionEventType

Event lifecycle type.

event instance-attribute

event: DetectionEvent

Full event data.

EventAttribute

Bases: TypedDict

Unified attribute within a segment (face identity, license plate, classifier result).

type instance-attribute

type: str

Attribute type ('face', 'license_plate', or classifier-specific like 'bird').

label instance-attribute

label: str

Identity name, plate text, or classification label.

confidence instance-attribute

confidence: NotRequired[float]

Detection confidence (0-1).

thumbnail instance-attribute

thumbnail: NotRequired[bytes]

Best-selected JPEG thumbnail crop. Only present on 'end' events.

embedding instance-attribute

embedding: NotRequired[list[float]]

Face embedding vector for unknown face persistence. Only present for face attributes.

embeddingModel instance-attribute

embeddingModel: NotRequired[str]

Embedding model identifier. Only present for face attributes with embedding.

clipEmbedding instance-attribute

clipEmbedding: NotRequired[list[float]]

CLIP embedding vector for semantic search. Only present for clip attributes.

clipEmbeddingModel instance-attribute

clipEmbeddingModel: NotRequired[str]

CLIP embedding model identifier. Only present for clip attributes with embedding.

parentTrackId instance-attribute

parentTrackId: NotRequired[int]

Parent object's tracker ID (links this attribute to its parent detection).

EventDescription

Bases: TypedDict

AI-generated event description.

title instance-attribute

title: str

Brief title of what occurred.

description instance-attribute

description: str

Chronological narrative of the scene.

summary instance-attribute

summary: str

Two-sentence notification-friendly summary.

threatLevel instance-attribute

threatLevel: int

Threat level: 0 = normal, 1 = suspicious, 2 = threat.

EventDetection

Bases: TypedDict

Aggregated object detection within a segment.

label instance-attribute

label: str

Detection label (e.g. "person", "car").

score instance-attribute

score: float

Best confidence score.

maxCount instance-attribute

maxCount: int

Maximum simultaneous count in a single frame.

box instance-attribute

box: NotRequired[BoundingBox]

Bounding box of the highest-confidence detection (normalized 0-1).

thumbnail instance-attribute

thumbnail: NotRequired[bytes]

Best-selected JPEG thumbnail crop. Only present on 'end' events.

trackId instance-attribute

trackId: NotRequired[int]

Object tracker ID (links this detection across frames).

moving instance-attribute

moving: NotRequired[bool]

Whether the object was moving (True) or stationary (False).

EventSegment

Bases: TypedDict

A contiguous object detection phase within an event.

firstSeen instance-attribute

firstSeen: int

Segment start time (Unix ms).

lastSeen instance-attribute

lastSeen: int

Segment end time (Unix ms).

thumbnail instance-attribute

thumbnail: NotRequired[bytes]

Best-selected JPEG scene thumbnail for this segment. Only present on 'end' events.

detections instance-attribute

detections: list[EventDetection]

Object detections in this segment.

attributes instance-attribute

attributes: list[EventAttribute]

Unified attributes (faces, plates, classifications).

zones instance-attribute

zones: NotRequired[list[str]]

Names of detection zones any detection in this segment overlapped (deduplicated).

description instance-attribute

description: NotRequired[EventDescription]

AI-generated description for this segment.

EventTrigger

Bases: TypedDict

Event trigger (motion, audio, sensor, or line-crossing).

type instance-attribute

type: EventTriggerType

Trigger type.

label instance-attribute

label: NotRequired[str]

Audio label (e.g. "doorbell", "glass_break").

score instance-attribute

score: NotRequired[float]

Best confidence score.

firstSeen instance-attribute

firstSeen: int

First detection time (Unix ms).

lastSeen instance-attribute

lastSeen: int

Last detection time (Unix ms).

lineName instance-attribute

lineName: NotRequired[str]

Name of the crossed line (only for line-crossing triggers).

crossingDirection instance-attribute

crossingDirection: NotRequired[str]

Crossing direction (only for line-crossing triggers).

trackId instance-attribute

trackId: NotRequired[int]

Track ID of the object that crossed (only for line-crossing triggers).

CameraFrameWorkerSettings

Bases: TypedDict

Frame worker (decoder) settings.

fps instance-attribute

fps: int

Target frames per second for detection.

hqSnapshots instance-attribute

hqSnapshots: NotRequired[bool]

Capture event thumbnails from the highest-resolution source.

SnapshotSettings

Bases: TypedDict

Snapshot settings for a camera.

autoRefresh instance-attribute

autoRefresh: bool

Enable automatic snapshot refresh.

ttl instance-attribute

ttl: int

Cache TTL in seconds (how long a snapshot is valid).

interval instance-attribute

interval: int

Auto-refresh interval in seconds (min: 10, max: 60).

AudioCodecProperties

Bases: TypedDict

Audio codec properties from stream probe.

sampleRate instance-attribute

sampleRate: int

Audio sample rate in Hz.

channels instance-attribute

channels: int

Number of audio channels.

payloadType instance-attribute

payloadType: int

RTP payload type.

fmtpInfo instance-attribute

fmtpInfo: NotRequired[FMTPInfo]

Optional format parameters.

AudioStreamInfo

Bases: TypedDict

Audio stream information from probe.

codec instance-attribute

codec: AudioCodec

Audio codec.

ffmpegCodec instance-attribute

ffmpegCodec: AudioFFmpegCodec

FFmpeg codec name.

properties instance-attribute

properties: AudioCodecProperties

Codec properties.

direction instance-attribute

direction: StreamDirection

Stream direction.

FMTPInfo

Bases: TypedDict

Format parameters (fmtp) from SDP.

payload instance-attribute

payload: int

RTP payload type number.

config instance-attribute

config: str

Codec-specific configuration string.

Go2RtcRTSPSource

Bases: TypedDict

RTSP streaming URLs from go2rtc.

base instance-attribute

base: str

Base RTSP URL.

default instance-attribute

default: str

Default stream (video + audio).

muted instance-attribute

muted: str

Video only (muted).

audioOnly instance-attribute

audioOnly: str

Audio only (no video).

aac instance-attribute

aac: str

Stream with AAC audio URL.

opus instance-attribute

opus: str

Stream with Opus audio URL.

pcma instance-attribute

pcma: str

Stream with PCMA audio URL.

onvif instance-attribute

onvif: str

ONVIF URL.

noGop instance-attribute

noGop: str

Stream URL with GOP cache disabled.

Go2RtcSnapshotSource

Bases: TypedDict

Snapshot/image URLs from go2rtc.

mp4 instance-attribute

mp4: str

MP4 single-frame video URL.

jpeg instance-attribute

jpeg: str

JPEG snapshot URL.

mjpeg instance-attribute

mjpeg: str

MJPEG stream URL.

Go2RtcWSSource

Bases: TypedDict

WebSocket streaming URLs from go2rtc.

webrtc instance-attribute

webrtc: str

WebRTC signaling endpoint.

mse instance-attribute

mse: str

MSE streaming endpoint.

ProbeConfig

Bases: TypedDict

Configuration for stream probing.

video instance-attribute

video: bool

Include video track info.

audio instance-attribute

audio: bool | Literal['all'] | list[ProbeAudioCodec]

Include audio track info (true, 'all', or specific codecs).

microphone instance-attribute

microphone: bool

Include microphone/backchannel info.

ProbeStream

Bases: TypedDict

Stream probe result containing SDP and track information.

sdp instance-attribute

sdp: str

Raw SDP string.

audio instance-attribute

audio: list[AudioStreamInfo]

Available audio tracks.

video instance-attribute

video: list[VideoStreamInfo]

Available video tracks.

RTSPUrlOptions

Bases: TypedDict

Options for generating RTSP URLs.

video instance-attribute

video: bool

Include video track.

audio instance-attribute

audio: bool | RTSPAudioCodec | list[RTSPAudioCodec]

Include audio track(s).

gop instance-attribute

gop: bool

Request keyframe at start (GOP).

audioSingleTrack instance-attribute

audioSingleTrack: bool

Combine audio tracks into single track.

backchannel instance-attribute

backchannel: bool

Enable backchannel (two-way audio).

timeout instance-attribute

timeout: int

Connection timeout in s.

SnapshotUrlOptions

Bases: TypedDict

Options for generating snapshot URLs.

width instance-attribute

width: int

Output width in pixels.

height instance-attribute

height: int

Output height in pixels.

rotate instance-attribute

rotate: Literal[90, 180, 270, -90]

Rotation in degrees.

cache instance-attribute

cache: str

Cache key/strategy.

hw instance-attribute

hw: Literal['vaapi', 'v4l2m2m', 'cuda', 'dxva2', 'videotoolbox', 'rkmpp']

Hardware acceleration backend.

gop instance-attribute

gop: bool

Request keyframe at start (GOP).

StreamUrls

Bases: TypedDict

Collection of all streaming URLs for a camera source.

ws instance-attribute

ws: Go2RtcWSSource

WebSocket URLs.

rtsp instance-attribute

rtsp: Go2RtcRTSPSource

RTSP URLs.

snapshot instance-attribute

snapshot: Go2RtcSnapshotSource

Snapshot URLs.

VideoCodecProperties

Bases: TypedDict

Video codec properties from stream probe.

clockRate instance-attribute

clockRate: int

Video clock rate.

payloadType instance-attribute

payloadType: int

RTP payload type.

fmtpInfo instance-attribute

fmtpInfo: NotRequired[FMTPInfo]

Optional format parameters.

VideoStreamInfo

Bases: TypedDict

Video stream information from probe.

codec instance-attribute

codec: VideoCodec

Video codec.

ffmpegCodec instance-attribute

ffmpegCodec: VideoFFmpegCodec

FFmpeg codec name.

properties instance-attribute

properties: VideoCodecProperties

Codec properties.

direction instance-attribute

direction: StreamDirection

Stream direction.