feat: Add automatic doorbell detection (#2507)

This commit is contained in:
Dermot Duffy
2026-06-30 17:45:13 -07:00
committed by dermotduffy
parent 4b72fcd629
commit 773cee95a5
24 changed files with 527 additions and 123 deletions
+2 -1
View File
@@ -383,7 +383,8 @@ cameras:
| Option | Default | Description |
| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `entities` | | Whether to not to trigger the camera when the state of any Home Assistant entity becomes active (i.e. state becomes `on` or `open`). This works for Frigate or non-Frigate cameras. |
| `doorbell` | `false` | Whether to trigger the camera by automatically detecting an [HA `event.*` entity](https://www.home-assistant.io/integrations/event/#device-class) with `device_class: doorbell` on the same HA device as the camera entity. Requires `camera_entity` to be set. |
| `entities` | | Whether to not to trigger the camera when the state of any Home Assistant entity becomes active (i.e. state becomes `on` or `open`). |
| `events` | `[]` | Whether to trigger the camera when `events` occur (whether or not media is available) or whenever updated `clips` or `snapshots` are detected. Detection support varies by camera [engine](engine.md). |
| `motion` | `false` | Whether to not to trigger the camera by automatically detecting and using the motion `binary_sensor` for this camera. This autodetection only works for Frigate cameras, and only when the motion `binary_sensor` entity has been enabled in Home Assistant. |
| `occupancy` | `false` | Whether to not to trigger the camera by automatically detecting and using the occupancy `binary_sensor` for this camera and its configured zones and labels. This autodetection only works for Frigate cameras, and only when the occupancy `binary_sensor` entity has been enabled in Home Assistant. If this camera has configured zones, only occupancy sensors for those zones are used -- if the overall _camera_ occupancy sensor is also required, it can be manually added to `entities`. If this camera has configured labels, only occupancy sensors for those labels are used. |
+11 -11
View File
@@ -148,13 +148,14 @@ human interaction with the card; this behavior can be configured via the
> action is taken immediately. If multiple cameras are triggered at startup, they
> are all marked as triggered, but the action is only taken for the first one.
| Option | Default | Description |
| ------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions` | | The actions to take when a camera is triggered. See [Trigger action configuration](#trigger-action-configuration). |
| `filter_selected_camera` | `true` | If set to `true` will only trigger on the currently selected camera. |
| `show_trigger_status` | `false` | Whether or not the `live` view should show a visual indication that it is triggered (a pulsing border around the camera edge). |
| `untrigger_delay_seconds` | `0` | The number of seconds to continue to consider the camera triggered after the source ends, before taking the configured `untrigger` action. For instantaneous trigger sources (e.g. HA `event.*` entities, or a doorbell button that only briefly pulses on) this is effectively the entire visible "active" duration — the source itself provides no on-period of its own. |
| `untrigger_force_seconds` | `0` | The number of seconds after a camera first triggers before force untriggering that camera. Set to `0` to disable. |
| Option | Default | Description |
| ------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions` | | The actions to take when a camera is triggered. See [Trigger action configuration](#trigger-action-configuration). |
| `filter_selected_camera` | `true` | If set to `true` will only trigger on the currently selected camera. |
| `show_trigger_status` | `false` | Whether or not the `live` view should show a visual indication that it is triggered (a pulsing border around the camera edge). |
| `signal_hold_seconds` | `30` | The synthesized on-period for momentary trigger sources that have no native on/off state (e.g. HA `event.*` entities or anything that fires as a single signal). For a doorbell press paired with `trigger: call`, this is effectively the ring window during which the call can be answered. Added _on top of_ `untrigger_delay_seconds`. Ignored for stateful sources (`binary_sensor`, `switch`, etc.). |
| `untrigger_delay_seconds` | `0` | The number of seconds to continue to consider the camera triggered after the source ends, before taking the configured `untrigger` action. |
| `untrigger_force_seconds` | `0` | The number of seconds after a camera first triggers before force untriggering that camera. Set to `0` to disable. |
> [!WARNING] If `untrigger_force_seconds` is used to untrigger a camera, the
> state will need to 'reset' (e.g. an entity would need to change state to
@@ -162,10 +163,9 @@ human interaction with the card; this behavior can be configured via the
> [!TIP] When pairing `trigger: call` with `untrigger: call` (the
> "ring-then-end-if-unanswered" pattern), the ring lasts until the source ends
> plus `untrigger_delay_seconds`. With an instantaneous trigger source (event
> entity, brief switch pulse) and the default of `0`, the call would start and
> end in the same tick. In these cases, set a positive value (e.g. `30`) for a
> meaningful ring duration.
> plus `untrigger_delay_seconds`. For momentary sources (HA `event.*` entities,
> a doorbell press), the source ends instantly so the ring window is
> `signal_hold_seconds` (default `30`s) plus `untrigger_delay_seconds`.
### Trigger action configuration
+13 -12
View File
@@ -363,9 +363,18 @@ elements:
This example uses [`view.triggers.actions.trigger: call`](configuration/view.md?id=triggers) to turn a dashboard into a phone-like ringer when somebody presses the doorbell. The intended deployment is a wall-mounted tablet sitting on the dashboard.
The trigger entity is an [HA `event.*` entity](https://www.home-assistant.io/integrations/event/#device-class) with `device_class: doorbell` — the officially supported way modern integrations (ONVIF, UniFi Protect, Reolink, MQTT, etc.) expose a doorbell press. A press fires the entity instantaneously; the card treats it as a momentary signal and rings for `untrigger_delay_seconds`. A `switch.*` or `binary_sensor.*` entity that goes on/off with each press works will also work fine.
Setting `triggers.doorbell: true` opts the camera into auto-discovery of [HA
`event.*`
entities](https://www.home-assistant.io/integrations/event/#device-class) with
`device_class: doorbell` on the camera's device — the officially supported way
modern integrations (Ring, UniFi Protect, Nest, DoorBird, Reolink, etc.) expose
a doorbell press -- no need to list the entity explicitly under
`triggers.entities`. If your doorbell exposes a `binary_sensor.*` or `switch.*`
instead, list it under `triggers.entities` manually.
The Frigate camera's stock event triggers (`occupancy`, `motion`, `events`) are explicitly turned off so casual motion doesn't make the card ring — only an actual doorbell press does.
A doorbell press is instantaneous, so the card synthesises a ring window from [`view.triggers.signal_hold_seconds`](configuration/view.md?id=triggers) (default `30`s) — long enough for a typical phone-style answer window. `untrigger_delay_seconds` then lingers past that, same as for any stateful trigger.
`triggers.motion`, `triggers.occupancy`, and `triggers.events` are off by default — only the explicit doorbell press triggers the call, so casual motion won't make the card ring.
```yaml
type: custom:advanced-camera-card
@@ -376,23 +385,15 @@ cameras:
modes:
- webrtc
triggers:
occupancy: false
motion: false
events: []
entities:
- event.front_door_doorbell
doorbell: true
view:
default: live
triggers:
show_trigger_status: true
# How long the chime keeps ringing after a press before the call is
# auto-ended (if still unanswered). A doorbell press is instantaneous,
# so this value is effectively the ring duration.
untrigger_delay_seconds: 30
actions:
# Call when triggered.
trigger: call
# When the trigger naturally ends (after untrigger_delay_seconds): end
# When the trigger naturally ends (after signal_hold_seconds): end
# the call if it's still ringing. An answered call survives this and
# must be ended manually.
untrigger: call