From 17337c1323822cc012cd30ae676c3141a464b8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Ferdinand?= Date: Fri, 7 Mar 2025 21:48:20 +0100 Subject: [PATCH] First Launch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿš€ 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 --- Dockerfile | 10 ++++++ README.md | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++ config.yaml | 21 +++++++++++++ run.sh | 32 +++++++++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 config.yaml create mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f619972 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM ghcr.io/hassio-addons/base:14.0.0 + +# Install dependencies +RUN apk add --no-cache docker-cli + +# Copy the run script +COPY run.sh /run.sh +RUN chmod +x /run.sh + +CMD [ "/run.sh" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..a5228a1 --- /dev/null +++ b/README.md @@ -0,0 +1,89 @@ +# ๐Ÿก Home Assistant Newt Add-on + +## ๐Ÿ“Œ About this Add-on +This Home Assistant add-on allows you to easily run **Newt** from [Fossorial](https://docs.fossorial.io/Newt/overview) directly in Home Assistant. The add-on lets you configure **PANGOLIN_ENDPOINT**, **NEWT_ID**, and **NEWT_SECRET** via the Home Assistant interface. + +## ๐Ÿš€ Features +โœ… Easy installation via Home Assistant Add-on Store +โœ… Automated setup and execution of the Newt container +โœ… Supports `amd64`, `armv7`, `armhf`, and `aarch64` architectures +โœ… Automatic restart on crash + +--- + +## ๐Ÿ› ๏ธ Installation + +### **1๏ธโƒฃ Add the GitHub Repository as an Add-on Source** +1. Go to **Settings โ†’ Add-ons โ†’ Add-on Store**. +2. Click the menu (three dots in the top right) and select **Repositories**. +3. Add the following URL: + ``` + https://github.com/username/home-assistant-newt-addon + ``` +4. Click **Add** and wait for the repository to load. + +### **2๏ธโƒฃ Install and Start the Add-on** +1. Find **Newt Add-on** in the list and click **Install**. +2. Go to the **Configuration** tab and enter your values for: + - **PANGOLIN_ENDPOINT** (e.g., `https://example.com`) + - **NEWT_ID** + - **NEWT_SECRET** +3. Click **Save** and then **Start**. +4. Check the **Logs** tab to verify that everything is running correctly. + +--- + +## โš™๏ธ Configuration +After installation, you can configure the add-on via the Home Assistant UI: + +```yaml +PANGOLIN_ENDPOINT: "https://example.com" +NEWT_ID: "your_newt_id" +NEWT_SECRET: "your_newt_secret" +``` + +### **Docker Environment Variables** +The following environment variables are passed to the `Newt` container: +- `PANGOLIN_ENDPOINT` +- `NEWT_ID` +- `NEWT_SECRET` + +--- + +## ๐Ÿ” Troubleshooting +๐Ÿ’ก **Add-on does not start?** +- Check the logs in Home Assistant (`Settings โ†’ Add-ons โ†’ Newt โ†’ Logs`). +- Ensure that `PANGOLIN_ENDPOINT`, `NEWT_ID`, and `NEWT_SECRET` are set correctly. + +๐Ÿ’ก **Changes in configuration do not take effect?** +- Restart the add-on after making changes. +- Try removing the container manually: + ```sh + docker stop newt + docker rm newt + ``` + Then start the add-on again. + +๐Ÿ’ก **Docker not available?** +- Home Assistant OS manages Docker automatically, but check if the system has access to Docker by running: + ```sh + docker info + ``` + If this fails, there may be a restriction in Home Assistant OS. + +--- + +## ๐Ÿ”— Useful Links +- ๐Ÿ“– [Newt Documentation](https://docs.fossorial.io/Newt/overview) +- ๐Ÿก [Home Assistant](https://www.home-assistant.io/) +- ๐Ÿณ [Docker Docs](https://docs.docker.com/) + +--- + +## โค๏ธ Contribute +Have suggestions for improvements? Create a **Pull Request** or report an issue in the **Issues** tab! + +--- + +ยฉ 2025 - Made with โค๏ธ for Home Assistant users ๐Ÿš€ + diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..c461df5 --- /dev/null +++ b/config.yaml @@ -0,0 +1,21 @@ +name: "Newt Add-on" +version: "1.0.0" +slug: "newt" +description: "Kjรธrer Newt-containeren i Home Assistant" +arch: + - amd64 + - armv7 + - armhf + - aarch64 +startup: "system" +boot: "auto" +host_network: true +privileged: true +options: + PANGOLIN_ENDPOINT: "https://example.com" + NEWT_ID: "your_newt_id" + NEWT_SECRET: "your_newt_secret" +schema: + PANGOLIN_ENDPOINT: "str" + NEWT_ID: "str" + NEWT_SECRET: "str" diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..002b9ab --- /dev/null +++ b/run.sh @@ -0,0 +1,32 @@ +#!/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