From 8818b4efc2e3eb47f38eee3e817dbd2b0a63ccbf Mon Sep 17 00:00:00 2001 From: bartool Date: Mon, 3 Nov 2025 09:44:01 +0100 Subject: [PATCH] konfiguracja dla dodatku home assistant --- Dockerfile | 8 ++++---- config.yaml | 6 ++++-- entrypoint.sh | 19 ++++++++++++------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 76c73d3..b98491b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,8 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . . -# Make entrypoint script executable -RUN chmod +x /app/entrypoint.sh +# Upewnij się, że skrypt entrypoint.sh jest wykonywalny +RUN chmod a+x /app/entrypoint.sh -# Set the entrypoint -ENTRYPOINT ["/app/entrypoint.sh"] +# Uruchom skrypt entrypoint, który zajmie się resztą +CMD ["/app/entrypoint.sh"] diff --git a/config.yaml b/config.yaml index 0a90ec8..382557d 100644 --- a/config.yaml +++ b/config.yaml @@ -11,5 +11,7 @@ arch: init: false startup: application boot: auto -options: {} -schema: [] +options: + credentials_json: "" +schema: + credentials_json: text diff --git a/entrypoint.sh b/entrypoint.sh index b233ae6..756b78b 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,11 +1,16 @@ #!/bin/bash +set -e -# Load the cron job +# Odczytaj opcję 'credentials_json' z konfiguracji dodatku i utwórz plik +# Home Assistant udostępnia opcje jako zmienne środowiskowe z prefiksem CONFIG_ +echo "${CONFIG_CREDENTIALS_JSON}" > /app/credentials.json + +echo "✅ Plik credentials.json został utworzony." + +# Dodaj zadania crona z pliku crontab crontab /app/crontab +echo "✅ Zadania crona zostały załadowane." -# Create the log file and set permissions -touch /var/log/cron.log -chmod 0666 /var/log/cron.log - -# Start cron in the foreground -cron -f +# Uruchom usługę cron na pierwszym planie, aby kontener się nie zamknął +echo "🚀 Uruchamiam usługę cron..." +cron -f \ No newline at end of file