siren
Timed siren: trigger the siren for a duration and know until when it sounds.
Timed siren: trigger the siren for a duration and know until when it sounds.
The plain on/off switch of a siren stays as it is (HomeKit / Alexa see a switch); this cap adds the part a switch cannot say — HOW LONG, and the moment the siren is expected to fall silent (activeUntil, epoch ms), so a UI can show the activation with a countdown.
What the camera counts natively.
At a glance
| Capability | siren |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| Active providers per device | one |
| Device types | siren |
| Source | packages/types/src/capabilities/siren.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 | protected |
getPlayChoices | query | yes | protected |
trigger | mutation | yes | protected |
stop | mutation | yes | protected |
getOptions
query
The durations the camera allows, read from the camera.
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
allowedSeconds | number[] | null | yes | Discrete durations in seconds the operator may pick; null when the camera gives a range. |
rangeSeconds | { min: number; max: number; step: number } | null | yes | Continuous range in seconds; null when the camera gives a discrete list. |
defaultSeconds | number | yes | The camera's default duration, seconds. |
allowedPlays | number[] | null | no (default null) | Discrete play counts the operator may pick; null when the camera gives a range or does not count plays. Defaults to null so a provider that predates plays (#589) reads as declaring none. |
rangePlays | { min: number; max: number; step: number } | null | no (default null) | Continuous range of play counts; null when listed or not counted. |
defaultPlays | number | null | no (default null) | The camera's default play count; null when the camera does not count plays. |
unit | "seconds" | "plays" | yes | What the camera counts natively. |
secondsPerPlay | number | null | yes | Seconds one play lasts, when unit is plays; null for a seconds camera. |
source | "camera" | "fallback" | yes | camera when the values were read from it, fallback when the camera could not say. |
fetchedAt | number | yes | Ms epoch of the read that produced this answer. |
getPlayChoices
query
The play counts a rule may pick: what getOptions declares as a list, or its range spelled out. Empty for a siren that counts seconds.
Input
No fields besides deviceId.
Output
number[]
trigger
mutation
Sound the siren for durationSeconds OR plays — never both. With neither the camera default applies. A count on a siren that declares no plays is refused. Answers the state at the moment of the trigger (activeUntil included).
Input
| Field | Type | Required | Description |
|---|---|---|---|
durationSeconds | number | no | |
plays | number | no |
Output
| Field | Type | Required | Description |
|---|---|---|---|
active | boolean | yes | True while the siren is sounding by a timed trigger or switched on. |
activeUntil | number | null | yes | Ms epoch the siren is expected to fall silent; null when not active or open-ended. |
durationSeconds | number | null | yes | Duration of the current / last activation, seconds; null when none yet. |
plays | number | null | no (default null) | The play count of the current / last activation when it was asked in plays; null when it was asked in seconds (or none yet). The unit that was asked. |
activeUntilEstimated | boolean | no (default false) | True when activeUntil comes from a seconds-per-play factor the camera did not report — the siren may fall silent somewhat earlier or later. |
lastTriggeredAt | number | yes | Ms epoch of the last trigger (0 = never). |
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
siren.trigger | Sound the siren | |
siren.triggerPlays | Sound the siren N times |
stop
mutation
Silence the siren now.
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
active | boolean | yes | True while the siren is sounding by a timed trigger or switched on. |
activeUntil | number | null | yes | Ms epoch the siren is expected to fall silent; null when not active or open-ended. |
durationSeconds | number | null | yes | Duration of the current / last activation, seconds; null when none yet. |
plays | number | null | no (default null) | The play count of the current / last activation when it was asked in plays; null when it was asked in seconds (or none yet). The unit that was asked. |
activeUntilEstimated | boolean | no (default false) | True when activeUntil comes from a seconds-per-play factor the camera did not report — the siren may fall silent somewhat earlier or later. |
lastTriggeredAt | number | yes | Ms epoch of the last trigger (0 = never). |
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
siren.stop | Silence the siren | active = false |
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
| Field | Type | Required | Description |
|---|---|---|---|
active | boolean | yes | |
activeUntil | number | null | yes | |
durationSeconds | number | null | yes | |
plays | number | null | no (default null) | |
activeUntilEstimated | boolean | no (default false) | |
lastTriggeredAt | number | yes | |
lastFetchedAt | number | yes | Ms epoch of the last successful camera read of the options (0 = never). |
Status
| Field | Type | Required | Description |
|---|---|---|---|
active | boolean | yes | True while the siren is sounding by a timed trigger or switched on. |
activeUntil | number | null | yes | Ms epoch the siren is expected to fall silent; null when not active or open-ended. |
durationSeconds | number | null | yes | Duration of the current / last activation, seconds; null when none yet. |
plays | number | null | no (default null) | The play count of the current / last activation when it was asked in plays; null when it was asked in seconds (or none yet). The unit that was asked. |
activeUntilEstimated | boolean | no (default false) | True when activeUntil comes from a seconds-per-play factor the camera did not report — the siren may fall silent somewhat earlier or later. |
lastTriggeredAt | number | yes | Ms epoch of the last trigger (0 = never). |
Events
onSirenChanged
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
active | boolean | yes | |
activeUntil | number | null | yes |