privacy-mask
PRIVACY — what the camera deliberately does not capture.
PRIVACY — what the camera deliberately does not capture. Two planes:
- video: up to
maxRegionsSHAPES the camera blanks out (NOT a cell grid). Reolink<shelterList>zones are rectangles; Hikvision ISAPI<RegionCoordinatesList>zones are free polygons (this camera: exactly 4 vertices, not necessarily axis-aligned). The cap composes the shared rect|polygon subset of the MaskShape vocabulary. All coords are normalized 0..1 (top-left origin). - audio: the camera's microphone.
setAudioEnabled(false)stops the camera encoding an audio track at all, so EVERY consumer — live view, recording, the audio analyzer, an export — sees silent video.
Both belong here for one reason: they are the two things an operator turns off when the answer to "what is this camera allowed to record" changes, and both are applied ON the device, before anything leaves it.
A second writer onto one device register is the shape of every knob this repo has shipped that disagreed with the one the reader read.
A privacy-mask region's geometry — rectangle or free polygon.
At a glance
| Capability | privacy-mask |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| 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/privacy-mask.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 |
|---|---|---|---|
getOptions | query | yes | default |
setMask | mutation | yes | admin |
setAudioEnabled | mutation | yes | admin |
getOptions
query
Input
No fields besides deviceId.
Output
Per-camera availability. Probed, never assumed from the model name.
| Field | Type | Required | Description |
|---|---|---|---|
maxRegions | number | yes | Maximum number of supported zones. |
supportedShapes | ("rect" | "polygon" | "grid" | "line")[] | yes | Shape kinds this camera accepts — Reolink: ['rect']; Hikvision: ['rect','polygon']. |
polygonVertices | { min: number; max: number } | no | Polygon vertex bounds when 'polygon' is supported (Hikvision: {min:4,max:4}). |
supportsAudioMute | boolean | yes | Does this camera expose a microphone switch we can actually write? Camera-probed: true only when the firmware answered with an audio flag we know how to patch. A camera that never answered is false — a control the operator can press that changes nothing is worse than no control, and the switch group renders "not available" instead. |
setMask
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
patch | { enabled?: boolean; regions?: ({ id: number; enabled: boolean; shape: MaskRectShapeSchema | MaskPolygonShapeSchema })[] } | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
privacy.maskOn | Privacy mask on | |
privacy.maskOff | Privacy mask off |
setAudioEnabled
mutation
Turn the camera's microphone on or off, at the camera.
Deliberately its OWN mutation rather than a field on { mask master switch", and overloading it would make one boolean mean two unrelated things on the same call. It is also the only method here whose write leaves the device in a state a later getStatus reads back verbatim, which is what makes it safe as a switch authority.
A camera whose getOptions().supportsAudioMute is false must REJECT this rather than silently accept it — a write nothing applies is exactly what the switch group exists to remove.
Input
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
privacy.micOn | Microphone on | |
privacy.micOff | Microphone off |
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | yes | |
regions | ({ id: number; enabled: boolean; shape: { kind: "rect"; x: number; y: number; width: number; height: number } | { kind: "polygon"; points: MaskPointSchema[] } })[] | null | yes | Active zones (normalized 0..1). Length ≤ maxRegions. null means "no answer" — the provider has never reached this camera (a cold runtimeState slice, a battery camera asleep) or the read failed. A consumer must render it as UNKNOWN and never as "this camera has no zones": those two look identical to an operator right up to the moment one of them is acted on, and acting on them differs completely. The switch group turned an unanswered read into "nothing is set up for it to act on" — an instruction to go and draw a zone that already exists — and this editor seeded an EMPTY canvas from it, one Save away from deleting the mask it could not read. Empty-and-answered is [] and stays a real answer: this camera genuinely has no zones. The distinction is the same one { PrivacyMaskStatusSchema.shape.audioEnabled} already draws for the microphone, on the very same payload — both planes come from ONE refresh, so it was never coherent for one of them to be able to say "unknown" while the other could not. |
audioEnabled | boolean | null | yes | Is the camera capturing sound right now? Read from the camera, never from a server-side mirror. null means "no answer" — either this camera exposes no controllable microphone (getOptions().supportsAudioMute === false) or the read failed. A consumer must render null as UNKNOWN and never as false: "the microphone is off" and "we could not ask" look identical to an operator only until one of them is wrong. On a camera whose profiles carry the flag independently (Reolink writes it per stream), true means AT LEAST ONE profile still carries audio — privacy is only satisfied when every one of them is silent. |
lastFetchedAt | number | yes |