diff --git a/.gitignore b/.gitignore index f70efb2..5441317 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ #docker-compose file, because it contains passwords config.yml config.yaml +config/config.yaml +config/config.yml # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/Dockerfile-i386 b/Dockerfile-i386 index 7590c9e..dbd7fa7 100644 --- a/Dockerfile-i386 +++ b/Dockerfile-i386 @@ -7,6 +7,5 @@ RUN pip install --upgrade pip && pip install -r /requirements.txt WORKDIR /app COPY src /app -ADD config.yaml /app/ CMD ["python", "-u", "/app/main.py"] diff --git a/Dockerfile-x64 b/Dockerfile-x64 index de655a2..88b00e0 100644 --- a/Dockerfile-x64 +++ b/Dockerfile-x64 @@ -7,6 +7,5 @@ RUN pip install --upgrade pip && pip install -r /requirements.txt WORKDIR /app COPY src /app -ADD config.yaml /app/ CMD ["python", "-u", "/app/main.py"] diff --git a/config/config-sample.yaml b/config/config-sample.yaml new file mode 100644 index 0000000..8f4c316 --- /dev/null +++ b/config/config-sample.yaml @@ -0,0 +1,40 @@ +mqtt: + server: 192.168.1.2 + port: 1883 + username: username + password: passw0rd + prefix: home + +gateway: + password: passw0rd + +sids: + # motion + 158d0000e7c7ad: + model: motion + name: hall + + # temperature + 158d0001149b3c: + model: sensor_ht + name: living + + # plugs + 158d00010dd98d: + model: plug + name: heater + + # buttons + 158d00012d5720: + model: switch + name: kitchen + + # cube + 158d00011065e3: + model: cube + name: main + + # gateway + f0b429aa1463: + model: gateway + name: main diff --git a/docker-compose.yaml b/docker-compose.yaml index 0ce016d..853c203 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,5 +2,7 @@ xiaomi: build: . dockerfile: Dockerfile-i386 container_name: xiaomi + volumes: + - "./config:/app/config" net: host restart: always diff --git a/src/main.py b/src/main.py index f7cc0bb..1117e68 100644 --- a/src/main.py +++ b/src/main.py @@ -46,7 +46,7 @@ def process_mqtt_messages(gateway, client): if __name__ == "__main__": _LOGGER.info("Loading config file...") - config=yamlparser.load_yaml('config.yaml') + config=yamlparser.load_yaml('config/config.yaml') gateway_pass = yamlparser.get_gateway_password(config) _LOGGER.info("Init mqtt client.")