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 . .
# 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"]

View File

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

View File

@@ -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