-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
All configuration is via environment variables. Copy .env.example to .env and fill in required values.
| Variable | Required | Default | Description |
|---|---|---|---|
BAMBULAB_TRANSPORT |
no | local_mqtt |
Transport: local_mqtt or cloud_mqtt
|
BAMBULAB_HOST |
yes (LAN) | — | Printer IP or hostname |
BAMBULAB_PORT |
no | 8883 |
Printer MQTT TLS port |
BAMBULAB_SERIAL |
yes | — | Printer serial / device ID |
BAMBULAB_ACCESS_CODE |
yes (LAN) | — | Printer LAN access code |
BAMBULAB_USERNAME |
no | bblp |
MQTT username |
| Variable | Required | Default | Description |
|---|---|---|---|
BAMBULAB_CLOUD_USER_ID |
yes (cloud) | — | Cloud user ID |
BAMBULAB_CLOUD_ACCESS_TOKEN |
yes (cloud) | — | Cloud access token |
BAMBULAB_CLOUD_MQTT_HOST |
no | us.mqtt.bambulab.com |
Cloud MQTT broker |
BAMBULAB_CLOUD_MQTT_PORT |
no | 8883 |
Cloud MQTT TLS port |
BAMBULAB_CLOUD_EMAIL |
conditional | — | Required only when cloud credentials are missing or expired (triggers re-auth flow) |
BAMBULAB_CLOUD_CODE |
no | — | Verification code for re-auth |
| Variable | Required | Default | Description |
|---|---|---|---|
BAMBULAB_SECRET_KEY |
yes (cloud) | — | Encryption key for local credentials |
BAMBULAB_CONFIG_DIR |
no | /config/bambulab-metrics-exporter |
Config directory |
BAMBULAB_SECRET_KEY is used to encrypt your Bambu Cloud credentials (token, user ID) before they are saved to the config volume. Without it, cloud mode cannot persist credentials locally.
Generate a strong key with:
openssl rand -hex 32Add the output to your .env:
BAMBULAB_SECRET_KEY=a3f1c8e2d4b7901234567890abcdef1234567890abcdef1234567890abcdef12Safety notes:
- Never commit or share this key. Add
.envto.gitignore.- Keep the key stable. Changing it will invalidate any encrypted credentials on the config volume — you will need to re-run
bambulab-cloud-authto re-authenticate.
| Variable | Required | Default | Description |
|---|---|---|---|
BAMBULAB_REQUEST_PUSHALL |
no | true |
Request full snapshot each poll |
POLLING_INTERVAL_SECONDS |
no | 10 |
Polling interval (seconds) |
REQUEST_TIMEOUT_SECONDS |
no | 8 |
Per-cycle timeout (seconds) |
LISTEN_HOST |
no | 0.0.0.0 |
HTTP bind host |
LISTEN_PORT |
no | 9109 |
HTTP port |
| Variable | Required | Default | Description |
|---|---|---|---|
PRINTER_NAME_LABEL |
no | empty | Canonical custom printer name label; takes priority over all other sources |
BAMBULAB_PRINTER_NAME |
no | auto |
Discovered printer name (auto-persisted) |
Note:
PRINTER_NAME_LABELis the current canonical variable for setting a stable printer label. Older examples or documentation may referencePRINTER_NAME— that name is no longer used. UsePRINTER_NAME_LABELin all new configurations.
Deprecated — no effect:
SITEandLOCATIONvariables appeared in older configurations but are inactive and have no effect. Do not set them; they are ignored by the exporter.
All metrics include printer_name and serial labels.
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL |
INFO |
Python log level (DEBUG, INFO, WARNING, ERROR) |
PUID |
99 |
User ID for container runtime |
PGID |
100 |
Group ID for container runtime |
UMASK |
002 |
File creation mask |
BAMBULAB_TRANSPORT=local_mqtt
BAMBULAB_HOST=192.168.1.100
BAMBULAB_SERIAL=01P00A000000000
BAMBULAB_ACCESS_CODE=12345678BAMBULAB_TRANSPORT=cloud_mqtt
BAMBULAB_SERIAL=01P00A000000000
BAMBULAB_SECRET_KEY=your-strong-key
BAMBULAB_CLOUD_EMAIL=you@example.com
BAMBULAB_CLOUD_USER_ID=<uid>
BAMBULAB_CLOUD_ACCESS_TOKEN=<access_token>
BAMBULAB_CLOUD_MQTT_HOST=us.mqtt.bambulab.comLAN mode: Missing vars → clear error. Connection failure → troubleshooting message.
Cloud mode: Missing/invalid credentials → automatic re-auth triggered.
- Requires
BAMBULAB_CLOUD_EMAIL - If
BAMBULAB_CLOUD_CODEmissing → exporter sends code email and exits with restart instructions - On success → credentials saved encrypted, synced to
.env