commit d98d8b26a3e378a88bce79f77fdfd14dd35c86b3 Author: Frank Adaemmer Date: Tue Nov 29 21:12:24 2022 +0100 initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d1d4e8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3 + +WORKDIR /usr/src/app + +RUN python -m pip install --no-cache-dir maxcube-api paho-mqtt \ + && python -m pip install --no-cache-dir git+https://github.com/copyrights/python-maxcube-api.git@more_to_dict \ + && python -m pip install --no-cache-dir git+https://github.com/copyrights/maxcube-mqtt.git@forDocker + +COPY maxcube.json entrypoint . + +ENTRYPOINT ["./entrypoint"] + +CMD ["maxcube-mqtt","./maxcube.json"] + diff --git a/entrypoint b/entrypoint new file mode 100755 index 0000000..8bb7724 --- /dev/null +++ b/entrypoint @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ -n "$MQTT_HOST" ] +then + sed -i "s|^ \"mqtt_host\": \".*\",| \"mqtt_host\": \"$MQTT_HOST\",|" "maxcube.json" +fi + +if [ -n "$MQTT_PASSWORD" ] +then + sed -i "s|^ \"mqtt_password\": \".*\",| \"mqtt_password\": \"$MQTT_PASSWORD\",|" "maxcube.json" +fi +exec "$@" diff --git a/maxcube.json b/maxcube.json new file mode 100644 index 0000000..a01445d --- /dev/null +++ b/maxcube.json @@ -0,0 +1,10 @@ +{ + "cube_host": "maxcube.lan", + "cube_port": "62910", + "mqtt_client_id": "maxcube", + "mqtt_host": "localhost", + "mqtt_port": "1883", + "mqtt_user": "maxcube", + "mqtt_password": "", + "mqtt_topic_prefix": "heizung" +}