From 28f8477686e25777e67dadf7c6df1dc9837fa4cf Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Thu, 12 Sep 2024 15:52:58 +0000 Subject: [PATCH 1/3] Fix devcontainer with original devcontainer --- .devcontainer/Dockerfile | 11 +-- .devcontainer/config/configuration.yaml | 10 +-- .devcontainer/devcontainer.json | 90 ++++++++++--------- .devcontainer/frigate.yml | 21 ++--- .../preconfig/.storage/core.config_entries | 15 ++++ .../preconfig/.storage/lovelace.frigate | 13 +++ .../preconfig/.storage/lovelace_dashboards | 18 ++++ docker-compose.yml | 7 +- 8 files changed, 107 insertions(+), 78 deletions(-) create mode 100644 .devcontainer/preconfig/.storage/lovelace.frigate create mode 100644 .devcontainer/preconfig/.storage/lovelace_dashboards diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 79222b16..4b24e916 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,12 +1,3 @@ -# syntax=docker/dockerfile:1.2 +FROM mcr.microsoft.com/devcontainers/python:1-3.10 -FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.10 - -# Install Docker -ENV DOCKER_BUILDKIT="1" -# https://github.com/microsoft/vscode-dev-containers/commits/main/script-library/docker-debian.sh -ARG DOCKER_SCRIPT_VERSION="364972b0d7d20ee5de40c1084e65f3f1bc6d5951" -RUN bash -c "$(curl -fsSL "https://raw.githubusercontent.com/microsoft/vscode-dev-containers/${DOCKER_SCRIPT_VERSION}/script-library/docker-debian.sh")" \ - && rm -rf /var/lib/apt/lists/* -ENTRYPOINT ["/usr/local/share/docker-init.sh"] CMD ["sleep", "infinity"] diff --git a/.devcontainer/config/configuration.yaml b/.devcontainer/config/configuration.yaml index c3505d9d..3857abc6 100644 --- a/.devcontainer/config/configuration.yaml +++ b/.devcontainer/config/configuration.yaml @@ -7,6 +7,7 @@ homeassistant: longitude: 0 elevation: 0 unit_system: metric + country: US currency: USD time_zone: "America/Los_Angeles" auth_providers: @@ -25,12 +26,3 @@ logger: logs: custom_components.frigate: debug homeassistant.components.mqtt: error - -downloader: - download_dir: www - -panel_iframe: - frigate: - title: "Frigate" - url: "http://localhost:5000" - icon: "mdi:cctv" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1a308487..42fe0608 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,10 +1,14 @@ { "dockerComposeFile": "../docker-compose.yml", - "service": "dev", + "service": "devcontainer", + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { + "moby": false + } + }, "workspaceFolder": "${localWorkspaceFolder}", - "shutdownAction": "stopCompose", - "initializeCommand": ".devcontainer/set_dot_env.sh", - "postCreateCommand": ".devcontainer/post_create.sh", + "initializeCommand": [".devcontainer/set_dot_env.sh"], + "postCreateCommand": [".devcontainer/post_create.sh"], "forwardPorts": ["hass:8123", "frigate:5000"], "portsAttributes": { "hass:8123": { @@ -16,44 +20,46 @@ "onAutoForward": "silent" } }, - "extensions": [ - "ms-python.python", - "visualstudioexptteam.vscodeintellicode", - "mhutchie.git-graph", - "ms-azuretools.vscode-docker", - "streetsidesoftware.code-spell-checker", - "eamodio.gitlens", - "esbenp.prettier-vscode", - "ms-python.vscode-pylance", - "redhat.vscode-yaml", - "keesschollaart.vscode-home-assistant", - "ms-azuretools.vscode-docker" - ], - "settings": { - "python.defaultInterpreterPath": "/usr/local/bin/python", - "editor.formatOnPaste": false, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true, - "yaml.schemas": { - "http://frigate:5000/api/config/schema": "/frigate.yml" - }, - "files.associations": { - "**/config/*configuration.yaml": "home-assistant" - }, - "vscode-home-assistant.hostUrl": "http://hass:8123", - "vscode-home-assistant.longLivedAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhOTZjZTdhYTg0YzU0ODcxYWZhNTJmYmU4OWFmMjg3OSIsImlhdCI6MTY1NDgwNzk2MiwiZXhwIjoxOTcwMTY3OTYyfQ.0JUxrtqWWj-FwkAujcQCc5aRq9sf5_uR_sCI2eWcmIE", - "[home-assistant]": { - "editor.defaultFormatter": "keesschollaart.vscode-home-assistant" - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[jsonc]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[yaml]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "visualstudioexptteam.vscodeintellicode", + "mhutchie.git-graph", + "ms-azuretools.vscode-docker", + "streetsidesoftware.code-spell-checker", + "eamodio.gitlens", + "esbenp.prettier-vscode", + "ms-python.vscode-pylance", + "redhat.vscode-yaml", + "keesschollaart.vscode-home-assistant", + "ms-azuretools.vscode-docker" + ], + "settings": { + "python.defaultInterpreterPath": "~/.local/bin/python", + "editor.formatOnSave": true, + "files.trimTrailingWhitespace": true, + "yaml.schemas": { + "http://frigate:5000/api/config/schema.json": "/frigate.yml" + }, + "files.associations": { + "**/config/*configuration.yaml": "home-assistant" + }, + "vscode-home-assistant.hostUrl": "http://hass:8123", + "vscode-home-assistant.longLivedAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhOTZjZTdhYTg0YzU0ODcxYWZhNTJmYmU4OWFmMjg3OSIsImlhdCI6MTY1NDgwNzk2MiwiZXhwIjoxOTcwMTY3OTYyfQ.0JUxrtqWWj-FwkAujcQCc5aRq9sf5_uR_sCI2eWcmIE", + "[home-assistant]": { + "editor.defaultFormatter": "keesschollaart.vscode-home-assistant" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[yaml]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } + } } } } diff --git a/.devcontainer/frigate.yml b/.devcontainer/frigate.yml index 8e56c0dc..6b8ebcbd 100644 --- a/.devcontainer/frigate.yml +++ b/.devcontainer/frigate.yml @@ -6,26 +6,23 @@ detectors: type: cpu mqtt: host: mqtt +go2rtc: + streams: + big_buck_bunny: + # yamllint disable-line rule:line-length + - exec:ffmpeg -re -stream_loop -1 -i https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_h264.mov -c copy -rtsp_transport tcp -f rtsp {{output}} cameras: big_buck_bunny: ffmpeg: inputs: - - path: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 + - path: rtsp://127.0.0.1:8554/big_buck_bunny + input_args: preset-rtsp-restream-low-latency roles: - - rtmp - detect - record - # yamllint disable-line rule:line-length - input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 + - audio output_args: - # yamllint disable-line rule:line-length - record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -an - rtmp: -c:v libx264 -an -f flv - detect: - width: 240 - height: 160 - live: - height: 160 + record: preset-record-generic-audio-copy objects: track: - cat diff --git a/.devcontainer/preconfig/.storage/core.config_entries b/.devcontainer/preconfig/.storage/core.config_entries index 7119daaa..30688d8e 100644 --- a/.devcontainer/preconfig/.storage/core.config_entries +++ b/.devcontainer/preconfig/.storage/core.config_entries @@ -17,6 +17,21 @@ "unique_id": null, "disabled_by": null }, + { + "entry_id": "8b281b7667ce4609b26a74ea5e6d7221", + "version": 1, + "domain": "downloader", + "title": "Downloader", + "data": { + "download_dir": "www" + }, + "options": {}, + "pref_disable_new_entities": false, + "pref_disable_polling": false, + "source": "import", + "unique_id": null, + "disabled_by": null + }, { "entry_id": "77b4c17dc9f77ba49cea06fb3f517b59", "version": 1, diff --git a/.devcontainer/preconfig/.storage/lovelace.frigate b/.devcontainer/preconfig/.storage/lovelace.frigate new file mode 100644 index 00000000..0df8e97e --- /dev/null +++ b/.devcontainer/preconfig/.storage/lovelace.frigate @@ -0,0 +1,13 @@ +{ + "version": 1, + "minor_version": 1, + "key": "lovelace.frigate", + "data": { + "config": { + "strategy": { + "type": "iframe", + "url": "http://localhost:5000" + } + } + } +} \ No newline at end of file diff --git a/.devcontainer/preconfig/.storage/lovelace_dashboards b/.devcontainer/preconfig/.storage/lovelace_dashboards new file mode 100644 index 00000000..a61ab444 --- /dev/null +++ b/.devcontainer/preconfig/.storage/lovelace_dashboards @@ -0,0 +1,18 @@ +{ + "version": 1, + "minor_version": 1, + "key": "lovelace_dashboards", + "data": { + "items": [ + { + "id": "frigate", + "url_path": "frigate", + "icon": "mdi:cctv", + "require_admin": false, + "title": "Frigate", + "show_in_sidebar": true, + "mode": "storage" + } + ] + } +} diff --git a/docker-compose.yml b/docker-compose.yml index 72b73f16..90c89815 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,7 @@ --- -version: "3" - services: - dev: + devcontainer: build: .devcontainer - user: vscode init: true env_file: - .env @@ -24,7 +21,7 @@ services: - ./custom_components:/config/custom_components:ro frigate: privileged: true - image: "ghcr.io/blakeblackshear/frigate:${FRIGATE_VERSION:-0.12.0-rc1}" + image: "ghcr.io/blakeblackshear/frigate:${FRIGATE_VERSION:-stable}" restart: unless-stopped devices: - /dev/bus/usb:/dev/bus/usb From 91498dc5dc479cea33805250f75c147e5f8418ef Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Thu, 12 Sep 2024 15:57:56 +0000 Subject: [PATCH 2/3] Restore some settings --- .devcontainer/devcontainer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 42fe0608..ff415689 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -36,8 +36,10 @@ "ms-azuretools.vscode-docker" ], "settings": { - "python.defaultInterpreterPath": "~/.local/bin/python", + "python.defaultInterpreterPath": "/usr/local/bin/python", + "editor.formatOnPaste": false, "editor.formatOnSave": true, + "editor.formatOnType": true, "files.trimTrailingWhitespace": true, "yaml.schemas": { "http://frigate:5000/api/config/schema.json": "/frigate.yml" From 74ed5e6948001347d35c292cd9c6862d2ebc6c39 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Thu, 12 Sep 2024 13:01:50 -0300 Subject: [PATCH 3/3] Add missing new line to lovelace.frigate --- .devcontainer/preconfig/.storage/lovelace.frigate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/preconfig/.storage/lovelace.frigate b/.devcontainer/preconfig/.storage/lovelace.frigate index 0df8e97e..b470178d 100644 --- a/.devcontainer/preconfig/.storage/lovelace.frigate +++ b/.devcontainer/preconfig/.storage/lovelace.frigate @@ -10,4 +10,4 @@ } } } -} \ No newline at end of file +}