From 7a73b7e16413b100b98920851983421e3a89d791 Mon Sep 17 00:00:00 2001 From: Meatballs Date: Tue, 19 Mar 2024 10:22:54 +0000 Subject: [PATCH 1/5] Add basic dockerfile and compose --- Dockerfile | 16 ++++++++++++++++ compose.yaml | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 Dockerfile create mode 100644 compose.yaml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d79fe20 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM python:3.10-slim + +WORKDIR /app + +COPY requirements.txt ./ + +RUN apt-get update && \ + apt-get install -y --no-install-recommends gcc python3-dev libssl-dev && \ + pip3 install -r requirements.txt && \ + apt-get remove -y gcc python3-dev libssl-dev && \ + apt-get autoremove -y + +COPY hc2mqtt hc-login HCDevice.py HCSocket.py ./ + +ENTRYPOINT ["python3"] +CMD ["hc2mqtt", "/config/config.json"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..07c2c2b --- /dev/null +++ b/compose.yaml @@ -0,0 +1,6 @@ +services: + app: + build: . + restart: on-failure + volumes: + - ./config:/config From 842dfd1a98102a36e4cf29f2bd7c3e2818014e7e Mon Sep 17 00:00:00 2001 From: Meatballs Date: Tue, 19 Mar 2024 10:41:56 +0000 Subject: [PATCH 2/5] Add config folder --- config/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 config/.gitkeep diff --git a/config/.gitkeep b/config/.gitkeep new file mode 100644 index 0000000..e69de29 From 88de09f30cdf3ea0b67bad64dbf26ad42a1683fe Mon Sep 17 00:00:00 2001 From: Meatballs Date: Tue, 19 Mar 2024 10:43:11 +0000 Subject: [PATCH 3/5] Update readme to place config file in config dir --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fbcba56..b04b07e 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Installing `sslpsk` needs some extra steps: ![laptop in a clothes washer with a display DoorState:Closed](images/doorclose.jpg) ```bash -hc-login $USERNAME $PASSWORD > config.json +hc-login $USERNAME $PASSWORD > config/config.json ``` The `hc-login` script perfoms the OAuth process to login to your From 1e59c5de0e1864df20142475ec58da87f9957dc8 Mon Sep 17 00:00:00 2001 From: Meatballs Date: Tue, 19 Mar 2024 10:47:47 +0000 Subject: [PATCH 4/5] Initialize config via docker instead of venv if wanted --- Dockerfile | 2 +- README.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d79fe20..c51e929 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apt-get update && \ apt-get remove -y gcc python3-dev libssl-dev && \ apt-get autoremove -y -COPY hc2mqtt hc-login HCDevice.py HCSocket.py ./ +COPY hc2mqtt hc-login HCDevice.py HCSocket.py HCxml2json.py ./ ENTRYPOINT ["python3"] CMD ["hc2mqtt", "/config/config.json"] diff --git a/README.md b/README.md index b04b07e..2660c28 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,12 @@ Installing `sslpsk` needs some extra steps: hc-login $USERNAME $PASSWORD > config/config.json ``` +or + +```bash +docker-compose run app hc-login $USERNAME $PASSWORD > config/config.json +``` + The `hc-login` script perfoms the OAuth process to login to your Home Connect account with your usename and password. It receives a bearer token that can then be used to retrieves From d242f085e5d3ac86e79485f3548297cea5ca411d Mon Sep 17 00:00:00 2001 From: Meatballs Date: Tue, 19 Mar 2024 11:07:22 +0000 Subject: [PATCH 5/5] Disable tty so stderr output doesn't get placed in config.json --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2660c28..e38746c 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ hc-login $USERNAME $PASSWORD > config/config.json or ```bash -docker-compose run app hc-login $USERNAME $PASSWORD > config/config.json +docker-compose run -T app hc-login $USERNAME $PASSWORD > config/config.json ``` The `hc-login` script perfoms the OAuth process to login to your