# BambuLab MQTT Bridge This project provides a bridge between a BambuLab 3D printer and an MQTT broker. It allows you to forward status and event messages from your printer to any MQTT-compatible system, enabling easy integration with home automation, monitoring, or logging solutions. ## Features - Connects securely to a BambuLab printer via MQTT over TLS - Forwards all printer messages to a target MQTT broker - Supports custom topic prefixing to avoid collisions - Runs as a minimal, secure Docker container (multi-arch: amd64 & arm64) - Configuration via environment variables or `.env` file ## Usage ### 1. Configuration Create a `.env` file in the project directory or provide the following environment variables: ``` PRINTER_IP=192.168.1.100 PRINTER_ACCESS_CODE=your_printer_code PRINTER_SERIAL=your_printer_serial TARGET_BROKER_IP=mqtt.example.com TARGET_PORT=8883 TARGET_USERNAME=mqttuser TARGET_PASSWORD=mqttpassword TARGET_PREFIX=bambulab/ ``` ### 2. Build Docker Image ``` docker build -t bambu-mqtt . ``` ### 3. Run Container ``` docker run --rm \ --env-file .env \ bambu-mqtt ``` Or set environment variables directly with `-e`. ### 4. Portainer/Compose Example ```yaml services: bambu-mqtt: image: git.mars3142.dev/mars3142/bambu_mqtt:latest env_file: - .env restart: unless-stopped ``` ## Development - Python dependencies are managed via `requirements.txt`. - The code is fully commented in English. - The Dockerfile follows best practices: non-root, multi-arch, healthcheck, minimal size. ## Versioning & CI - The Docker image is automatically built and pushed for `amd64` and `arm64` via Gitea Actions. - Image tags are derived from the version label in the Dockerfile. ## License MIT License ## Author Peter Siegmund (mars3142@noreply.mars3142.dev) ChatGPT