From 17fa302bf91d436f9ae3d744a502ae1225c8e3d6 Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Wed, 24 May 2023 19:46:48 +0000 Subject: [PATCH 1/8] Added READMEs --- README.md | 34 ++++++++++++++++++++++++++++++++++ ankerctl/README.md | 26 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 README.md create mode 100644 ankerctl/README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..3f47507 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# ankermgmt hassio addons repository +## Installation + +[![Add repository on my Home Assistant][repository-badge]][repository-url] + +If you want to do add the repository manually, please follow the procedure highlighted in the [Home Assistant website](https://home-assistant.io/hassio/installing_third_party_addons). Use the following URL to add this repository: https://github.com/ankermgmt/ankermgmt-hassio-addons + +## Add-on provided by this repository + +✓ [ankerctl](ankerctl/) : Monitor your AnkerMake printer + +  ![Version](https://img.shields.io/badge/dynamic/yaml?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Fankermgmt%2Fankermgmt-hassio-addons%2Fmaster%2Fankerctl%2Fconfig.yaml) +![aarch64][aarch64-badge] +![amd64][amd64-badge] +![armv7][armv7-badge] + +## Support + +Got questions? + +You have several options to get them answered: + +- The Home Assistant [Community Forum][forum]. +- This repository issues list + +[aarch64-badge]: https://img.shields.io/badge/aarch64--green.svg?logo=arm +[amd64-badge]: https://img.shields.io/badge/amd64--green.svg?logo=amd +[armv7-badge]: https://img.shields.io/badge/armv7--green.svg?logo=arm +[aarch64no-badge]: https://img.shields.io/badge/aarch64--orange.svg?logo=arm +[amd64no-badge]: https://img.shields.io/badge/amd64--orange.svg?logo=amd +[armv7no-badge]: https://img.shields.io/badge/armv7--orange.svg?logo=arm +[forum]: https://community.home-assistant.io/t/my-custom-repo +[repository-badge]: https://img.shields.io/badge/Add%20repository%20to%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge +[repository-url]: https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fankermgmt%2Fankermgmt-hassio-addons \ No newline at end of file diff --git a/ankerctl/README.md b/ankerctl/README.md new file mode 100644 index 0000000..a15287a --- /dev/null +++ b/ankerctl/README.md @@ -0,0 +1,26 @@ +# Home assistant add-on: ankerctl +![Arch](https://img.shields.io/badge/dynamic/yaml?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Fankermgmt%2Fankermgmt-hassio-addons%2Fmaster%2Fankerctl%2Fconfig.yaml) + +## About +--- +[ankerctl](https://github.com/Ankermgmt/ankermake-m5-protocol) provides a web UI for monitoring your AnkerMake 3D printer. +This addon is based on the docker image provided in https://github.com/Ankermgmt/ankermake-m5-protocol + +## Installation +--- +The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on. + +1. Add this add-ons repository to your Home Assistant instance + [![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fankermgmt%2Fankermgmt-hassio-addons) +2. Install this add-on. +3. Start the add-on. +4. Check the logs of the add-on to see if everything went well. +5. Open the webUI and upload your login.json (see the webUI or [ankerctl](https://github.com/Ankermgmt/ankermake-m5-protocol) for more information.) + +## Configuration +--- +WebUI can be found at (default port is 4470). + +## Support +--- +Create an issue on github \ No newline at end of file From 152170b53ad1169c88fc939e0d7ee6196b6203a6 Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Wed, 24 May 2023 20:11:50 +0000 Subject: [PATCH 2/8] PR comments --- README.md | 4 +--- ankerctl/README.md | 10 +++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3f47507..91deab5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ If you want to do add the repository manually, please follow the procedure highlighted in the [Home Assistant website](https://home-assistant.io/hassio/installing_third_party_addons). Use the following URL to add this repository: https://github.com/ankermgmt/ankermgmt-hassio-addons ## Add-on provided by this repository - ✓ [ankerctl](ankerctl/) : Monitor your AnkerMake printer   ![Version](https://img.shields.io/badge/dynamic/yaml?label=Version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Fankermgmt%2Fankermgmt-hassio-addons%2Fmaster%2Fankerctl%2Fconfig.yaml) @@ -15,7 +14,6 @@ If you want to do add the repository manually, please follow the procedure highl ![armv7][armv7-badge] ## Support - Got questions? You have several options to get them answered: @@ -29,6 +27,6 @@ You have several options to get them answered: [aarch64no-badge]: https://img.shields.io/badge/aarch64--orange.svg?logo=arm [amd64no-badge]: https://img.shields.io/badge/amd64--orange.svg?logo=amd [armv7no-badge]: https://img.shields.io/badge/armv7--orange.svg?logo=arm -[forum]: https://community.home-assistant.io/t/my-custom-repo +[forum]: https://community.home-assistant.io/ [repository-badge]: https://img.shields.io/badge/Add%20repository%20to%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge [repository-url]: https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fankermgmt%2Fankermgmt-hassio-addons \ No newline at end of file diff --git a/ankerctl/README.md b/ankerctl/README.md index a15287a..7a40126 100644 --- a/ankerctl/README.md +++ b/ankerctl/README.md @@ -2,12 +2,10 @@ ![Arch](https://img.shields.io/badge/dynamic/yaml?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Fankermgmt%2Fankermgmt-hassio-addons%2Fmaster%2Fankerctl%2Fconfig.yaml) ## About ---- [ankerctl](https://github.com/Ankermgmt/ankermake-m5-protocol) provides a web UI for monitoring your AnkerMake 3D printer. This addon is based on the docker image provided in https://github.com/Ankermgmt/ankermake-m5-protocol ## Installation ---- The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on. 1. Add this add-ons repository to your Home Assistant instance @@ -15,12 +13,10 @@ The installation of this add-on is pretty straightforward and not different in c 2. Install this add-on. 3. Start the add-on. 4. Check the logs of the add-on to see if everything went well. -5. Open the webUI and upload your login.json (see the webUI or [ankerctl](https://github.com/Ankermgmt/ankermake-m5-protocol) for more information.) +5. Open the web UI and upload your login.json (see the web UI or [ankerctl](https://github.com/Ankermgmt/ankermake-m5-protocol) for more information.) ## Configuration ---- -WebUI can be found at (default port is 4470). +Web UI can be found at (default port is 4470). ## Support ---- -Create an issue on github \ No newline at end of file +Create an issue on GitHub From 56eef1bd6fef627f9e9837bec009290e4fc52b4a Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Wed, 24 May 2023 22:19:10 +0000 Subject: [PATCH 3/8] Made flask_host configurable --- ankerctl/Dockerfile | 22 ++++++++++++++++++---- ankerctl/config.yaml | 8 ++++++-- ankerctl/data/run.sh | 7 +++++++ ankerctl/translations/en.yaml | 6 ++++++ 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 ankerctl/data/run.sh create mode 100644 ankerctl/translations/en.yaml diff --git a/ankerctl/Dockerfile b/ankerctl/Dockerfile index c865247..b8fc2cc 100644 --- a/ankerctl/Dockerfile +++ b/ankerctl/Dockerfile @@ -9,17 +9,31 @@ FROM $BUILD_FROM # 2 Modify Image # ################## +ARG CONFIG_PATH='/data/options.json' + +# Add run.sh +COPY data/run.sh / +RUN chmod a+x /run.sh + # Set S6 wait time ENV S6_CMD_WAIT_FOR_SERVICES=1 \ S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \ - S6_SERVICES_GRACETIME=0 \ - FLASK_HOST=0.0.0.0 \ - FLASK_PORT=4470 + S6_SERVICES_GRACETIME=0 +# FLASK_HOSTE=$(jq --raw-output '.flask_host // empty' $CONFIG_PATH) RUN ln -s /root/.config /config +RUN apt-get update && apt-get install -y jq && rm -rf /var/lib/apt/lists/* + +################ +# 3 Entrypoint # +################ + +ENTRYPOINT ["sh"] +CMD ["/run.sh"] + ############ -# 5 Labels # +# 4 Labels # ############ ARG BUILD_ARCH ARG BUILD_DATE diff --git a/ankerctl/config.yaml b/ankerctl/config.yaml index f9582ac..625f329 100644 --- a/ankerctl/config.yaml +++ b/ankerctl/config.yaml @@ -9,11 +9,15 @@ init: false host_network: true map: - config:rw +options: + flask_host: "0.0.0.0" +schema: + flask_host: str arch: - aarch64 - amd64 - armv7 ports: - "4470": 4470 + 4470/tcp: 4470 ports_description: - "4470": "The webinterface for ankerctl" + 4470/tcp: "The webinterface for ankerctl" diff --git a/ankerctl/data/run.sh b/ankerctl/data/run.sh new file mode 100644 index 0000000..79b646f --- /dev/null +++ b/ankerctl/data/run.sh @@ -0,0 +1,7 @@ +#!/usr/bin/bash + +CONFIG_PATH=/data/options.json + +FLASK_HOST="$(jq --raw-output '.flask_host // empty' $CONFIG_PATH)" + +/app/ankerctl.py webserver run --host="${FLASK_HOST}" diff --git a/ankerctl/translations/en.yaml b/ankerctl/translations/en.yaml new file mode 100644 index 0000000..53548e6 --- /dev/null +++ b/ankerctl/translations/en.yaml @@ -0,0 +1,6 @@ +configuration: + flask_host: + name: "flask bind address" + description: "The address flask should bind to. NOTE: binding to 0.0.0.0 means everyone on your network can control your printer!" +network: + 4470/TCP: The webserver port (Not used for Ingress) From 41dfa429977da4f08e37c9b8bca783935c3581ff Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Wed, 24 May 2023 22:19:42 +0000 Subject: [PATCH 4/8] Changed default value for flask_host --- ankerctl/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ankerctl/config.yaml b/ankerctl/config.yaml index 625f329..30a0154 100644 --- a/ankerctl/config.yaml +++ b/ankerctl/config.yaml @@ -10,7 +10,7 @@ host_network: true map: - config:rw options: - flask_host: "0.0.0.0" + flask_host: "127.0.0.1" schema: flask_host: str arch: From 1add0369b63e5efcf88287148c04fc6c2035b946 Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Wed, 24 May 2023 22:20:37 +0000 Subject: [PATCH 5/8] correct shebang --- ankerctl/data/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ankerctl/data/run.sh b/ankerctl/data/run.sh index 79b646f..d97407c 100644 --- a/ankerctl/data/run.sh +++ b/ankerctl/data/run.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/sh CONFIG_PATH=/data/options.json From c6278966234da9d17ee813caac2ecf05dae4d27a Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Wed, 24 May 2023 22:32:36 +0000 Subject: [PATCH 6/8] Moved add repository badge --- ankerctl/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ankerctl/README.md b/ankerctl/README.md index 7a40126..4d02727 100644 --- a/ankerctl/README.md +++ b/ankerctl/README.md @@ -9,6 +9,7 @@ This addon is based on the docker image provided in https://github.com/Ankermgmt The installation of this add-on is pretty straightforward and not different in comparison to installing any other add-on. 1. Add this add-ons repository to your Home Assistant instance + [![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fankermgmt%2Fankermgmt-hassio-addons) 2. Install this add-on. 3. Start the add-on. From 12b255579843b32dbb3b16f20e56b0eacc234ca8 Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Wed, 24 May 2023 22:55:36 +0000 Subject: [PATCH 7/8] PR comments --- README.md | 3 --- ankerctl/Dockerfile | 3 +-- ankerctl/data/run.sh | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 91deab5..8f1aae1 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,6 @@ You have several options to get them answered: [aarch64-badge]: https://img.shields.io/badge/aarch64--green.svg?logo=arm [amd64-badge]: https://img.shields.io/badge/amd64--green.svg?logo=amd [armv7-badge]: https://img.shields.io/badge/armv7--green.svg?logo=arm -[aarch64no-badge]: https://img.shields.io/badge/aarch64--orange.svg?logo=arm -[amd64no-badge]: https://img.shields.io/badge/amd64--orange.svg?logo=amd -[armv7no-badge]: https://img.shields.io/badge/armv7--orange.svg?logo=arm [forum]: https://community.home-assistant.io/ [repository-badge]: https://img.shields.io/badge/Add%20repository%20to%20my-Home%20Assistant-41BDF5?logo=home-assistant&style=for-the-badge [repository-url]: https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fankermgmt%2Fankermgmt-hassio-addons \ No newline at end of file diff --git a/ankerctl/Dockerfile b/ankerctl/Dockerfile index b8fc2cc..15b71f1 100644 --- a/ankerctl/Dockerfile +++ b/ankerctl/Dockerfile @@ -12,8 +12,7 @@ FROM $BUILD_FROM ARG CONFIG_PATH='/data/options.json' # Add run.sh -COPY data/run.sh / -RUN chmod a+x /run.sh +COPY --chmod=755 data/run.sh / # Set S6 wait time ENV S6_CMD_WAIT_FOR_SERVICES=1 \ diff --git a/ankerctl/data/run.sh b/ankerctl/data/run.sh index d97407c..955b55b 100644 --- a/ankerctl/data/run.sh +++ b/ankerctl/data/run.sh @@ -2,6 +2,6 @@ CONFIG_PATH=/data/options.json -FLASK_HOST="$(jq --raw-output '.flask_host // empty' $CONFIG_PATH)" +export FLASK_HOST="$(jq --raw-output '.flask_host // empty' $CONFIG_PATH)" -/app/ankerctl.py webserver run --host="${FLASK_HOST}" +/app/ankerctl.py webserver run From 2afe02422fd196b5aa28c0754735d329154d3985 Mon Sep 17 00:00:00 2001 From: kvanzuijlen <8818390+kvanzuijlen@users.noreply.github.com> Date: Thu, 25 May 2023 05:15:42 +0000 Subject: [PATCH 8/8] Added note that the addon is still WIP --- README.md | 3 +++ ankerctl/README.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 8f1aae1..7bb4c5f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +> **NOTE** +> The addon in this repository should be considered a work in progress! + # ankermgmt hassio addons repository ## Installation diff --git a/ankerctl/README.md b/ankerctl/README.md index 4d02727..1cf8000 100644 --- a/ankerctl/README.md +++ b/ankerctl/README.md @@ -1,3 +1,6 @@ +> **NOTE** +> The ankerctl addon should be considered a work in progress! + # Home assistant add-on: ankerctl ![Arch](https://img.shields.io/badge/dynamic/yaml?color=success&label=Arch&query=%24.arch&url=https%3A%2F%2Fraw.githubusercontent.com%2Fankermgmt%2Fankermgmt-hassio-addons%2Fmaster%2Fankerctl%2Fconfig.yaml)