Update with main

This commit is contained in:
Meatballs1
2024-03-19 12:31:31 +00:00
5 changed files with 30 additions and 19 deletions

16
Dockerfile Normal file
View File

@@ -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 HCxml2json.py ./
ENTRYPOINT ["python3"]
CMD ["hc2mqtt", "/config/config.json"]

View File

@@ -41,7 +41,13 @@ Installing `sslpsk` needs some extra steps:
![laptop in a clothes washer with a display DoorState:Closed](images/doorclose.jpg) ![laptop in a clothes washer with a display DoorState:Closed](images/doorclose.jpg)
```bash ```bash
hc-login $USERNAME $PASSWORD > devices.json hc-login $USERNAME $PASSWORD > config/devices.json
```
or
```bash
docker-compose run -T app hc-login $USERNAME $PASSWORD > config/devices.json
``` ```
The `hc-login` script perfoms the OAuth process to login to your The `hc-login` script perfoms the OAuth process to login to your
@@ -425,20 +431,3 @@ Synchronize with time server, `false` is disabled
## FRIDA tools ## FRIDA tools
Moved to [`README-frida.md`](README-frida.md) Moved to [`README-frida.md`](README-frida.md)
## Home assistant
For integration with Home Assistant, the following MQTT sensor can be used to create a read only sensor
```yaml
- unique_id: "coffee_machine"
name: "Coffee Machine"
state_topic: "homeconnect/coffeemaker/state"
value_template: "{{ value_json.PowerState }}"
json_attributes_topic: "homeconnect/coffeemaker/state"
json_attributes_template: "{{ value_json | tojson }}"
```
## Notes
- Sometimes when the device is off, there is the error `ERROR [ip] [Errno 113] No route to host`
- There is a lot more information available, like the status of a program that is currently active. This needs to be integrated if possible. For now only the values that relate to the `config.json` are published

6
compose.yaml Normal file
View File

@@ -0,0 +1,6 @@
services:
app:
build: .
restart: on-failure
volumes:
- ./config:/config

0
config/.gitkeep Normal file
View File

View File

@@ -136,7 +136,7 @@ while True:
# get the ReturnUrl from the response # get the ReturnUrl from the response
query = parse_qs(urlparse(preauth_url).query) query = parse_qs(urlparse(preauth_url).query)
return_url = query["returnUrl"][0] return_url = query["ReturnUrl"][0]
debug(f"{return_url=}") debug(f"{return_url=}")
if "X-CSRF-FORM-TOKEN" in r.cookies: if "X-CSRF-FORM-TOKEN" in r.cookies: