home-assistant-newt-addon/run.sh
Jørgen Ferdinand 17337c1323 First Launch
🚀 Add Home Assistant Newt Add-on

Commit description:

    Added config.yaml for add-on configuration
    Created Dockerfile to build the add-on container
    Implemented run.sh to start and manage the Newt container
    Included a detailed README.md with installation and usage instructions
    Prepared repository for Home Assistant custom add-on support
2025-03-07 21:48:20 +01:00

32 lines
801 B
Bash

#!/usr/bin/env bash
set -e
echo "Starter Newt container..."
# Hent verdier fra Home Assistant config
PANGOLIN_ENDPOINT=$(bashio::config 'PANGOLIN_ENDPOINT')
NEWT_ID=$(bashio::config 'NEWT_ID')
NEWT_SECRET=$(bashio::config 'NEWT_SECRET')
# Sjekk at Docker kjører
if ! docker info >/dev/null 2>&1; then
echo "Docker er ikke tilgjengelig i Home Assistant OS!"
exit 1
fi
# Stopp og fjern gammel container hvis den finnes
if docker ps -a --format '{{.Names}}' | grep -q "newt"; then
docker stop newt
docker rm newt
fi
# Kjør Newt-containeren
docker run -d --restart unless-stopped \
--name newt \
-e PANGOLIN_ENDPOINT="$PANGOLIN_ENDPOINT" \
-e NEWT_ID="$NEWT_ID" \
-e NEWT_SECRET="$NEWT_SECRET" \
fosrl/newt
echo "Newt-container kjører!"
exec tail -f /dev/null