Skip to content

TFyre/bambu-farm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cannot print with latest firmware

Important

https://wiki.bambulab.com/en/p1/manual/p1p-firmware-release-history

Bambulab decided to block printing via MQTT unless you enable lanmode only.

Consider downgrading firmware Reference !142

OR

Check the Cloud Section about enabling cloud mode

Bambu Farm

ko-fi

Web based application to monitor multiple bambu printers using mqtt / ftp / rtsp (no custom firmware required)

Technologies used:

Features / Supported Devices

Feature A1 A1 Mini P1P P1S X1C
Remote View
  • 3
Upload to SD card
  • 2
Print .3mf from SD card1
  • 2
Print .gcode from SD card ? ? ? ? ?
Batch Printing4 ? ? ?
  • 2
AMS ? ? ?
Send Custom GCode
  1. Currently only .3mf sliced projects are supported.

In Bambu Studio/Orca slicer, make sure to slice the place and then use the "File -> Export -> Export plate sliced file". This creates a .3mf project with embedded .gcode plate.

  1. FTPS Connections needs SSL Session Reuse via Bouncy Castle

Without enabling bouncy castle, you will see 552 SSL connection failed: session resuse required

  1. Getting the LiveView to work requires additional software. For more details check the docker/bambu-liveview README.
  2. Batch Priting allows you to upload a single/multi sliced .3mf and select which plate to send to multiple printers, each with their own filament mapping.

Screenshots

  • Dashboard Desktop browser
  • Batch printing Batch Printing

More screenshots in docs

I just want to run it

  • Make sure you have Java 21 installed, verify with java -version
[user@build:~]# java -version
openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Zulu21.30+15-CA (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Zulu21.30+15-CA (build 21.0.1+12-LTS, mixed mode, sharing)
  • Download the latest bambu-web-*-runner.jar from releases into a new folder (or use the 1 liner below):
curl -s https://api.github.com/repos/tfyre/bambu-farm/releases/latest \
  | grep browser_download_url | cut -d'"' -f4 | xargs curl -LO
  • Create a .env config file from Minimal Config
  • Run with java -jar bambu-web-x.x.x-runner.jar
[user@build:~]# java -jar bambu-web-1.0.1-runner.jar
__  ____  __  _____   ___  __ ____  ______
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2024-01-23 08:49:05,586 INFO  [io.und.servlet] (main) Initializing AtmosphereFramework
...
...
2024-01-23 08:49:05,666 INFO  [com.vaa.flo.ser.DefaultDeploymentConfiguration] (main) Vaadin is running in production mode.
2024-01-23 08:49:05,912 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) Bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
2024-01-23 08:49:05,913 INFO  [org.apa.cam.mai.MainSupport] (main) Apache Camel (Main) 4.2.0 is starting
...
...
2024-01-23 08:49:06,029 INFO  [com.tfy.bam.cam.CamelController] (main) configured
2024-01-23 08:49:06,074 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.2.0 (camel-1) is starting
2024-01-23 08:49:06,081 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Routes startup (total:10 started:0 disabled:10)
...
...
2024-01-23 08:49:06,085 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 4.2.0 (camel-1) started in 10ms (build:0ms init:0ms start:10ms)
2024-01-23 08:49:06,193 INFO  [io.quarkus] (main) bambu-web 1.0.1 on JVM (powered by Quarkus 3.6.6) started in 1.421s. Listening on: http://0.0.0.0:8084
2024-01-23 08:49:06,194 INFO  [io.quarkus] (main) Profile prod activated.
2024-01-23 08:49:06,194 INFO  [io.quarkus] (main) Installed features: [camel-core, camel-direct, camel-paho, cdi, resteasy-reactive, resteasy-reactive-jackson, 
scheduler, security, servlet, smallrye-context-propagation, vaadin-quarkus, vertx, websockets, websockets-client]
  • If starting correctly, it will show Routes startup (total:10 started:0 disabled:10) with a number that is 2x your printer count
  • Head over to http://127.0.0.1:8080 and log in with admin / admin

Building & Running

Building:

mvn clean install -Pproduction

Create a new directory and copy bambu/target/bambu-web-1.0.0-runner.jar into it, example:

tfyre@fsteyn-pc:/mnt/c/bambu-farm$ ls -al
total 64264
drwxrwxrwx 1 tfyre tfyre     4096 Jan 17 16:47 .
drwxrwxrwx 1 tfyre tfyre     4096 Jan 18 20:42 ..
-rw-rw-rw- 1 tfyre tfyre     4557 Jan 18 14:01 .env
-rw-rw-rw- 1 tfyre tfyre 65796193 Jan 18 20:38 bambu-web-1.0.0-runner.jar

Running

java -jar bambu-web-1.0.0-runner.jar

You can now access it via http://127.0.0.1:8080 (username: admin / password: admin)

Running as a service

Refer to README.service.md

Example Config

Minimal config

!!Remeber to replace REPLACE_* fields!!

Create an .env file with the following config:

quarkus.http.host=0.0.0.0
quarkus.http.port=8080

bambu.printers.myprinter1.device-id=REPLACE_WITH_DEVICE_SERIAL
bambu.printers.myprinter1.access-code=REPLACE_WITH_DEVICE_ACCESSCODE
bambu.printers.myprinter1.ip=REPLACE_WITH_DEVICE_IP

bambu.users.admin.password=admin
bambu.users.admin.role=admin

Full Config Options

All default options are displayed (only add to the config if you want to change)

Dark Mode

# Gobal
bambu.dark-mode=false
# Per user (will default to global if omitted)
bambu.users.myUserName.dark-mode=false

Printer section

bambu.printers.myprinter1.enabled=true
bambu.printers.myprinter1.name=Name With Spaces
bambu.printers.myprinter1.device-id=REPLACE_WITH_DEVICE_SERIAL
bambu.printers.myprinter1.username=bblp
bambu.printers.myprinter1.access-code=REPLACE_WITH_DEVICE_ACCESSCODE
bambu.printers.myprinter1.ip=REPLACE_WITH_DEVICE_IP
bambu.printers.myprinter1.use-ams=true
bambu.printers.myprinter1.timelapse=true
bambu.printers.myprinter1.bed-levelling=true
bambu.printers.myprinter1.flow-calibration=true
bambu.printers.myprinter1.vibration-calibration=true
bambu.printers.myprinter1.model=unknown / a1 / a1mini / p1p / p1s / x1c
bambu.printers.myprinter1.mqtt.port=8883
bambu.printers.myprinter1.mqtt.url=ssl://${bambu.printers.myprinter1.ip}:${bambu.printers.myprinter1.mqtt.port}
bambu.printers.myprinter1.mqtt.report-topic=device/${bambu.printers.myprinter1.device-id}/report
bambu.printers.myprinter1.mqtt.request-topic=device/${bambu.printers.myprinter1.device-id}/request
#Requesting full status interval
bambu.printers.myprinter1.mqtt.full-status=10m
bambu.printers.myprinter1.ftp.port=990
bambu.printers.myprinter1.ftp.url=ftps://${bambu.printers.myprinter1.ip}:${bambu.printers.myprinter1.ftp.port}
bambu.printers.myprinter1.ftp.log-commands=false
bambu.printers.myprinter1.stream.port=6000
bambu.printers.myprinter1.stream.live-view=false
bambu.printers.myprinter1.stream.url=ssl://${bambu.printers.myprinter1.ip}:${bambu.printers.myprinter1.stream.port}
#Restart stream if no images received interval
bambu.printers.myprinter1.stream.watch-dog=5m

Cloud Section

Enable MQTT connection via cloud instead of directly to printer. You can either provide the username/password or a access token.

  • Option 1 - username/password

Provide the username and password for https://bambulab.com/ in the format below

  • Option 2 - access token

The access token can be fetched from your browser cookies or a 1 liner curl

curl -v -X POST -H 'Content-Type: application/json' -d '{"account":"YOUR_USER_NAME","password":"YOUR_PASSWORD"}' https://bambulab.com/api/sign-in/form 2>&1 | grep token= | awk '{print$3}'

Configuration:

bambu.cloud.enabled=true

# Option1: Let bambufarm login and fetch token
bambu.cloud.login.username=YOUR_LOGIN_USER
bambu.cloud.login.password=YOUR_LOGIN_PASSWORD

# Option2: fetch token via curl and paste here
bambu.cloud.token=FULL_JWT_TOKEN_FROM_COOKIES

User Section

Remember to encrypt your passwords with bcrypt (eg https://bcrypt-generator.com/)

Current roles supported:

  • admin - full access
  • normal - only dashboard with readonly access
# https://bcrypt-generator.com/
#bambu.users.REPLACE_WITH_USERNAME.password=REPLACE_WITH_PASSWORD

# Insecure version:
#bambu.users.myUserName.password=myPassword
# Secure version:
bambu.users.myUserName.password=$2a$12$GtP15HEGIhqNdeKh2tFguOAg92B3cPdCh91rj7hklM7aSOuTMh1DC 
bambu.users.myUserName.role=admin
bambu.users.myUserName.dark-mode=false

#Guest account with readonly role
bambu.users.guest.password=guest
bambu.users.guest.role=normal

# Skip users and automatically login as admin (default: false)
bambu.auto-login=true

Preheat

Default preheat configuration is below:

bambu.preheat[0].name=Off 0/0
bambu.preheat[0].bed=0
bambu.preheat[0].nozzle=0
bambu.preheat[1].name=PLA 55/220
bambu.preheat[1].bed=55
bambu.preheat[1].nozzle=220
bambu.preheat[2].name=ABS 90/270
bambu.preheat[2].bed=90
bambu.preheat[2].nozzle=270

Remote View

Remote View is the ability to remotely view or stream the printer's camera.

# defaults to true, when false, disables remote view globally
bambu.remote-view=true

# defaults to true, when false, disables remote view for dashboard, but will still be available in detail view
bambu.dashboard.remote-view=true

# defaults to true, when false, disables per printer
bambu.printers.myprinter1.stream.enable=true

Live View

Live View is the ability to remotely stream the X1C camera (or any other webcam) and requires Remote View to be enabled.

Note

Getting the LiveView to work requires additional software. For more details check the docker/bambu-liveview README.

bambu.live-view-url=/_camerastream/

# For each printer:
bambu.printers.PRINTER_ID.stream.live-view=true

# Default LiveView URL
bambu.printers.PRINTER_ID.stream.url=${bambu.live-view-url}${PRINTER_ID}

# Custom LiveView URL
bambu.printers.PRINTER_ID.stream.url=https://my_stream_domain.com/mystream
# 

Bouncy Castle

X1C needs SSL Session Reuse so that SD Card functionality can work. Reference: https://stackoverflow.com/a/77587106/23289205

Without this you will see 552 SSL connection failed: session resuse required.

Add to .env:

bambu.use-bouncy-castle=true

Add JVM startup flag:

bash / cmd:

java -Djdk.tls.useExtendedMasterSecret=false -jar bambu-web-x.x.x-runner.jar

powershell:

java "-Djdk.tls.useExtendedMasterSecret=false" -jar bambu-web-x.x.x-runner.jar

Uploading bigger files

Add to .env:

quarkus.http.limits.max-body-size=30M

Configure XY/Z movement speeds

Add to .env:

# values are in mm/minute
bambu.move-xy=5000
bambu.move-z=3000

Use Right click for menus

Add to .env:

bambu.menu-left-click=false

Custom CSS

If you want to modify the CSS, create a file next to the .jar file called styles.css

  • Changing the display columns

Display columns is a ratio and scale based on screen width

Refer to bambu.css

Example value for XXX
always 1 column 1
2 columns with 1080p 3
4 columns with 1080p 5
:root {
  --bambu-default-columns: XXX;
}

Debug

For debugging the application, add the following to .env and uncomment DEBUG or TRACE logging sections

### Log To File
quarkus.log.file.enable=true
quarkus.log.file.path=application.log


### DEBUG logging
#quarkus.log.category."com.tfyre".level=DEBUG


### TRACE logging
#quarkus.log.min-level=TRACE
#quarkus.log.category."com.tfyre".min-level=TRACE
#quarkus.log.category."com.tfyre".level=TRACE

Links

Inspirational Web interface

Printer MQTT Interface

Remoteview

Images from

Json to Proto