Sign inSign up

joel85/bambu-turn-off-safe

By joel85

•Updated about 1 month ago

Auto power off your Bambu Lab P1S after printing and cooldown via Smart Life.

Image
0

120

joel85/bambu-turn-off-safe repository overview

⁠Bambu Turn Off Safe

Automatically trigger a Smart Life power-off automation after your Bambu Lab P1S finishes printing and cools down. Runs as a lightweight Docker container—no Home Assistant required.

⁠How it works
  1. Monitors printer status through Bambu Cloud.
  2. Waits for successful completion, 100% progress, a cooled nozzle and disabled heaters.
  3. Requires these conditions to remain stable for 30 seconds.
  4. Sends a temporary TuyaLink signal that triggers your Smart Life automation.
⁠Features
  • Encrypted, authenticated cloud connections.
  • Read-only web dashboard for printer and connection status.
  • Checks for missing or stale telemetry.
  • Persistent protection against duplicate triggers.
  • Non-root container with a health check.
  • Demo mode without cloud credentials.
⁠Requirements
  • Bambu Lab P1S connected to Bambu Cloud.
  • Smart Life-compatible power plug.
  • TuyaLink device credentials and a configured Smart Life automation.
  • Docker host supporting linux/amd64, including compatible QNAP NAS devices.
⁠Available images
docker pull joel85/bambu-turn-off-safe:latest

For a fixed version:

docker pull joel85/bambu-turn-off-safe:v0.0.1

Defaults to demo mode. Live operation requires Bambu and TuyaLink credentials.

⁠Important

The application sends an automation signal; Smart Life controls the plug. Cloud delays and outages can affect execution. Test with a notification before enabling power-off, and avoid starting another print while shutdown is pending.

The dashboard has no authentication and is intended for trusted private networks.

⁠Environment variables

Set MODE=live to enable cloud connections. The default demo mode uses simulated printer data and sends no cloud signals.

VariableDescription
MODEdemo or live. Default: demo.
BAMBU_REGIONBambu account region: global or china. Default: global.
BAMBU_SERIALPrinter serial number. Required in live mode.
BAMBU_USERNAMEBambu MQTT username (u_…), not your email address. Required in live mode.
BAMBU_ACCESS_TOKENBambu Cloud access token, not the printer LAN access code. Required in live mode.
TUYA_DEVICE_IDID of your dedicated TuyaLink device. Required in live mode.
TUYA_DEVICE_SECRETSecret of your dedicated TuyaLink device. Required in live mode.
TUYA_MQTT_HOSTMQTT endpoint matching your TuyaLink data center. Default: m1.tuyaeu.com.
TUYA_PROPERTY_CODEBoolean property used as the Smart Life trigger. Default: bambu_off.
SAFE_NOZZLE_TEMPERATUREMaximum nozzle temperature before triggering, in °C. Allowed: 1–50.
STABLE_SECONDSTime all shutdown conditions must remain satisfied. Default: 30; allowed: 30–3600 seconds.
PULSE_SECONDSDuration of the local ON signal. Default: 30; allowed: 1–120 seconds.
MAX_DATA_AGE_SECONDSMaximum nozzle reading age and gap between relevant printer reports. Default: 60; allowed: 5–120 seconds.

Use TuyaLink credentials for the virtual trigger device, not credentials for your physical power plug.

⁠Example .env
MODE=live
BAMBU_REGION=global
BAMBU_SERIAL=your_printer_serial
BAMBU_USERNAME=u_your_mqtt_username
BAMBU_ACCESS_TOKEN='your_bambu_cloud_token'

TUYA_DEVICE_ID=your_tuyalink_device_id
TUYA_DEVICE_SECRET='your_tuyalink_device_secret'
TUYA_MQTT_HOST=m1.tuyaeu.com
TUYA_PROPERTY_CODE=bambu_off

SAFE_NOZZLE_TEMPERATURE=38
STABLE_SECONDS=30
PULSE_SECONDS=30
MAX_DATA_AGE_SECONDS=60

BIND_IP=127.0.0.1
PORT=8080

BIND_IP and PORT are settings for the project's Compose file. To access the dashboard from your trusted LAN, set BIND_IP to your NAS LAN address.

Set the temperature explicitly: the application and example file default to 38 °C, while the Compose fallback is 30 °C.

Keep .env private. Persist /data in a Docker volume to retain duplicate-trigger protection across container replacements.

Tag summary

Content type

Image

Digest

sha256:b8e63810f…

Size

41.2 MB

Last updated

about 1 month ago

docker pull joel85/bambu-turn-off-safe