From b338ff962394a555fee902298f12e3dcc8c76f5c Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 17:21:45 -0400 Subject: [PATCH 01/17] fixed config syntax error --- root/etc/config/frigate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/config/frigate b/root/etc/config/frigate index 4ed3026..ae5c066 100644 --- a/root/etc/config/frigate +++ b/root/etc/config/frigate @@ -7,7 +7,7 @@ config frigate_config 'docker' config frigate_config 'mqtt' option mqtt 'False' - option host 'mqtt.server.com + option host 'mqtt.server.com' config frigate_config 'detectors' option coral 'True' From 23f1f846276f69376f2988a976df5539a603b1aa Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 17:58:37 -0400 Subject: [PATCH 02/17] frigatered XD --- luasrc/model/frigate.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luasrc/model/frigate.lua b/luasrc/model/frigate.lua index f4d501d..9d2533b 100644 --- a/luasrc/model/frigate.lua +++ b/luasrc/model/frigate.lua @@ -21,7 +21,7 @@ frigate.blocks = function() return vals end -frigatered.home = function() +frigate.home = function() local uci = require "luci.model.uci".cursor() local home_dirs = {} home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/opt/docker2/compose") From 5aec060681aa46d5a4faadc3fa6554eb133dbd50 Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 18:51:23 -0400 Subject: [PATCH 03/17] shell script syntax fix --- root/usr/libexec/apps/frigate/frigate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh index cd5f3c5..3358bb8 100644 --- a/root/usr/libexec/apps/frigate/frigate.sh +++ b/root/usr/libexec/apps/frigate/frigate.sh @@ -140,7 +140,7 @@ EOF uci set shortcutmenu.@lists[-1].weburl="$LAN_IP:$port" uci set shortcutmenu.@lists[-1].webpath="/" uci commit shortcutmenu -} + usage() { echo "usage: $0 sub-command" From 9ff603d6941d9bcc66b4d25900240f01ae8bdf7b Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 18:59:39 -0400 Subject: [PATCH 04/17] Install scrope fix --- root/usr/libexec/apps/frigate/frigate.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh index 3358bb8..330aedc 100644 --- a/root/usr/libexec/apps/frigate/frigate.sh +++ b/root/usr/libexec/apps/frigate/frigate.sh @@ -94,15 +94,15 @@ touch /opt/docker2/compose/frigate/config.yml camera_index=$((camera_index+1)) done -} - #rm -r /opt/docker2/compose/frigate 2>/dev/null - #mkdir -p /opt/docker2/compose/frigate + + rm -r /opt/docker2/compose/frigate 2>/dev/null + mkdir -p /opt/docker2/compose/frigate - #touch /opt/docker2/compose/frigate/config.yml + touch /opt/docker2/compose/frigate/config.yml - #touch /opt/docker2/compose/frigate/docker-compose.yml + touch /opt/docker2/compose/frigate/docker-compose.yml cat > /opt/docker2/compose/frigate/docker-compose.yml < Date: Mon, 18 Sep 2023 19:09:06 -0400 Subject: [PATCH 05/17] status polling in shell script --- root/usr/libexec/apps/frigate/frigate.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh index 330aedc..418bffb 100644 --- a/root/usr/libexec/apps/frigate/frigate.sh +++ b/root/usr/libexec/apps/frigate/frigate.sh @@ -178,7 +178,13 @@ case "${ACTION}" in "status") APP_NAME="frigate" CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}') - docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}' + CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }') + if [ -z "$CONTAINER_STATUS" ]; then + echo "${APP_NAME} is not installed" + else + echo "${CONTAINER_STATUS}" + fi + ;; ;; "port") APP_NAME="frigate" From 5550ff535870b79c5cef88eb6eda2fdbb733ba71 Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 18:59:39 -0400 Subject: [PATCH 06/17] Install scope fix --- root/usr/libexec/apps/frigate/frigate.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh index 3358bb8..330aedc 100644 --- a/root/usr/libexec/apps/frigate/frigate.sh +++ b/root/usr/libexec/apps/frigate/frigate.sh @@ -94,15 +94,15 @@ touch /opt/docker2/compose/frigate/config.yml camera_index=$((camera_index+1)) done -} - #rm -r /opt/docker2/compose/frigate 2>/dev/null - #mkdir -p /opt/docker2/compose/frigate + + rm -r /opt/docker2/compose/frigate 2>/dev/null + mkdir -p /opt/docker2/compose/frigate - #touch /opt/docker2/compose/frigate/config.yml + touch /opt/docker2/compose/frigate/config.yml - #touch /opt/docker2/compose/frigate/docker-compose.yml + touch /opt/docker2/compose/frigate/docker-compose.yml cat > /opt/docker2/compose/frigate/docker-compose.yml < Date: Mon, 18 Sep 2023 19:09:06 -0400 Subject: [PATCH 07/17] status polling in shell script --- root/usr/libexec/apps/frigate/frigate.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh index 330aedc..418bffb 100644 --- a/root/usr/libexec/apps/frigate/frigate.sh +++ b/root/usr/libexec/apps/frigate/frigate.sh @@ -178,7 +178,13 @@ case "${ACTION}" in "status") APP_NAME="frigate" CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}') - docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}' + CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }') + if [ -z "$CONTAINER_STATUS" ]; then + echo "${APP_NAME} is not installed" + else + echo "${CONTAINER_STATUS}" + fi + ;; ;; "port") APP_NAME="frigate" From 9a4e76f4f0dd59afd8eb34272d2f32529b60e616 Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 19:37:16 -0400 Subject: [PATCH 08/17] tiny syntax fix --- root/usr/libexec/apps/frigate/frigate.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh index 418bffb..7603117 100644 --- a/root/usr/libexec/apps/frigate/frigate.sh +++ b/root/usr/libexec/apps/frigate/frigate.sh @@ -185,7 +185,6 @@ case "${ACTION}" in echo "${CONTAINER_STATUS}" fi ;; - ;; "port") APP_NAME="frigate" CONTAINER_NAMES=$(docker ps -a --filter "ancestor=${APP_NAME}" --format '{{.Names}}') From 37af5e9200c82ae58f61783af0704611be94c1c6 Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 19:38:27 -0400 Subject: [PATCH 09/17] made shell script executable --- root/usr/libexec/apps/frigate/frigate.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 root/usr/libexec/apps/frigate/frigate.sh diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh old mode 100644 new mode 100755 From c21660bfe5f0c968abb543a003d652c4842d2449 Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 20:19:22 -0400 Subject: [PATCH 10/17] Fixed triplicated docker and MQTT config sections --- luasrc/model/cbi/frigate.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/luasrc/model/cbi/frigate.lua b/luasrc/model/cbi/frigate.lua index a526cc6..e600665 100644 --- a/luasrc/model/cbi/frigate.lua +++ b/luasrc/model/cbi/frigate.lua @@ -15,7 +15,7 @@ s = m:section(SimpleSection, translate("Service Status"), translate("frigate sta s:append(Template("frigate/status")) -- General Frigate Docker setup -s = m:section(TypedSection, "frigate_config", "Docker Configuration", "General settings for Docker") +s = m:section(NamedSection, "frigate_config", "Docker Configuration", "General settings for Docker") s.addremove = false s.anonymous = true @@ -35,7 +35,7 @@ o = s:option(Value, "storage", "Storage Path") o.default = "./frigate/storage" -- MQTT Configuration -s = m:section(TypedSection, "frigate_config", "MQTT Configuration", "Settings for MQTT") +s = m:section(NamedSection, "frigate_config", "MQTT Configuration", "Settings for MQTT") s.addremove = false s.anonymous = true From da593b557271905e42f7cf2102418f3718344be8 Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 20:19:38 -0400 Subject: [PATCH 11/17] Interface cleanup --- luasrc/model/cbi/frigate.lua | 4 ++-- luasrc/view/frigate/status.htm | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/luasrc/model/cbi/frigate.lua b/luasrc/model/cbi/frigate.lua index e600665..a4859cc 100644 --- a/luasrc/model/cbi/frigate.lua +++ b/luasrc/model/cbi/frigate.lua @@ -9,9 +9,9 @@ local m, s, o m = taskd.docker_map("frigate", "Frigate NVR", "/usr/libexec/apps/frigate/frigate.sh", translate("Frigate"), translate("Frigate is an open-source NVR built around real-time AI object detection. All processing is performed locally on your own hardware.") - .. translate("Official website:") .. ' https://frigate.video/') + .. "
".. translate("Official website:") .. ' https://frigate.video/') -s = m:section(SimpleSection, translate("Service Status"), translate("frigate status:")) +s = m:section(SimpleSection, translate("Container Status") s:append(Template("frigate/status")) -- General Frigate Docker setup diff --git a/luasrc/view/frigate/status.htm b/luasrc/view/frigate/status.htm index 26740c0..ad9bbaa 100644 --- a/luasrc/view/frigate/status.htm +++ b/luasrc/view/frigate/status.htm @@ -5,7 +5,6 @@ local container_running = string.find(string.lower(container_status), "up") and -%>
-
<% if container_running then %> From ccdb8d91391f41acb30d5e92f0da48e60c55fc5a Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 20:23:41 -0400 Subject: [PATCH 12/17] syntax fix --- luasrc/model/cbi/frigate.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luasrc/model/cbi/frigate.lua b/luasrc/model/cbi/frigate.lua index a4859cc..a7d985d 100644 --- a/luasrc/model/cbi/frigate.lua +++ b/luasrc/model/cbi/frigate.lua @@ -11,7 +11,7 @@ m = taskd.docker_map("frigate", "Frigate NVR", "/usr/libexec/apps/frigate/frigat translate("Frigate is an open-source NVR built around real-time AI object detection. All processing is performed locally on your own hardware.") .. "
".. translate("Official website:") .. ' https://frigate.video/') -s = m:section(SimpleSection, translate("Container Status") +s = m:section(SimpleSection, translate("Container Status")) s:append(Template("frigate/status")) -- General Frigate Docker setup From 5fd721e87a5f30b65e9fd72a1c3aee606d6c5de9 Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 20:36:47 -0400 Subject: [PATCH 13/17] Troubleshooting UCI config stuff --- luasrc/model/cbi/frigate.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/luasrc/model/cbi/frigate.lua b/luasrc/model/cbi/frigate.lua index a7d985d..98e7920 100644 --- a/luasrc/model/cbi/frigate.lua +++ b/luasrc/model/cbi/frigate.lua @@ -15,7 +15,7 @@ s = m:section(SimpleSection, translate("Container Status")) s:append(Template("frigate/status")) -- General Frigate Docker setup -s = m:section(NamedSection, "frigate_config", "Docker Configuration", "General settings for Docker") +s = m:section(NamedSection, "docker", "frigate_config", "General settings for Docker") s.addremove = false s.anonymous = true @@ -35,7 +35,7 @@ o = s:option(Value, "storage", "Storage Path") o.default = "./frigate/storage" -- MQTT Configuration -s = m:section(NamedSection, "frigate_config", "MQTT Configuration", "Settings for MQTT") +s = m:section(NamedSection, "mqtt", "frigate_config", "Settings for MQTT") s.addremove = false s.anonymous = true From ee72c62c8c29225e6a0e9e753e07012148331399 Mon Sep 17 00:00:00 2001 From: riley Date: Mon, 18 Sep 2023 21:42:16 -0400 Subject: [PATCH 14/17] UCI refinement --- luasrc/model/cbi/frigate.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luasrc/model/cbi/frigate.lua b/luasrc/model/cbi/frigate.lua index 98e7920..63a0809 100644 --- a/luasrc/model/cbi/frigate.lua +++ b/luasrc/model/cbi/frigate.lua @@ -46,7 +46,7 @@ o = s:option(Value, "host", "MQTT Host") o.default = "mqtt.server.com" -- Detectors Configuration -s = m:section(TypedSection, "frigate_config", "Detectors Configuration", "Settings for Detectors") +s = m:section(NamedSection, "detectors", "frigate_config", "Settings for Detectors") s.addremove = false s.anonymous = true From 07bdcf67034f24e28d63a8a450ff5ea6d90f9b36 Mon Sep 17 00:00:00 2001 From: riley Date: Tue, 19 Sep 2023 23:23:45 -0400 Subject: [PATCH 15/17] Minor Title Changes --- luasrc/model/cbi/frigate.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/luasrc/model/cbi/frigate.lua b/luasrc/model/cbi/frigate.lua index 63a0809..f2ce200 100644 --- a/luasrc/model/cbi/frigate.lua +++ b/luasrc/model/cbi/frigate.lua @@ -15,7 +15,7 @@ s = m:section(SimpleSection, translate("Container Status")) s:append(Template("frigate/status")) -- General Frigate Docker setup -s = m:section(NamedSection, "docker", "frigate_config", "General settings for Docker") +s = m:section(NamedSection, "docker", "frigate_config", "Docker Configuration") s.addremove = false s.anonymous = true @@ -35,7 +35,7 @@ o = s:option(Value, "storage", "Storage Path") o.default = "./frigate/storage" -- MQTT Configuration -s = m:section(NamedSection, "mqtt", "frigate_config", "Settings for MQTT") +s = m:section(NamedSection, "mqtt", "frigate_config", "MQTT Configuration") s.addremove = false s.anonymous = true @@ -46,7 +46,7 @@ o = s:option(Value, "host", "MQTT Host") o.default = "mqtt.server.com" -- Detectors Configuration -s = m:section(NamedSection, "detectors", "frigate_config", "Settings for Detectors") +s = m:section(NamedSection, "detectors", "frigate_config", "TPU Configuration") s.addremove = false s.anonymous = true @@ -60,7 +60,7 @@ o = s:option(Value, "device", "Device") o.default = "usb" -- Camera Configuration -s = m:section(TypedSection, "camera_config", "Camera Configuration", "Settings for Cameras") +s = m:section(TypedSection, "camera_config", "Camera Configuration") s.addremove = true s.anonymous = true s.novaluetext = "There are no cameras configured yet." From b28df2b7ae662d5d44c1c737622c1f1bcff80349 Mon Sep 17 00:00:00 2001 From: riley Date: Tue, 19 Sep 2023 23:51:45 -0400 Subject: [PATCH 16/17] fixed typo --- root/usr/libexec/apps/frigate/frigate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh index 7603117..85c7550 100755 --- a/root/usr/libexec/apps/frigate/frigate.sh +++ b/root/usr/libexec/apps/frigate/frigate.sh @@ -178,7 +178,7 @@ case "${ACTION}" in "status") APP_NAME="frigate" CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}') - CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }') + CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAMES}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }') if [ -z "$CONTAINER_STATUS" ]; then echo "${APP_NAME} is not installed" else From ebf180880d37cc62a2c32d6b19c1066f7ee039d1 Mon Sep 17 00:00:00 2001 From: riley Date: Tue, 19 Sep 2023 23:53:36 -0400 Subject: [PATCH 17/17] changed var name --- root/usr/libexec/apps/frigate/frigate.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/usr/libexec/apps/frigate/frigate.sh b/root/usr/libexec/apps/frigate/frigate.sh index 85c7550..3063f90 100755 --- a/root/usr/libexec/apps/frigate/frigate.sh +++ b/root/usr/libexec/apps/frigate/frigate.sh @@ -177,8 +177,8 @@ case "${ACTION}" in ;; "status") APP_NAME="frigate" - CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}') - CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAMES}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }') + CONTAINER_NAME=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}') + CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }') if [ -z "$CONTAINER_STATUS" ]; then echo "${APP_NAME} is not installed" else