bambu-ftp-and-print/readme.md
2022-12-06 21:50:51 +13:00

4.3 KiB

Bambu Labs X1* FTP and Print

This is a Python script that provides a little of the "cloud" like functionality that you lose when you run in LAN Only mode. Namely the ability to send prints from the slicer directly to the printer.

Mostly the way that it manages this is through a combo of MQTT messages and file pulls when a command is picked up by the printer (pushall). This script emulates that somewhat but instead makes use of the local FTP server to place the 3mf file onto the printer and then trigger a print of that file for you.

⚠️ This has been very lightly tested on one printer - mine - with an AMS with it causing no issues so far. I cannot guarantee it will not cause issues for you, I'll assist as much as I can but as many, I work full time. Please open an issue if you have problems but please be polite, and respect that I can't reply instantly in all cases. ⚠️

Required Information

There are a few options that you will need to configure for this to work and a few small bit's of information you will require. You will need the following details for your printer(s);

  • IP Address. I'd recommend you make this a static reservation or the like.
  • LAN Only Password.
  • Your Device ID

To get the Device ID you can use a tool such as MQTT explorer to connect to the printer on the non-TLS port of 1883. You'll see messages appearing on the topic that looks like this; device/00A00A123456789/report The string in the middle is your Device ID - in this case it'd be 00A00A123456789.

Installing

Pretty quick to install - hopefully. Just do the following;

git clone https://github.com/darkorb/bambu-ftp-and-print.git
cd bambu-ftp-and-print
pip3 install -r requirements.txt
cp env.example .env

After this you should be good to configure the required settings.

Configuring

In the last install step above we copied the example enviroment file to .env so now open this up in something like nano (or vi if you like being mean to yourself ;)) and fill out the required information

FTP_SERVER = ""
FTP_PASSWORD = ""
MQTT_SERVER = ""
DEV_ID = ""
DIRECTORY_TO_MONITOR = ""
UPLOADED_FILES_DIRECTORY = ""

The FTP_SERVER and MQTT_SERVER will be the same in most cases - which is the IP Address of your printer that you collected in the first step. The only time you'd have these differ is if you are bridging the X1's MQTT to another MQTT (e.g., you have one MQTT server you use for Home Assistant). In this situation you could set these differently but honestly, unless you really need to make them the same.

Fill out the other details you fetched in the first step and create the folders for the monitoring and processed (uploaded) files.

Running

Should just be a simple case of doing the following; python3 ./monitor_upload.py You'll not see any output to start with, so the next step would be to put a file in the folder you created for your DIRECTORY_TO_MONITOR. What should happen then is something like the following being outputted to your screen;

Uploaded the file: CatGhost.3mf
Moved the file: CatGhost.3mf
Sent a "Print Start" notification for: CatGhost.3mf

All going well, this should then result in your print starting!

Notes

If you are using the AMS you the prints will start using the filament slot selected in the slicer. So, if you have slot three selected as the filament for an object or are doing switches (which I've not tested!) it should work fine.

Keep in mind that purging when switching isn't built into the defaults, so you may want to manually load a color if bleed is going to cause you issues.

There are known things I skipped for easy when doing this such as MD5'ing the 3mf files and having the printer validate them. This seems like effort for little gain in a local enviroment but if you want to add it go for it.

Also, I'm not a developer. I know the code could probably be better and I welcome constructive feedback, PR's etc. if people want to help out.

Thanks

Quick thanks to the folks in the NZ and AU channels on the official Discord for putting up with my rambling nonsense about this and the prodding I've been doing with MQTT for both this and Home Assistant Intergrations and for those there that have willingly tested stuff I've provided; it's made it much easier 👍