Compare commits

..
1 Commits
Author SHA1 Message Date
Josh Hawkins 23e0c41fc0 add configurable ttl for active alert notifications
Notifications sent while an alert was active always used a TTL of 0, so the push service dropped them if the device wasn't reachable at that moment and users only received the notification sent when the alert ended. A new `ttl` notifications option, settable globally or per camera, lets the push service retry these notifications for that many seconds. It defaults to 0, and the settings UI warns that a non-zero value can deliver stale notifications.
2026-10-29 15:59:33 -05:00
9 changed files with 60 additions and 12 deletions
@@ -1,2 +1,2 @@
onnx == 1.14.0; platform_machine == 'aarch64'
protobuf == 5.29.6; platform_machine == 'aarch64'
protobuf == 3.20.3; platform_machine == 'aarch64'
+23
View File
@@ -108,6 +108,29 @@ Currently, only Chrome supports images in notifications. Safari and Firefox will
Different platforms handle notifications differently, some settings changes may be required to get optimal notification delivery.
### Notification TTL
By default, Frigate sends notifications for an active alert with a TTL of `0`, so the push service either delivers them immediately or drops them. If your device is briefly unreachable (asleep, switching from Wi-Fi to cellular, or on a weak signal), those notifications are lost and you only receive the notification sent when the alert ends, which is always kept for up to an hour.
Setting `ttl` tells the push service to keep retrying notifications sent while an alert is active for that many seconds. This makes delivery more reliable, but a notification delivered late will still say an object is detected, even if the object has already left. Keep the value small.
<ConfigTabs>
<TabItem value="ui">
1. Navigate to <NavPath path="Settings > Camera configuration > Notifications" /> and select the desired camera.
- Set **Notification TTL** to the number of seconds to keep retrying (e.g. `10`)
</TabItem>
<TabItem value="yaml">
```yaml
notifications:
ttl: 10 # retry an undelivered notification for up to 10 seconds
```
</TabItem>
</ConfigTabs>
### Android
Most Android phones have battery optimization settings. To get reliable Notification delivery the browser (Chrome, Firefox) should have battery optimizations disabled. If Frigate is running as a PWA then the Frigate app should have battery optimizations disabled as well.
+1 -1
View File
@@ -623,7 +623,7 @@ class WebPushClient(Communicator):
# if event is ongoing open to live view otherwise open to recordings view
direct_url = f"/review?id={reviewId}" if ended else f"/#{camera}"
ttl = 3600 if ended else 0
ttl = 3600 if ended else self.config.cameras[camera].notifications.ttl
logger.debug(f"Sending push notification for {camera}, review ID {reviewId}")
+6
View File
@@ -24,6 +24,12 @@ class NotificationConfig(FrigateBaseModel):
title="Cooldown period",
description="Cooldown (seconds) between notifications to avoid spamming recipients.",
)
ttl: int = Field(
default=0,
ge=0,
title="Notification TTL",
description="Seconds the push service keeps retrying a notification sent while an alert is active if your device can't be reached. 0 delivers immediately or drops it. The notification sent when an alert ends is always kept for up to an hour.",
)
enabled_in_config: bool | None = Field(
default=None,
title="Original notifications state",
+9 -9
View File
@@ -2990,9 +2990,9 @@
}
},
"node_modules/@rjsf/utils/node_modules/fast-uri": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-4.2.3.tgz",
"integrity": "sha512-I1PXwP5eAhlNlcdpjt9CgB59op2ZvZfxw+BkqGFVIUOgNpCVTcTqp3HhTX7brxj5vsip+nSY4nTvff+eIA76hg==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-4.2.1.tgz",
"integrity": "sha512-TmHQgewjHtMq1E5QKA0tOE0yeYGQs25KZC/ziJpubRtWI15W92e6vPFydWOeZBVROSHBYw/QhD9d5OefdD6LDg==",
"funding": [
{
"type": "github",
@@ -5399,9 +5399,9 @@
"dev": true
},
"node_modules/fast-uri": {
"version": "3.1.9",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz",
"integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",
"version": "3.1.8",
"resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz",
"integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==",
"funding": [
{
"type": "github",
@@ -8669,9 +8669,9 @@
}
},
"node_modules/postcss-selector-parser": {
"version": "6.1.5",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.5.tgz",
"integrity": "sha512-TEHFzb5KRDKaOgJ4TYE+0jyJtFbjLvkdVOu0fZ2b6MTWzoqZd4Le+61aEppWkvTlYePgOX4ATL1wsAIPMLTw6Q==",
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz",
"integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==",
"license": "MIT",
"dependencies": {
"cssesc": "^3.0.0",
@@ -858,6 +858,10 @@
"label": "Cooldown period",
"description": "Cooldown (seconds) between notifications to avoid spamming recipients."
},
"ttl": {
"label": "Notification TTL",
"description": "Seconds the push service keeps retrying a notification sent while an alert is active if your device can't be reached. 0 delivers immediately or drops it. The notification sent when an alert ends is always kept for up to an hour."
},
"enabled_in_config": {
"label": "Original notifications state",
"description": "Indicates whether notifications were enabled in the original static configuration."
+4
View File
@@ -154,6 +154,10 @@
"label": "Cooldown period",
"description": "Cooldown (seconds) between notifications to avoid spamming recipients."
},
"ttl": {
"label": "Notification TTL",
"description": "Seconds the push service keeps retrying a notification sent while an alert is active if your device can't be reached. 0 delivers immediately or drops it. The notification sent when an alert ends is always kept for up to an hour."
},
"enabled_in_config": {
"label": "Original notifications state",
"description": "Indicates whether notifications were enabled in the original static configuration."
+2 -1
View File
@@ -2051,7 +2051,8 @@
"profileBaseDisabled": "Recording is disabled in this camera's base config, so enabling it in a profile has no effect. Enable recording in the base config and use a profile to disable it instead."
},
"notifications": {
"profileBaseDisabled": "No cameras have notifications enabled in their base config, so enabling them in a profile has no effect. Enable notifications in the base config of at least one camera."
"profileBaseDisabled": "No cameras have notifications enabled in their base config, so enabling them in a profile has no effect. Enable notifications in the base config of at least one camera.",
"ttlDelay": "If your device can't be reached when an alert is active, its notifications can arrive up to this many seconds late. It will still say an object is detected and open the live view, even if the object has already left."
},
"birdseye": {
"objectTrackingDetectDisabled": "Birdseye includes tracked objects, but object detection is disabled for this camera. The camera will not appear in Birdseye.",
@@ -24,6 +24,15 @@ const notifications: SectionConfigOverrides = {
camera.notifications.enabled_in_config,
),
},
{
key: "notifications-ttl-delay",
field: "ttl",
messageKey: "configMessages.notifications.ttlDelay",
severity: "warning",
position: "after",
condition: (ctx) =>
typeof ctx.formData?.ttl === "number" && ctx.formData.ttl > 0,
},
],
},
global: {
@@ -32,6 +41,7 @@ const notifications: SectionConfigOverrides = {
enabled: { "ui:widget": "hidden" },
email: { "ui:widget": "hidden" },
cooldown: { "ui:widget": "hidden" },
ttl: { "ui:widget": "hidden" },
enabled_in_config: { "ui:widget": "hidden" },
},
},