diff --git a/README.md b/README.md new file mode 100644 index 0000000..7bb4c5f --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +> **NOTE** +> The addon in this repository should be considered a work in progress! + +# 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 +[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 c865247..15b71f1 100644 --- a/ankerctl/Dockerfile +++ b/ankerctl/Dockerfile @@ -9,17 +9,30 @@ FROM $BUILD_FROM # 2 Modify Image # ################## +ARG CONFIG_PATH='/data/options.json' + +# Add run.sh +COPY --chmod=755 data/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/README.md b/ankerctl/README.md new file mode 100644 index 0000000..1cf8000 --- /dev/null +++ b/ankerctl/README.md @@ -0,0 +1,26 @@ +> **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) + +## 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 web UI and upload your login.json (see the web UI or [ankerctl](https://github.com/Ankermgmt/ankermake-m5-protocol) for more information.) + +## Configuration +Web UI can be found at (default port is 4470). + +## Support +Create an issue on GitHub diff --git a/ankerctl/config.yaml b/ankerctl/config.yaml index f9582ac..30a0154 100644 --- a/ankerctl/config.yaml +++ b/ankerctl/config.yaml @@ -9,11 +9,15 @@ init: false host_network: true map: - config:rw +options: + flask_host: "127.0.0.1" +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..955b55b --- /dev/null +++ b/ankerctl/data/run.sh @@ -0,0 +1,7 @@ +#!/usr/bin/sh + +CONFIG_PATH=/data/options.json + +export FLASK_HOST="$(jq --raw-output '.flask_host // empty' $CONFIG_PATH)" + +/app/ankerctl.py webserver run 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)