ptz-autotrack
ptz-autotrack — sibling cap of ptz that exposes the on-camera smart-tracking subsystem (subject-following).
ptz-autotrack — sibling cap of ptz that exposes the on-camera smart-tracking subsystem (subject-following). Modeled separately from ptz because:
- Not every PTZ-capable camera has autotrack (Reolink: yes; Hikvision: model-dependent), so a single combined cap would force every PTZ provider to surface
Unsupportedstubs on half the methods. - The cap's lifecycle is "registered when probed-true" — the binding system can show / hide the UI affordance cleanly via the standard
provider-registeredsignal. - Autotrack on/off is a device-state toggle (status), distinct from PTZ's continuous control surface — a status-driven cap fits the existing
setStatus/onStatusChangedpattern better thanptz's discrete-action surface.
Settings (cross-vendor consolidation, sourced from Reolink's setAutotrackingSettings shape; expandable as Hikvision / Dahua / others land):
targetType— vendor target string (people / vehicle / pet /''= camera default)stopDelaySeconds— how long to keep tracking a stationary target before stopping (0..300, default 30)disappearDelaySeconds— how long to wait before releasing a target that has left the frame (0..300, default 15)
The driver is the source of truth for which settings keys it actually honours; unsupported keys silently fall back to the camera's defaults. Adding a new vendor's setting (e.g. Hikvision's trackingDuration) extends the schema below and the setSettings payload.
At a glance
| Capability | ptz-autotrack |
| Provided by | The device's own driver can provide it, and an addon can also wrap the device to provide it through the device bindings. |
| Active providers per device | one |
| Device types | camera |
| Device settings | Yes: its settings section on the device page is built from this capability's methods. |
| Source | packages/types/src/capabilities/ptz-autotrack.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
getStatus | query | yes | default |
setEnabled | mutation | yes | default |
getSettings | query | yes | default |
setSettings | mutation | yes | default |
getStatus
query
Read the current on/off state + last-applied settings. Drivers may serve from a cache + refresh on a schedule — callers should NOT poll faster than ~5s.
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes | True when autotrack is currently armed on the camera. |
lastChangedAt | number | yes | Ms epoch of the last on/off transition (0 if never observed). |
currentSettings | { targetType: string; stopDelaySeconds: number; disappearDelaySeconds: number } | null | yes | Currently-applied settings the camera reports. Drivers fill this from the firmware GET so the UI can echo what's really active vs the operator-typed values in the settings form. |
supportedTargetTypes | ({ value: string; label: string })[] | yes | Target types the camera advertises. Driver-supplied — Reolink exposes people / vehicle / pet, Hikvision exposes auto / human / vehicle when the <smartTrackingType> knob is supported. Empty array = vendor doesn't expose a selector (treat as auto-only). The UI renders these as the targetType field options without hardcoding a vendor-specific list. |
setEnabled
mutation
Arm or disarm autotrack. Resolves once the camera has acknowledged the transition; the onStatusChanged event fires shortly after with the live state.
Input
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
ptz.autotrackOn | Autotrack on | |
ptz.autotrackOff | Autotrack off |
getSettings
query
Read settings (target type + delays). Mirrors the getStatus().currentSettings payload but exposes it as a standalone read for callers that want settings without the status surface around them. null until the driver has harvested the firmware state at least once.
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
targetType | string | yes | Vendor target string (people/vehicle/pet); empty = camera default |
stopDelaySeconds | number | yes | |
disappearDelaySeconds | number | yes |
setSettings
mutation
Update one or more settings. Partial — keys that aren't supplied keep their last persisted value. The driver is responsible for clamping vendor-specific ranges if narrower than the cross-vendor max declared on the schema.
Input
| Field | Type | Required | Description |
|---|---|---|---|
settings | { targetType?: string; stopDelaySeconds?: number; disappearDelaySeconds?: number } | yes |
Output
Nothing.
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
Persistent slice mirrored across restarts. The provider writes here on every successful firmware fetch / settings push; getStatus and getSettings then read this snapshot synchronously with a stale-driven async refresh in the background. Keeps the fetch / cache / fallback logic out of the four cap methods — they become trampolines over runtimeState.
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes | |
lastChangedAt | number | yes | |
currentSettings | { targetType: string; stopDelaySeconds: number; disappearDelaySeconds: number } | null | yes | |
supportedTargetTypes | ({ value: string; label: string })[] | yes | |
lastFetchedAt | number | yes | Ms epoch of the last successful camera fetch (0 = never). |
Status
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes | True when autotrack is currently armed on the camera. |
lastChangedAt | number | yes | Ms epoch of the last on/off transition (0 if never observed). |
currentSettings | { targetType: string; stopDelaySeconds: number; disappearDelaySeconds: number } | null | yes | Currently-applied settings the camera reports. Drivers fill this from the firmware GET so the UI can echo what's really active vs the operator-typed values in the settings form. |
supportedTargetTypes | ({ value: string; label: string })[] | yes | Target types the camera advertises. Driver-supplied — Reolink exposes people / vehicle / pet, Hikvision exposes auto / human / vehicle when the <smartTrackingType> knob is supported. Empty array = vendor doesn't expose a selector (treat as auto-only). The UI renders these as the targetType field options without hardcoding a vendor-specific list. |
Events
onStatusChanged
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
status | { enabled: boolean; lastChangedAt: number; currentSettings: { targetType: string; stopDelaySeconds: number; disappearDelaySeconds: number } | null; supportedTargetTypes: ({ value: string; label: string })[] } | yes |