forked from Github/frigate
Compare commits
9 Commits
v0.12.0-be
...
v0.12.0-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e454daf727 | ||
|
|
732e527401 | ||
|
|
b44e6cd5dc | ||
|
|
2d9556f5f3 | ||
|
|
e82f72a9d3 | ||
|
|
ce2d589a28 | ||
|
|
750bf0e79a | ||
|
|
4dc6c93cdb | ||
|
|
f7e9507bee |
@@ -36,6 +36,25 @@ It is not recommended to copy this full configuration file. Only specify values
|
|||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
**Note:** The following values will be replaced at runtime by using environment variables
|
||||||
|
|
||||||
|
- `{FRIGATE_MQTT_USER}`
|
||||||
|
- `{FRIGATE_MQTT_PASSWORD}`
|
||||||
|
- `{FRIGATE_RTSP_USER}`
|
||||||
|
- `{FRIGATE_RTSP_PASSWORD}`
|
||||||
|
|
||||||
|
for example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
mqtt:
|
||||||
|
user: "{FRIGATE_MQTT_USER}"
|
||||||
|
password: "{FRIGATE_MQTT_PASSWORD}"
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- path: rtsp://{FRIGATE_RTSP_USER}:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:8554/unicast
|
||||||
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
mqtt:
|
mqtt:
|
||||||
# Optional: Enable mqtt server (default: shown below)
|
# Optional: Enable mqtt server (default: shown below)
|
||||||
@@ -148,7 +167,7 @@ birdseye:
|
|||||||
# More information about presets at https://docs.frigate.video/configuration/ffmpeg_presets
|
# More information about presets at https://docs.frigate.video/configuration/ffmpeg_presets
|
||||||
ffmpeg:
|
ffmpeg:
|
||||||
# Optional: global ffmpeg args (default: shown below)
|
# Optional: global ffmpeg args (default: shown below)
|
||||||
global_args: -hide_banner -loglevel warning -threads 1
|
global_args: -hide_banner -loglevel warning -threads 2
|
||||||
# Optional: global hwaccel args (default: shown below)
|
# Optional: global hwaccel args (default: shown below)
|
||||||
# NOTE: See hardware acceleration docs for your specific device
|
# NOTE: See hardware acceleration docs for your specific device
|
||||||
hwaccel_args: []
|
hwaccel_args: []
|
||||||
@@ -157,7 +176,7 @@ ffmpeg:
|
|||||||
# Optional: global output args
|
# Optional: global output args
|
||||||
output_args:
|
output_args:
|
||||||
# Optional: output args for detect streams (default: shown below)
|
# Optional: output args for detect streams (default: shown below)
|
||||||
detect: -threads 1 -f rawvideo -pix_fmt yuv420p
|
detect: -threads 2 -f rawvideo -pix_fmt yuv420p
|
||||||
# Optional: output args for record streams (default: shown below)
|
# Optional: output args for record streams (default: shown below)
|
||||||
record: preset-record-generic
|
record: preset-record-generic
|
||||||
# Optional: output args for rtmp streams (default: shown below)
|
# Optional: output args for rtmp streams (default: shown below)
|
||||||
@@ -485,12 +504,12 @@ ui:
|
|||||||
# Optional: Set a timezone to use in the UI (default: use browser local time)
|
# Optional: Set a timezone to use in the UI (default: use browser local time)
|
||||||
timezone: None
|
timezone: None
|
||||||
# Optional: Use an experimental recordings / camera view UI (default: shown below)
|
# Optional: Use an experimental recordings / camera view UI (default: shown below)
|
||||||
experimental_ui: False
|
use_experimental: False
|
||||||
# Optional: Set the time format used.
|
# Optional: Set the time format used.
|
||||||
# Options are browser, 12hour, or 24hour (default: shown below)
|
# Options are browser, 12hour, or 24hour (default: shown below)
|
||||||
time_format: browser
|
time_format: browser
|
||||||
# Optional: Set the date style for a specified length.
|
# Optional: Set the date style for a specified length.
|
||||||
# Options are: full, long, medium, sort
|
# Options are: full, long, medium, short
|
||||||
# Examples:
|
# Examples:
|
||||||
# short: 2/11/23
|
# short: 2/11/23
|
||||||
# medium: Feb 11, 2023
|
# medium: Feb 11, 2023
|
||||||
@@ -498,7 +517,7 @@ ui:
|
|||||||
# (default: shown below).
|
# (default: shown below).
|
||||||
date_style: short
|
date_style: short
|
||||||
# Optional: Set the time style for a specified length.
|
# Optional: Set the time style for a specified length.
|
||||||
# Options are: full, long, medium, sort
|
# Options are: full, long, medium, short
|
||||||
# Examples:
|
# Examples:
|
||||||
# short: 8:14 PM
|
# short: 8:14 PM
|
||||||
# medium: 8:15:22 PM
|
# medium: 8:15:22 PM
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ cameras:
|
|||||||
roles:
|
roles:
|
||||||
- detect
|
- detect
|
||||||
live:
|
live:
|
||||||
stream_name: test_cam_sub
|
stream_name: rtsp_cam_sub
|
||||||
```
|
```
|
||||||
|
|
||||||
### WebRTC extra configuration:
|
### WebRTC extra configuration:
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ See the [MQTT integration
|
|||||||
documentation](https://www.home-assistant.io/integrations/mqtt/) for more
|
documentation](https://www.home-assistant.io/integrations/mqtt/) for more
|
||||||
details.
|
details.
|
||||||
|
|
||||||
|
In addition, MQTT must be enabled in your Frigate configuration file and Frigate must be connected to the same MQTT server as Home Assistant for many of the entities created by the integration to function.
|
||||||
|
|
||||||
### Integration installation
|
### Integration installation
|
||||||
|
|
||||||
Available via HACS as a default repository. To install:
|
Available via HACS as a default repository. To install:
|
||||||
@@ -64,13 +66,13 @@ Home Assistant > Configuration > Integrations > Frigate > Options
|
|||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||||
| RTSP URL Template | A [jinja2](https://jinja.palletsprojects.com/) template that is used to override the standard RTMP stream URL (e.g. for use with reverse proxies). This option is only shown to users who have [advanced mode](https://www.home-assistant.io/blog/2019/07/17/release-96/#advanced-mode) enabled. See [RTSP streams](#streams) below. |
|
| RTSP URL Template | A [jinja2](https://jinja.palletsprojects.com/) template that is used to override the standard RTSP stream URL (e.g. for use with reverse proxies). This option is only shown to users who have [advanced mode](https://www.home-assistant.io/blog/2019/07/17/release-96/#advanced-mode) enabled. See [RTSP streams](#streams) below. |
|
||||||
|
|
||||||
## Entities Provided
|
## Entities Provided
|
||||||
|
|
||||||
| Platform | Description |
|
| Platform | Description |
|
||||||
| --------------- | --------------------------------------------------------------------------------- |
|
| --------------- | --------------------------------------------------------------------------------- |
|
||||||
| `camera` | Live camera stream (requires RTMP), camera for image of the last detected object. |
|
| `camera` | Live camera stream (requires RTSP), camera for image of the last detected object. |
|
||||||
| `sensor` | States to monitor Frigate performance, object counts for all zones and cameras. |
|
| `sensor` | States to monitor Frigate performance, object counts for all zones and cameras. |
|
||||||
| `switch` | Switch entities to toggle detection, recordings and snapshots. |
|
| `switch` | Switch entities to toggle detection, recordings and snapshots. |
|
||||||
| `binary_sensor` | A "motion" binary sensor entity per camera/zone/object. |
|
| `binary_sensor` | A "motion" binary sensor entity per camera/zone/object. |
|
||||||
|
|||||||
@@ -395,11 +395,13 @@ class BirdseyeCameraConfig(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning", "-threads", "1"]
|
# Note: Setting threads to less than 2 caused several issues with recording segments
|
||||||
|
# https://github.com/blakeblackshear/frigate/issues/5659
|
||||||
|
FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning", "-threads", "2"]
|
||||||
FFMPEG_INPUT_ARGS_DEFAULT = "preset-rtsp-generic"
|
FFMPEG_INPUT_ARGS_DEFAULT = "preset-rtsp-generic"
|
||||||
DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = [
|
DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = [
|
||||||
"-threads",
|
"-threads",
|
||||||
"1",
|
"2",
|
||||||
"-f",
|
"-f",
|
||||||
"rawvideo",
|
"rawvideo",
|
||||||
"-pix_fmt",
|
"-pix_fmt",
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export const formatUnixTimestampToDateTime = (unixTimestamp: number, config: Dat
|
|||||||
|
|
||||||
// use strftime_fmt if defined in config file
|
// use strftime_fmt if defined in config file
|
||||||
if (strftime_fmt) {
|
if (strftime_fmt) {
|
||||||
const strftime_locale = strftime.localizeByIdentifier(locale);
|
const strftime_locale = strftime.timezone(getUTCOffset(date, timezone)).localizeByIdentifier(locale);
|
||||||
return strftime_locale(strftime_fmt, date);
|
return strftime_locale(strftime_fmt, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,3 +114,18 @@ export const getDurationFromTimestamps = (start_time: number, end_time: number |
|
|||||||
}
|
}
|
||||||
return duration;
|
return duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapted from https://stackoverflow.com/a/29268535 this takes a timezone string and
|
||||||
|
* returns the offset of that timezone from UTC in minutes.
|
||||||
|
* @param timezone string representation of the timezone the user is requesting
|
||||||
|
* @returns number of minutes offset from UTC
|
||||||
|
*/
|
||||||
|
const getUTCOffset = (date: Date, timezone: string): number => {
|
||||||
|
const utcDate = new Date(date.getTime() - (date.getTimezoneOffset() * 60 * 1000));
|
||||||
|
// locale of en-CA is required for proper locale format
|
||||||
|
let iso = utcDate.toLocaleString('en-CA', { timeZone: timezone, hour12: false }).replace(', ', 'T');
|
||||||
|
iso += '.' + utcDate.getMilliseconds().toString().padStart(3, '0');
|
||||||
|
const target = new Date(iso + 'Z');
|
||||||
|
return (target.getTime() - utcDate.getTime()) / 60 / 1000;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user