konfiguracja dla dodatku home assistant

This commit is contained in:
2025-11-03 09:44:01 +01:00
parent 5b40b4b76c
commit 8818b4efc2
3 changed files with 20 additions and 13 deletions

View File

@@ -10,8 +10,8 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . . COPY . .
# Make entrypoint script executable # Upewnij się, że skrypt entrypoint.sh jest wykonywalny
RUN chmod +x /app/entrypoint.sh RUN chmod a+x /app/entrypoint.sh
# Set the entrypoint # Uruchom skrypt entrypoint, który zajmie się resztą
ENTRYPOINT ["/app/entrypoint.sh"] CMD ["/app/entrypoint.sh"]

View File

@@ -11,5 +11,7 @@ arch:
init: false init: false
startup: application startup: application
boot: auto boot: auto
options: {} options:
schema: [] credentials_json: ""
schema:
credentials_json: text

View File

@@ -1,11 +1,16 @@
#!/bin/bash #!/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 crontab /app/crontab
echo "✅ Zadania crona zostały załadowane."
# Create the log file and set permissions # Uruchom usługę cron na pierwszym planie, aby kontener się nie zamknął
touch /var/log/cron.log echo "🚀 Uruchamiam usługę cron..."
chmod 0666 /var/log/cron.log cron -f
# Start cron in the foreground
cron -f