From e5cfb2d5a17a4e2b02c6c4a2c902b8903ce32bba Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Wed, 5 Feb 2025 15:41:20 -0300 Subject: [PATCH 01/15] Move database and config from homeassistant /config to addon /config --- .../rootfs/etc/s6-overlay/s6-rc.d/frigate/run | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run index e4a1b20e5..a683e7ff2 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run @@ -9,7 +9,46 @@ set -o errexit -o nounset -o pipefail # Tell S6-Overlay not to restart this service s6-svc -O . -function migrate_db_path() { +function migrate_from_homeassistant_config() { + # Find old config file in yaml or yml, but prefer yaml + local ha_config_file="/homeassistant_config/config.yml" + local ha_config_file_yaml="${ha_config_file//.yml/.yaml}" + if [[ -f "${ha_config_file_yaml}" ]]; then + ha_config_file="${ha_config_file_yaml}" + elif [[ ! -f "${ha_config_file}" ]]; then + # Nothing to migrate + return 0 + fi + unset ha_config_file_yaml + + # Confirm there isn't a config yet in the target location + local config_file="${CONFIG_FILE:-"/config/config.yml"}" + local config_file_yaml="${config_file//.yml/.yaml}" + if [[ -f "${config_file_yaml}" || -f "${config_file}" ]]; then + echo "[ERROR] TODO" >&2 + return 1 + fi + unset config_file config_file_yaml + + local db_path + db_path=$(yq eval '.database.path' "${config_file}") + + if [[ "${db_path}" == "null" ]]; then + db_path="/config/frigate.db" + fi + + local previous_db_path="/homeassistant/frigate.db" + if [[ -f "${previous_db_path}" ]]; then + # /config is a mount point, move the db + echo "[INFO] Moving db from '${previous_db_path}' to '${db_path}'..." + # Move all files that starts with frigate.db to the new directory + mv -vf "${previous_db_path}"* "${new_db_dir}" # TODO FIX + fi + + # TODO migrate config +} + +function migrate_db_from_media_to_config() { # Find config file in yaml or yml, but prefer yaml local config_file="${CONFIG_FILE:-"/config/config.yml"}" local config_file_yaml="${config_file//.yml/.yaml}" @@ -48,7 +87,7 @@ function set_libva_version() { } echo "[INFO] Preparing Frigate..." -migrate_db_path +migrate_db_from_media_to_config set_libva_version echo "[INFO] Starting Frigate..." From 8a329feede4703088bf79524a2953b337df17f1d Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Sun, 9 Mar 2025 15:14:30 -0300 Subject: [PATCH 02/15] Re-implement config migration for the add-on --- .../rootfs/etc/s6-overlay/s6-rc.d/frigate/run | 39 --------------- .../rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run | 50 +++++++++++++++++++ 2 files changed, 50 insertions(+), 39 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run index c27f62d63..e66fa4021 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run @@ -9,45 +9,6 @@ set -o errexit -o nounset -o pipefail # Tell S6-Overlay not to restart this service s6-svc -O . -function migrate_from_homeassistant_config() { - # Find old config file in yaml or yml, but prefer yaml - local ha_config_file="/homeassistant_config/config.yml" - local ha_config_file_yaml="${ha_config_file//.yml/.yaml}" - if [[ -f "${ha_config_file_yaml}" ]]; then - ha_config_file="${ha_config_file_yaml}" - elif [[ ! -f "${ha_config_file}" ]]; then - # Nothing to migrate - return 0 - fi - unset ha_config_file_yaml - - # Confirm there isn't a config yet in the target location - local config_file="${CONFIG_FILE:-"/config/config.yml"}" - local config_file_yaml="${config_file//.yml/.yaml}" - if [[ -f "${config_file_yaml}" || -f "${config_file}" ]]; then - echo "[ERROR] TODO" >&2 - return 1 - fi - unset config_file config_file_yaml - - local db_path - db_path=$(yq eval '.database.path' "${config_file}") - - if [[ "${db_path}" == "null" ]]; then - db_path="/config/frigate.db" - fi - - local previous_db_path="/homeassistant/frigate.db" - if [[ -f "${previous_db_path}" ]]; then - # /config is a mount point, move the db - echo "[INFO] Moving db from '${previous_db_path}' to '${db_path}'..." - # Move all files that starts with frigate.db to the new directory - mv -vf "${previous_db_path}"* "${new_db_dir}" # TODO FIX - fi - - # TODO migrate config -} - function migrate_db_from_media_to_config() { # Find config file in yaml or yml, but prefer yaml local config_file="${CONFIG_FILE:-"/config/config.yml"}" diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run index 2c3a7ab6f..eaff55ef8 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run @@ -50,6 +50,56 @@ function set_libva_version() { export LIBAVFORMAT_VERSION_MAJOR } +function migrate_from_homeassistant_config() { + if ! mountpoint --quiet /homeassistant_config; then + # Not running as a Home Assistant add-on + return 0 + fi + + local new_config_file="/config/config.yml" + local new_config_file_yaml="${new_config_file//.yml/.yaml}" + if [[ -f "${new_config_file_yaml}" || -f "${new_config_file}" ]]; then + # Already migrated + return 0 + fi + unset new_config_file new_config_file_yaml + + local old_config_file="/homeassistant_config/frigate.yml" + local old_config_file_yaml="${old_config_file//.yml/.yaml}" + local new_config_file="/config/config.yml" + if [[ -f "${old_config_file_yaml}" ]]; then + old_config_file="${old_config_file_yaml}" + new_config_file="/config/config.yaml" + elif [[ ! -f "${old_config_file}" ]]; then + # Nothing to migrate + return 0 + fi + unset old_config_file_yaml + + local db_path + db_path=$(yq eval '.database.path' "${old_config_file}") + + if [[ "${db_path}" == "null" ]]; then + db_path="/config/frigate.db" + fi + + if [[ "${db_path}" == /config/* ]]; then + # replace /config/ prefix with /homeassistant_config/ + old_db_path="/homeassistant_config/${db_path:8}" + + if [[ -f "${old_db_path}" ]]; then + new_db_dir="$(dirname "${db_path}")" + echo "[INFO] Migrating database from '${old_db_path}' to '${db_path}'..." + mv -vf "${old_db_path}"* "${new_db_dir}" + fi + fi + + echo "[INFO] Migrating config from '${old_config_file}' to '${new_config_file}'..." + mv -vf "${old_config_file}" "${new_config_file}" +} + +migrate_from_homeassistant_config + set_libva_version if [[ -f "/dev/shm/go2rtc.yaml" ]]; then From 31dd1c2c78e5bdb41b1112f7a3128578a3f6a30c Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Sun, 9 Mar 2025 15:18:16 -0300 Subject: [PATCH 03/15] Align some terms --- docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run | 10 +++++----- docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run index e66fa4021..dddde74cd 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run @@ -26,16 +26,16 @@ function migrate_db_from_media_to_config() { user_db_path=$(yq eval '.database.path' "${config_file}") if [[ "${user_db_path}" == "null" ]]; then - local previous_db_path="/media/frigate/frigate.db" + local old_db_path="/media/frigate/frigate.db" local new_db_dir="/config" - if [[ -f "${previous_db_path}" ]]; then + if [[ -f "${old_db_path}" ]]; then if mountpoint --quiet "${new_db_dir}"; then # /config is a mount point, move the db - echo "[INFO] Moving db from '${previous_db_path}' to the '${new_db_dir}' dir..." + echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." # Move all files that starts with frigate.db to the new directory - mv -vf "${previous_db_path}"* "${new_db_dir}" + mv -vf "${old_db_path}"* "${new_db_dir}" else - echo "[ERROR] Trying to migrate the db path from '${previous_db_path}' to the '${new_db_dir}' dir, but '${new_db_dir}' is not a mountpoint, please mount the '${new_db_dir}' dir" + echo "[ERROR] Trying to migrate the database path from '${old_db_path}' to '${new_db_dir}' dir, but '${new_db_dir}' is not a mountpoint, please mount the '${new_db_dir}' dir" return 1 fi fi diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run index eaff55ef8..7a2c0121d 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run @@ -89,7 +89,7 @@ function migrate_from_homeassistant_config() { if [[ -f "${old_db_path}" ]]; then new_db_dir="$(dirname "${db_path}")" - echo "[INFO] Migrating database from '${old_db_path}' to '${db_path}'..." + echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." mv -vf "${old_db_path}"* "${new_db_dir}" fi fi From b399ac13ad44a3e231ca6b45d1198523741aec49 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Sun, 9 Mar 2025 15:20:37 -0300 Subject: [PATCH 04/15] Improve function name --- docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run index 7a2c0121d..09658761a 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run @@ -50,7 +50,7 @@ function set_libva_version() { export LIBAVFORMAT_VERSION_MAJOR } -function migrate_from_homeassistant_config() { +function migrate_addon_config_dir() { if ! mountpoint --quiet /homeassistant_config; then # Not running as a Home Assistant add-on return 0 @@ -98,7 +98,7 @@ function migrate_from_homeassistant_config() { mv -vf "${old_config_file}" "${new_config_file}" } -migrate_from_homeassistant_config +migrate_addon_config_dir set_libva_version From a3d95ebfb2cebc39ac240fc76fb6d953188c5b7f Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Sun, 9 Mar 2025 15:38:14 -0300 Subject: [PATCH 05/15] Use local variables --- docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run index 09658761a..9e3996d1c 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run @@ -85,9 +85,10 @@ function migrate_addon_config_dir() { if [[ "${db_path}" == /config/* ]]; then # replace /config/ prefix with /homeassistant_config/ - old_db_path="/homeassistant_config/${db_path:8}" + local old_db_path="/homeassistant_config/${db_path:8}" if [[ -f "${old_db_path}" ]]; then + local new_db_dir new_db_dir="$(dirname "${db_path}")" echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." mv -vf "${old_db_path}"* "${new_db_dir}" From 7ccf3fc2658dad707a06bb44910d7ace5011d99b Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Sun, 9 Mar 2025 15:53:22 -0300 Subject: [PATCH 06/15] Add model.path migration --- .../rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run index 9e3996d1c..31c713533 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run @@ -78,11 +78,9 @@ function migrate_addon_config_dir() { local db_path db_path=$(yq eval '.database.path' "${old_config_file}") - if [[ "${db_path}" == "null" ]]; then db_path="/config/frigate.db" fi - if [[ "${db_path}" == /config/* ]]; then # replace /config/ prefix with /homeassistant_config/ local old_db_path="/homeassistant_config/${db_path:8}" @@ -91,10 +89,26 @@ function migrate_addon_config_dir() { local new_db_dir new_db_dir="$(dirname "${db_path}")" echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." + mkdir -p "${new_db_dir}" mv -vf "${old_db_path}"* "${new_db_dir}" fi fi + local model_path + model_path=$(yq eval '.model.path' "${old_config_file}") + if [[ "${model_path}" == /config/* ]]; then + # replace /config/ prefix with /homeassistant_config/ + local old_model_path="/homeassistant_config/${model_path:8}" + + if [[ -f "${old_model_path}" ]]; then + local new_model_dir + new_model_dir="$(dirname "${model_path}")" + echo "[INFO] Migrating model from '${old_model_path}' to '${model_path}'..." + mkdir -p "${new_model_dir}" + mv -vf "${old_model_path}" "${model_path}" + fi + fi + echo "[INFO] Migrating config from '${old_config_file}' to '${new_config_file}'..." mv -vf "${old_config_file}" "${new_config_file}" } From e7954fbd89eabc73ce5d0d3062ff7a99bcc24776 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Wed, 12 Mar 2025 23:00:04 -0300 Subject: [PATCH 07/15] Fix homeassistant config path --- docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run index 31c713533..67148b73c 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run @@ -51,7 +51,7 @@ function set_libva_version() { } function migrate_addon_config_dir() { - if ! mountpoint --quiet /homeassistant_config; then + if ! mountpoint --quiet /homeassistant; then # Not running as a Home Assistant add-on return 0 fi @@ -64,7 +64,7 @@ function migrate_addon_config_dir() { fi unset new_config_file new_config_file_yaml - local old_config_file="/homeassistant_config/frigate.yml" + local old_config_file="/homeassistant/frigate.yml" local old_config_file_yaml="${old_config_file//.yml/.yaml}" local new_config_file="/config/config.yml" if [[ -f "${old_config_file_yaml}" ]]; then @@ -82,8 +82,8 @@ function migrate_addon_config_dir() { db_path="/config/frigate.db" fi if [[ "${db_path}" == /config/* ]]; then - # replace /config/ prefix with /homeassistant_config/ - local old_db_path="/homeassistant_config/${db_path:8}" + # replace /config/ prefix with /homeassistant/ + local old_db_path="/homeassistant/${db_path:8}" if [[ -f "${old_db_path}" ]]; then local new_db_dir @@ -97,8 +97,8 @@ function migrate_addon_config_dir() { local model_path model_path=$(yq eval '.model.path' "${old_config_file}") if [[ "${model_path}" == /config/* ]]; then - # replace /config/ prefix with /homeassistant_config/ - local old_model_path="/homeassistant_config/${model_path:8}" + # replace /config/ prefix with /homeassistant/ + local old_model_path="/homeassistant/${model_path:8}" if [[ -f "${old_model_path}" ]]; then local new_model_dir From f94b5f13228db638bc46d34d5125e4f46ac59a52 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Wed, 12 Mar 2025 23:25:05 -0300 Subject: [PATCH 08/15] Ensure migration scripts run before go2rtc and frigate --- .../rootfs/etc/s6-overlay/s6-rc.d/frigate/run | 35 +----- .../go2rtc/dependencies.d/{base => prepare} | 0 .../rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run | 65 ----------- .../s6-rc.d/prepare/dependencies.d/base | 0 .../rootfs/etc/s6-overlay/s6-rc.d/prepare/run | 106 ++++++++++++++++++ .../etc/s6-overlay/s6-rc.d/prepare/type | 1 + .../rootfs/etc/s6-overlay/s6-rc.d/prepare/up | 1 + 7 files changed, 109 insertions(+), 99 deletions(-) rename docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/dependencies.d/{base => prepare} (100%) create mode 100644 docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/dependencies.d/base create mode 100755 docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run create mode 100644 docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/type create mode 100644 docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/up diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run index dddde74cd..a3a34e4f6 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run @@ -9,39 +9,6 @@ set -o errexit -o nounset -o pipefail # Tell S6-Overlay not to restart this service s6-svc -O . -function migrate_db_from_media_to_config() { - # Find config file in yaml or yml, but prefer yaml - local config_file="${CONFIG_FILE:-"/config/config.yml"}" - local config_file_yaml="${config_file//.yml/.yaml}" - if [[ -f "${config_file_yaml}" ]]; then - config_file="${config_file_yaml}" - elif [[ ! -f "${config_file}" ]]; then - # Frigate will create the config file on startup - return 0 - fi - unset config_file_yaml - - # Use yq to check if database.path is set - local user_db_path - user_db_path=$(yq eval '.database.path' "${config_file}") - - if [[ "${user_db_path}" == "null" ]]; then - local old_db_path="/media/frigate/frigate.db" - local new_db_dir="/config" - if [[ -f "${old_db_path}" ]]; then - if mountpoint --quiet "${new_db_dir}"; then - # /config is a mount point, move the db - echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." - # Move all files that starts with frigate.db to the new directory - mv -vf "${old_db_path}"* "${new_db_dir}" - else - echo "[ERROR] Trying to migrate the database path from '${old_db_path}' to '${new_db_dir}' dir, but '${new_db_dir}' is not a mountpoint, please mount the '${new_db_dir}' dir" - return 1 - fi - fi - fi -} - function set_libva_version() { local ffmpeg_path ffmpeg_path=$(python3 /usr/local/ffmpeg/get_ffmpeg_path.py) @@ -50,8 +17,8 @@ function set_libva_version() { } echo "[INFO] Preparing Frigate..." -migrate_db_from_media_to_config set_libva_version + echo "[INFO] Starting Frigate..." cd /opt/frigate || echo "[ERROR] Failed to change working directory to /opt/frigate" diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/dependencies.d/base b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/dependencies.d/prepare similarity index 100% rename from docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/dependencies.d/base rename to docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/dependencies.d/prepare diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run index 67148b73c..2c3a7ab6f 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run @@ -50,71 +50,6 @@ function set_libva_version() { export LIBAVFORMAT_VERSION_MAJOR } -function migrate_addon_config_dir() { - if ! mountpoint --quiet /homeassistant; then - # Not running as a Home Assistant add-on - return 0 - fi - - local new_config_file="/config/config.yml" - local new_config_file_yaml="${new_config_file//.yml/.yaml}" - if [[ -f "${new_config_file_yaml}" || -f "${new_config_file}" ]]; then - # Already migrated - return 0 - fi - unset new_config_file new_config_file_yaml - - local old_config_file="/homeassistant/frigate.yml" - local old_config_file_yaml="${old_config_file//.yml/.yaml}" - local new_config_file="/config/config.yml" - if [[ -f "${old_config_file_yaml}" ]]; then - old_config_file="${old_config_file_yaml}" - new_config_file="/config/config.yaml" - elif [[ ! -f "${old_config_file}" ]]; then - # Nothing to migrate - return 0 - fi - unset old_config_file_yaml - - local db_path - db_path=$(yq eval '.database.path' "${old_config_file}") - if [[ "${db_path}" == "null" ]]; then - db_path="/config/frigate.db" - fi - if [[ "${db_path}" == /config/* ]]; then - # replace /config/ prefix with /homeassistant/ - local old_db_path="/homeassistant/${db_path:8}" - - if [[ -f "${old_db_path}" ]]; then - local new_db_dir - new_db_dir="$(dirname "${db_path}")" - echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." - mkdir -p "${new_db_dir}" - mv -vf "${old_db_path}"* "${new_db_dir}" - fi - fi - - local model_path - model_path=$(yq eval '.model.path' "${old_config_file}") - if [[ "${model_path}" == /config/* ]]; then - # replace /config/ prefix with /homeassistant/ - local old_model_path="/homeassistant/${model_path:8}" - - if [[ -f "${old_model_path}" ]]; then - local new_model_dir - new_model_dir="$(dirname "${model_path}")" - echo "[INFO] Migrating model from '${old_model_path}' to '${model_path}'..." - mkdir -p "${new_model_dir}" - mv -vf "${old_model_path}" "${model_path}" - fi - fi - - echo "[INFO] Migrating config from '${old_config_file}' to '${new_config_file}'..." - mv -vf "${old_config_file}" "${new_config_file}" -} - -migrate_addon_config_dir - set_libva_version if [[ -f "/dev/shm/go2rtc.yaml" ]]; then diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/dependencies.d/base b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/dependencies.d/base new file mode 100644 index 000000000..e69de29bb diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run new file mode 100755 index 000000000..3f6e7f248 --- /dev/null +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run @@ -0,0 +1,106 @@ +#!/command/with-contenv bash +# shellcheck shell=bash +# Do preparation tasks before starting the main services + +set -o errexit -o nounset -o pipefail + +function migrate_addon_config_dir() { + if ! mountpoint --quiet /homeassistant; then + # Not running as a Home Assistant add-on + return 0 + fi + + local new_config_file="/config/config.yml" + local new_config_file_yaml="${new_config_file//.yml/.yaml}" + if [[ -f "${new_config_file_yaml}" || -f "${new_config_file}" ]]; then + # Already migrated + return 0 + fi + unset new_config_file new_config_file_yaml + + local old_config_file="/homeassistant/frigate.yml" + local old_config_file_yaml="${old_config_file//.yml/.yaml}" + local new_config_file="/config/config.yml" + if [[ -f "${old_config_file_yaml}" ]]; then + old_config_file="${old_config_file_yaml}" + new_config_file="/config/config.yaml" + elif [[ ! -f "${old_config_file}" ]]; then + # Nothing to migrate + return 0 + fi + unset old_config_file_yaml + + local db_path + db_path=$(yq eval '.database.path' "${old_config_file}") + if [[ "${db_path}" == "null" ]]; then + db_path="/config/frigate.db" + fi + if [[ "${db_path}" == /config/* ]]; then + # replace /config/ prefix with /homeassistant/ + local old_db_path="/homeassistant/${db_path:8}" + + if [[ -f "${old_db_path}" ]]; then + local new_db_dir + new_db_dir="$(dirname "${db_path}")" + echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." + mkdir -p "${new_db_dir}" + mv -vf "${old_db_path}"* "${new_db_dir}" + fi + fi + + local model_path + model_path=$(yq eval '.model.path' "${old_config_file}") + if [[ "${model_path}" == /config/* ]]; then + # replace /config/ prefix with /homeassistant/ + local old_model_path="/homeassistant/${model_path:8}" + + if [[ -f "${old_model_path}" ]]; then + local new_model_dir + new_model_dir="$(dirname "${model_path}")" + echo "[INFO] Migrating model from '${old_model_path}' to '${model_path}'..." + mkdir -p "${new_model_dir}" + mv -vf "${old_model_path}" "${model_path}" + fi + fi + + echo "[INFO] Migrating config from '${old_config_file}' to '${new_config_file}'..." + mv -vf "${old_config_file}" "${new_config_file}" +} + +function migrate_db_from_media_to_config() { + # Find config file in yaml or yml, but prefer yaml + local config_file="${CONFIG_FILE:-"/config/config.yml"}" + local config_file_yaml="${config_file//.yml/.yaml}" + if [[ -f "${config_file_yaml}" ]]; then + config_file="${config_file_yaml}" + elif [[ ! -f "${config_file}" ]]; then + # Frigate will create the config file on startup + return 0 + fi + unset config_file_yaml + + # Use yq to check if database.path is set + local user_db_path + user_db_path=$(yq eval '.database.path' "${config_file}") + + if [[ "${user_db_path}" == "null" ]]; then + local old_db_path="/media/frigate/frigate.db" + local new_db_dir="/config" + if [[ -f "${old_db_path}" ]]; then + if mountpoint --quiet "${new_db_dir}"; then + # /config is a mount point, move the db + echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." + # Move all files that starts with frigate.db to the new directory + mv -vf "${old_db_path}"* "${new_db_dir}" + else + echo "[ERROR] Trying to migrate the database path from '${old_db_path}' to '${new_db_dir}' dir, but '${new_db_dir}' is not a mountpoint, please mount the '${new_db_dir}' dir" + return 1 + fi + fi + fi +} + +echo "[INFO] Preparing Frigate..." + +migrate_addon_config_dir +migrate_db_from_media_to_config diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/type b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/type new file mode 100644 index 000000000..bdd22a185 --- /dev/null +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/type @@ -0,0 +1 @@ +oneshot diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/up b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/up new file mode 100644 index 000000000..ea17af548 --- /dev/null +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/prepare/run From 06f1317a74eb7d3df84a801b53131f4d50d20c34 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Wed, 12 Mar 2025 23:56:59 -0300 Subject: [PATCH 09/15] Migrate all files I know --- .../rootfs/etc/s6-overlay/s6-rc.d/prepare/run | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run index 3f6e7f248..b57aad294 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run @@ -5,12 +5,15 @@ set -o errexit -o nounset -o pipefail function migrate_addon_config_dir() { - if ! mountpoint --quiet /homeassistant; then + local home_assistant_config_dir="/homeassistant" + + if ! mountpoint --quiet "${home_assistant_config_dir}"; then # Not running as a Home Assistant add-on return 0 fi - local new_config_file="/config/config.yml" + local config_dir="/config" + local new_config_file="${config_dir}/config.yml" local new_config_file_yaml="${new_config_file//.yml/.yaml}" if [[ -f "${new_config_file_yaml}" || -f "${new_config_file}" ]]; then # Already migrated @@ -18,12 +21,12 @@ function migrate_addon_config_dir() { fi unset new_config_file new_config_file_yaml - local old_config_file="/homeassistant/frigate.yml" + local old_config_file="${home_assistant_config_dir}/frigate.yml" local old_config_file_yaml="${old_config_file//.yml/.yaml}" - local new_config_file="/config/config.yml" + local new_config_file="${config_dir}/config.yml" if [[ -f "${old_config_file_yaml}" ]]; then old_config_file="${old_config_file_yaml}" - new_config_file="/config/config.yaml" + new_config_file="${new_config_file//.yml/.yaml}" elif [[ ! -f "${old_config_file}" ]]; then # Nothing to migrate return 0 @@ -33,11 +36,11 @@ function migrate_addon_config_dir() { local db_path db_path=$(yq eval '.database.path' "${old_config_file}") if [[ "${db_path}" == "null" ]]; then - db_path="/config/frigate.db" + db_path="${config_dir}/frigate.db" fi if [[ "${db_path}" == /config/* ]]; then # replace /config/ prefix with /homeassistant/ - local old_db_path="/homeassistant/${db_path:8}" + local old_db_path="${home_assistant_config_dir}/${db_path:8}" if [[ -f "${old_db_path}" ]]; then local new_db_dir @@ -52,7 +55,7 @@ function migrate_addon_config_dir() { model_path=$(yq eval '.model.path' "${old_config_file}") if [[ "${model_path}" == /config/* ]]; then # replace /config/ prefix with /homeassistant/ - local old_model_path="/homeassistant/${model_path:8}" + local old_model_path="${home_assistant_config_dir}/${model_path:8}" if [[ -f "${old_model_path}" ]]; then local new_model_dir @@ -63,8 +66,23 @@ function migrate_addon_config_dir() { fi fi + echo "[INFO] Migrating miscellaneous files '${home_assistant_config_dir}' to '${config_dir}'..." + local file + for file in .exports .jwt_secret .timeline .vacuum go2rtc; do + if [[ -f "${home_assistant_config_dir}/${file}" ]]; then + mv -vf "${home_assistant_config_dir}/${file}" "${config_dir}" + fi + done + file="${home_assistant_config_dir}/model_cache" + if [[ -d "${file}" ]]; then + echo "[INFO] Migrating '${file}' to '${config_dir}'..." + mv -f "${file}" "${config_dir}" + fi + echo "[INFO] Migrating config from '${old_config_file}' to '${new_config_file}'..." mv -vf "${old_config_file}" "${new_config_file}" + + echo "[INFO] Migration from Home Assistant config dir to add-on config dir completed." } function migrate_db_from_media_to_config() { From f40996892565445fe86a12f9824431725556dc5b Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Thu, 13 Mar 2025 00:15:45 -0300 Subject: [PATCH 10/15] Add ffmpeg.path migration --- .../rootfs/etc/s6-overlay/s6-rc.d/prepare/run | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run index b57aad294..bbe2af2f3 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run @@ -38,7 +38,7 @@ function migrate_addon_config_dir() { if [[ "${db_path}" == "null" ]]; then db_path="${config_dir}/frigate.db" fi - if [[ "${db_path}" == /config/* ]]; then + if [[ "${db_path}" == "${config_dir}/"* ]]; then # replace /config/ prefix with /homeassistant/ local old_db_path="${home_assistant_config_dir}/${db_path:8}" @@ -46,14 +46,14 @@ function migrate_addon_config_dir() { local new_db_dir new_db_dir="$(dirname "${db_path}")" echo "[INFO] Migrating database from '${old_db_path}' to '${new_db_dir}' dir..." - mkdir -p "${new_db_dir}" + mkdir -vp "${new_db_dir}" mv -vf "${old_db_path}"* "${new_db_dir}" fi fi local model_path model_path=$(yq eval '.model.path' "${old_config_file}") - if [[ "${model_path}" == /config/* ]]; then + if [[ "${model_path}" == "${config_dir}/"* ]]; then # replace /config/ prefix with /homeassistant/ local old_model_path="${home_assistant_config_dir}/${model_path:8}" @@ -61,11 +61,26 @@ function migrate_addon_config_dir() { local new_model_dir new_model_dir="$(dirname "${model_path}")" echo "[INFO] Migrating model from '${old_model_path}' to '${model_path}'..." - mkdir -p "${new_model_dir}" + mkdir -vp "${new_model_dir}" mv -vf "${old_model_path}" "${model_path}" fi fi + local ffmpeg_path + ffmpeg_path=$(yq eval '.ffmpeg.path' "${old_config_file}") + if [[ "${ffmpeg_path}" == "${config_dir}/"* ]]; then + # replace /config/ prefix with /homeassistant/ + local old_ffmpeg_path="${home_assistant_config_dir}/${ffmpeg_path:8}" + + if [[ -d "${old_ffmpeg_path}" ]]; then + local new_ffmpeg_dir + new_ffmpeg_dir="$(dirname "${ffmpeg_path}")" + echo "[INFO] Migrating model from '${old_ffmpeg_path}' to '${ffmpeg_path}'..." + mkdir -vp "${new_ffmpeg_dir}" + mv -vf "${old_ffmpeg_path}" "${ffmpeg_path}" + fi + fi + echo "[INFO] Migrating miscellaneous files '${home_assistant_config_dir}' to '${config_dir}'..." local file for file in .exports .jwt_secret .timeline .vacuum go2rtc; do @@ -97,7 +112,6 @@ function migrate_db_from_media_to_config() { fi unset config_file_yaml - # Use yq to check if database.path is set local user_db_path user_db_path=$(yq eval '.database.path' "${config_file}") From 15e7b4fd541ae6d060ea5c2eb0b6ee995dc7e02f Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Thu, 13 Mar 2025 00:54:13 -0300 Subject: [PATCH 11/15] Update docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> --- docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run index bbe2af2f3..2d1fece15 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run @@ -75,7 +75,7 @@ function migrate_addon_config_dir() { if [[ -d "${old_ffmpeg_path}" ]]; then local new_ffmpeg_dir new_ffmpeg_dir="$(dirname "${ffmpeg_path}")" - echo "[INFO] Migrating model from '${old_ffmpeg_path}' to '${ffmpeg_path}'..." + echo "[INFO] Migrating ffmpeg from '${old_ffmpeg_path}' to '${ffmpeg_path}'..." mkdir -vp "${new_ffmpeg_dir}" mv -vf "${old_ffmpeg_path}" "${ffmpeg_path}" fi From 07eaaebebf814cac5b89c1168e33f3f64a031d05 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Thu, 13 Mar 2025 00:59:15 -0300 Subject: [PATCH 12/15] Improve some variable names and organization --- .../rootfs/etc/s6-overlay/s6-rc.d/prepare/run | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run index 2d1fece15..6b52bc848 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/prepare/run @@ -81,20 +81,22 @@ function migrate_addon_config_dir() { fi fi - echo "[INFO] Migrating miscellaneous files '${home_assistant_config_dir}' to '${config_dir}'..." - local file - for file in .exports .jwt_secret .timeline .vacuum go2rtc; do - if [[ -f "${home_assistant_config_dir}/${file}" ]]; then - mv -vf "${home_assistant_config_dir}/${file}" "${config_dir}" - fi - done - file="${home_assistant_config_dir}/model_cache" - if [[ -d "${file}" ]]; then - echo "[INFO] Migrating '${file}' to '${config_dir}'..." - mv -f "${file}" "${config_dir}" + local old_model_cache_path="${home_assistant_config_dir}/model_cache" + if [[ -d "${old_model_cache_path}" ]]; then + echo "[INFO] Migrating '${old_model_cache_path}' to '${config_dir}'..." + mv -f "${old_model_cache_path}" "${config_dir}" fi - echo "[INFO] Migrating config from '${old_config_file}' to '${new_config_file}'..." + echo "[INFO] Migrating other files from '${home_assistant_config_dir}' to '${config_dir}'..." + local file + for file in .exports .jwt_secret .timeline .vacuum go2rtc; do + file="${home_assistant_config_dir}/${file}" + if [[ -f "${file}" ]]; then + mv -vf "${file}" "${config_dir}" + fi + done + + echo "[INFO] Migrating config file from '${old_config_file}' to '${new_config_file}'..." mv -vf "${old_config_file}" "${new_config_file}" echo "[INFO] Migration from Home Assistant config dir to add-on config dir completed." From 0df5e19b9ee8bbc4a17ec6ef4befc32bf0db5545 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Fri, 21 Mar 2025 19:42:33 -0300 Subject: [PATCH 13/15] Update docs to reflect addon config dir --- docs/docs/configuration/live.md | 4 ++-- docs/docs/frigate/installation.md | 27 +++++++++++++++++------- docs/docs/guides/ha_network_storage.md | 6 ------ docs/docs/integrations/home-assistant.md | 14 ++++++------ 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/docs/docs/configuration/live.md b/docs/docs/configuration/live.md index 42809739a..a6dfca9e9 100644 --- a/docs/docs/configuration/live.md +++ b/docs/docs/configuration/live.md @@ -104,9 +104,9 @@ cameras: WebRTC works by creating a TCP or UDP connection on port `8555`. However, it requires additional configuration: - For external access, over the internet, setup your router to forward port `8555` to port `8555` on the Frigate device, for both TCP and UDP. -- For internal/local access, unless you are running through the add-on, you will also need to set the WebRTC candidates list in the go2rtc config. For example, if `192.168.1.10` is the local IP of the device running Frigate: +- For internal/local access, unless you are running through the HassOS addon, you will also need to set the WebRTC candidates list in the go2rtc config. For example, if `192.168.1.10` is the local IP of the device running Frigate: - ```yaml title="/config/frigate.yaml" + ```yaml title="/config/config.yaml" go2rtc: streams: test_cam: ... diff --git a/docs/docs/frigate/installation.md b/docs/docs/frigate/installation.md index b270df5ff..9489e566b 100644 --- a/docs/docs/frigate/installation.md +++ b/docs/docs/frigate/installation.md @@ -281,18 +281,29 @@ HassOS users can install via the addon repository. 2. Add https://github.com/blakeblackshear/frigate-hass-addons 3. Install your desired Frigate NVR Addon and navigate to it's page 4. Setup your network configuration in the `Configuration` tab -5. (not for proxy addon) Create the file `frigate.yaml` in your `config` directory with your detailed Frigate configuration +5. (not for proxy addon) Create the file `config.yaml` in your `/addon_configs/ccab4aaf_frigate` directory with your detailed Frigate configuration (see below for more details on how to access this directory) 6. Start the addon container 7. (not for proxy addon) If you are using hardware acceleration for ffmpeg, you may need to disable "Protection mode" -There are several versions of the addon available: +There are several variants of the addon available: -| Addon Version | Description | -| ------------------------------ | ---------------------------------------------------------- | -| Frigate NVR | Current release with protection mode on | -| Frigate NVR (Full Access) | Current release with the option to disable protection mode | -| Frigate NVR Beta | Beta release with protection mode on | -| Frigate NVR Beta (Full Access) | Beta release with the option to disable protection mode | +| Addon Version | Description | +| -------------------------- | ---------------------------------------------------------- | +| Frigate | Current release with protection mode on | +| Frigate (Full Access) | Current release with the option to disable protection mode | +| Frigate Beta | Beta release with protection mode on | +| Frigate Beta (Full Access) | Beta release with the option to disable protection mode | +| Frigate HailoRT Beta | Beta release with HailoRT support | + +:::info Accessing Frigate's `/config` directory + +When running Frigate through the HA addon, the Frigate `/config` directory is mapped to a directory in the host inside `/addon_configs`. The directory name depends on the addon variant you are using. For example, if you are using the standard Frigate addon, the directory will be `/addon_configs/ccab4aaf_frigate`. + +**Whenever you see `/config` in the documentation, it refers to this directory.** + +If for example you use the [VS Code addon](https://github.com/hassio-addons/addon-vscode) to browse your files, you can click _File_ > _Open folder..._ and navigate to `/addon_configs/ccab4aaf_frigate` to access the Frigate `/config` directory. + +::: ## Kubernetes diff --git a/docs/docs/guides/ha_network_storage.md b/docs/docs/guides/ha_network_storage.md index fe00311ab..021e5210d 100644 --- a/docs/docs/guides/ha_network_storage.md +++ b/docs/docs/guides/ha_network_storage.md @@ -15,12 +15,6 @@ As of Home Assistant Core 2023.6, Network Mounted Storage is supported for addon ### Initial Setup 1. Stop the Frigate addon -2. Update your [config](configuration/index.md) so the DB is stored in the /config directory by adding: - -```yaml -database: - path: /config/frigate.db -``` ### Move current data diff --git a/docs/docs/integrations/home-assistant.md b/docs/docs/integrations/home-assistant.md index 19330b6b8..f4a3ec815 100644 --- a/docs/docs/integrations/home-assistant.md +++ b/docs/docs/integrations/home-assistant.md @@ -97,13 +97,13 @@ services: If you are using HassOS with the addon, the URL should be one of the following depending on which addon version you are using. Note that if you are using the Proxy Addon, you do NOT point the integration at the proxy URL. Just enter the URL used to access Frigate directly from your network. -| Addon Version | URL | -| ------------------------------ | ----------------------------------------- | -| Frigate NVR | `http://ccab4aaf-frigate:5000` | -| Frigate NVR (Full Access) | `http://ccab4aaf-frigate-fa:5000` | -| Frigate NVR Beta | `http://ccab4aaf-frigate-beta:5000` | -| Frigate NVR Beta (Full Access) | `http://ccab4aaf-frigate-fa-beta:5000` | -| Frigate NVR HailoRT Beta | `http://ccab4aaf-frigate-hailo-beta:5000` | +| Addon Version | URL | +| -------------------------- | ----------------------------------------- | +| Frigate | `http://ccab4aaf-frigate:5000` | +| Frigate (Full Access) | `http://ccab4aaf-frigate-fa:5000` | +| Frigate Beta | `http://ccab4aaf-frigate-beta:5000` | +| Frigate Beta (Full Access) | `http://ccab4aaf-frigate-fa-beta:5000` | +| Frigate HailoRT Beta | `http://ccab4aaf-frigate-hailo-beta:5000` | ### Frigate running on a separate machine From 7fcff5c3cf7b6bb724f385da182a76071beaed2c Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Fri, 21 Mar 2025 19:45:01 -0300 Subject: [PATCH 14/15] Update live.md with /addon_configs --- docs/docs/configuration/live.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/configuration/live.md b/docs/docs/configuration/live.md index a6dfca9e9..86a061006 100644 --- a/docs/docs/configuration/live.md +++ b/docs/docs/configuration/live.md @@ -106,7 +106,7 @@ WebRTC works by creating a TCP or UDP connection on port `8555`. However, it req - For external access, over the internet, setup your router to forward port `8555` to port `8555` on the Frigate device, for both TCP and UDP. - For internal/local access, unless you are running through the HassOS addon, you will also need to set the WebRTC candidates list in the go2rtc config. For example, if `192.168.1.10` is the local IP of the device running Frigate: - ```yaml title="/config/config.yaml" + ```yaml title="/addon_configs/ccab4aaf_frigate/config.yaml" go2rtc: streams: test_cam: ... From 4b1afcaf8507ae2012e1f68b365f198143be0827 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Fri, 21 Mar 2025 19:59:51 -0300 Subject: [PATCH 15/15] Move addon config section to configuration doc --- docs/docs/configuration/hardware_acceleration.md | 6 +++--- docs/docs/configuration/index.md | 14 ++++++++++++-- docs/docs/frigate/installation.md | 12 +----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/docs/configuration/hardware_acceleration.md b/docs/docs/configuration/hardware_acceleration.md index e3bff0a0e..fc01abc02 100644 --- a/docs/docs/configuration/hardware_acceleration.md +++ b/docs/docs/configuration/hardware_acceleration.md @@ -14,7 +14,7 @@ Depending on your system, these parameters may not be compatible. More informati ## Raspberry Pi 3/4 Ensure you increase the allocated RAM for your GPU to at least 128 (`raspi-config` > Performance Options > GPU Memory). -If you are using the HA addon, you may need to use the full access variant and turn off `Protection mode` for hardware acceleration. +If you are using the HassOS addon, you may need to use the full access variant and turn off `Protection mode` for hardware acceleration. ```yaml # if you want to decode a h264 stream @@ -80,7 +80,7 @@ Or map in all the `/dev/video*` devices. :::note -The default driver is `iHD`. You may need to change the driver to `i965` by adding the following environment variable `LIBVA_DRIVER_NAME=i965` to your docker-compose file or [in the `frigate.yaml` for HA OS users](advanced.md#environment_vars). +The default driver is `iHD`. You may need to change the driver to `i965` by adding the following environment variable `LIBVA_DRIVER_NAME=i965` to your docker-compose file or [in the `config.yaml` for HassOS addon users](advanced.md#environment_vars). See [The Intel Docs](https://www.intel.com/content/www/us/en/support/articles/000005505/processors.html) to figure out what generation your CPU is. @@ -191,7 +191,7 @@ VAAPI supports automatic profile selection so it will work automatically with bo :::note -You need to change the driver to `radeonsi` by adding the following environment variable `LIBVA_DRIVER_NAME=radeonsi` to your docker-compose file or [in the `frigate.yaml` for HA OS users](advanced.md#environment_vars). +You need to change the driver to `radeonsi` by adding the following environment variable `LIBVA_DRIVER_NAME=radeonsi` to your docker-compose file or [in the `config.yaml` for HassOS addon users](advanced.md#environment_vars). ::: diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index a60da3499..fb185971b 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -3,9 +3,11 @@ id: index title: Frigate Configuration --- -For Home Assistant Addon installations, the config file needs to be in the root of your Home Assistant config directory (same location as `configuration.yaml`). It can be named `frigate.yaml` or `frigate.yml`, but if both files exist `frigate.yaml` will be preferred and `frigate.yml` will be ignored. +For HassOS addon installations, the config file should be at `/addon_configs/ccab4aaf_frigate/config.yaml` ([click here to learn more on how to access this directory](#accessing-addon-config)). -For all other installation types, the config file should be mapped to `/config/config.yml` inside the container. +For all other installation types, the config file should be mapped to `/config/config.yaml` inside the container. + +It can be named `config.yaml` or `config.yml`, but if both files exist `config.yaml` will be preferred and `config.yml` will be ignored. It is recommended to start with a minimal configuration and add to it as described in [this guide](../guides/getting_started.md) and use the built in configuration editor in Frigate's UI which supports validation. @@ -23,6 +25,14 @@ cameras: - detect ``` +## Accessing the HassOS addon configuration directory {#accessing-addon-config} + +When running Frigate through the HassOS addon, the Frigate `/config` directory is mapped to a directory in the host inside `/addon_configs`. The directory name depends on the addon variant you are using. For example, if you are using the standard Frigate addon variant, the directory will be `/addon_configs/ccab4aaf_frigate`. + +**Whenever you see `/config` in the documentation, it refers to this directory.** + +If for example you use the [VS Code addon](https://github.com/hassio-addons/addon-vscode) to browse your files, you can click _File_ > _Open folder..._ and navigate to `/addon_configs/ccab4aaf_frigate` to access the Frigate `/config` directory. + ## VSCode Configuration Schema VSCode supports JSON schemas for automatically validating configuration files. You can enable this feature by adding `# yaml-language-server: $schema=http://frigate_host:5000/api/config/schema.json` to the beginning of the configuration file. Replace `frigate_host` with the IP address or hostname of your Frigate server. If you're using both VSCode and Frigate as an add-on, you should use `ccab4aaf-frigate` instead. Make sure to expose the internal unauthenticated port `5000` when accessing the config from VSCode on another machine. diff --git a/docs/docs/frigate/installation.md b/docs/docs/frigate/installation.md index 9489e566b..58d46ccd2 100644 --- a/docs/docs/frigate/installation.md +++ b/docs/docs/frigate/installation.md @@ -281,7 +281,7 @@ HassOS users can install via the addon repository. 2. Add https://github.com/blakeblackshear/frigate-hass-addons 3. Install your desired Frigate NVR Addon and navigate to it's page 4. Setup your network configuration in the `Configuration` tab -5. (not for proxy addon) Create the file `config.yaml` in your `/addon_configs/ccab4aaf_frigate` directory with your detailed Frigate configuration (see below for more details on how to access this directory) +5. (not for proxy addon) Create the file `config.yaml` in your `/addon_configs/ccab4aaf_frigate` directory with your detailed Frigate configuration ([click here to learn more on how to access this directory](../configuration/index.md#accessing-addon-config)) 6. Start the addon container 7. (not for proxy addon) If you are using hardware acceleration for ffmpeg, you may need to disable "Protection mode" @@ -295,16 +295,6 @@ There are several variants of the addon available: | Frigate Beta (Full Access) | Beta release with the option to disable protection mode | | Frigate HailoRT Beta | Beta release with HailoRT support | -:::info Accessing Frigate's `/config` directory - -When running Frigate through the HA addon, the Frigate `/config` directory is mapped to a directory in the host inside `/addon_configs`. The directory name depends on the addon variant you are using. For example, if you are using the standard Frigate addon, the directory will be `/addon_configs/ccab4aaf_frigate`. - -**Whenever you see `/config` in the documentation, it refers to this directory.** - -If for example you use the [VS Code addon](https://github.com/hassio-addons/addon-vscode) to browse your files, you can click _File_ > _Open folder..._ and navigate to `/addon_configs/ccab4aaf_frigate` to access the Frigate `/config` directory. - -::: - ## Kubernetes Use the [helm chart](https://github.com/blakeblackshear/blakeshome-charts/tree/master/charts/frigate).