Bambulab to Home Assistant NodeRed Configurator

Bambu Lab Guides Published Feb 9, 2023
Updated Apr 28, 2024
🚩
Now with experimental A1, A1 Mini & X1E Support!
Works with X1Plus! (Not required)

Highlight new feature in 2.1.1 & 2.1.2: Custom Speed % Slider and Toggle Print Options!
💡
X1Plus restores the Bed Mesh data. If you want this, it requires my other flow in addition.

Check out a list of features my integrations can provide here!

Bambulab HomeAssistant Featurelist
A checklist of features that my various bambulabs guides offer for the homeassistant, nodered, mqtt integration.

Basic Implementation

Requirements

  • Home Assistant (Core or HassOS, either works)
  • MQTT Broker Connected to Home Assistant
  • NodeRed (No extra palettes needed)

First, fill out the following form below appropriate for your printer. Click Generate and it will download the NodeRed flow for your specific printer.

You can find the Serial Number in your printer's touchscreen, Bambu Studio or the Bambu Handy App. I also recommend setting a static IP for your printer in your router's settings. While on your printer, also get your LAN Access Code.

For the HomeAssistant MQTT server details, this will depend on your HA setup (Using Hassio with addons, in a docker container, running HA-Core in a docker etc). If using Hassio with the Mosquitto MQTT addon, your default username and password are your HomeAssistant credentials. If that doesn't work, check the configuration tab of the MQTT addon for a really long password, and then your username is default homeassistant, unless otherwise configured. Your ip/host is localhost.

For other setups where your MQTT broker is external, such as in HA-Core docker, you will need to enter in the appropriate settings for your setup. If you don't know or do not have it setup, I recommend following some tutorials for setting up MQTT or mosquitto mqtt containers for homeassistant (avoid any that say "addon").

Note: Your printer-name must be unique and if you choose to do the other configurators from my guides, must remain consistent when generating for that specific printer.

💡
This form data is processed in your browser and does not send to any servers or logs.

If you are using a P1P/P1S/A1 Mini/A1, there might be limitations. If you run your printer in LAN mode, then select "No" in the dropdown that appears in the configurator and that is it.

Otherwise if you have cloud enabled (so you can access camera for example) and are running firmware 01.02.02.00, select "Yes" and import a second flow (download below) into NodeRed.

If you have an A1 or A1 Mini, and have issues on any firmware with it not updating or getting data, this cloud login flow should work

If your P1 Series firmware is greater than or equal to 01.02.03.00, the bug of no LAN-MQTT access was fixed, so you can run cloud mode and still use local LAN. However, if in the Advanced flow later you wish for the 3mf's to download via Bambu's cloud server instead of FTP (Some users report FTP on P1P can cut out after a few kb and die off), you must select "Yes" in the dropdown and import/setup the second flow as per below.

Final note: If you do use the cloud server with the P1/A1 series and use the dashboard setup, you may not have start/end times or layer information.

You can change this setting without re-importing the node at any time by changing the variable in this image back and forth from true/false. I recommend experimenting if using the advanced flow which is more reliable for you.



While I could make this configurable, because it requires your BambuLab email and password, even though this website does not log anything, I do not feel comfortable asking strangers to input that data here. Instead, follow these steps:

1) Import the downloaded Login Flow into NodeRed (see steps below for general import instructions)

2) Click on the NOTES node and give it a read for detailed instructions

3) Click on the Config node and edit your email and password for your bambu account

If you log in via a third party, such as Google, simply go to the Bambulab website, log out if logged in and then select "Forgot" your password. Complete the reset process with your linked email to create a new password. Now you have both a email/password login and your third party login still works.

4) Deploy this flow when saved then continue with the steps below for the main NodeRed flow.

You will only need to do this once regardless of now many flows/printers you have setup. Once this flow is added *once*, to make any printer basic flow use the cloud login, just setup the "P1P_CLOUD_MODE" variable to true.


NodeRed Import

Next, import it into NodeRed.

Then click the big red Deploy in the top right. This is how NodeRed "saves" and deploys the flows. Any changes are not done until it is deployed.

If you have multiple printers, repeat the configurator and in NodeRed, create a new empty flow to import it in. When you import the flow, please ensure you click Import Copy when it complains about duplicate nodes.

Duplicates of the same flow-group import are not meant to be on the same flow-tab, treat each flow-tab as separate for each printer.

For upgrading flows to a newer version of this flow, make a backup of your existing flow by exporting it (top right) as json and saving it on your PC. Then delete the contents of the entire flow. Repeat for each printer then redo the configurator as per this guide. Ensure the printer-name is the same as before and it will load in correctly.


(Optional) Custom Configuration

There are a few more options for custom configuration of the nodered flow. These config changes are at your own risk to expand the functionality of the nodered flow.

These options are not configurable on this page due to potential risk associated with them. As such, I will do my best to help if you run into trouble, however I provide no guarantee for actions done after changing these specific settings.

You can modify these variables (and other settings post install) via the two "Flow Properties" nodes in the Settings group.

"Sensitive" flow properties include access code or serial number. The other flow properties handles all flow options from configuration and more.

  1. Arbitrary GCode

To enable sending arbitrary gcode commands to your printer over HomeAssistant, go into "Set Flow Properties" and find the entry for flow.allow_gcode_control and set the value below to true.

  1. Custom MQTT Root Topic

If you are not using HomeAssistant, this nodered flow can still be useful. By default, all sensors/control are published with their topics and settings setup for HomeAssistant auto-discovery via MQTT. However, you can change the root topic to anything you want by changing the flow.root_topic value in the "Set Flow Properties" node.

The format for config, state, set topics and more will still be HA formatted, but can be adapted. Some users have done this to integrate into HomeSeer and other applications.


That's it! You now have the Bambu Printer (and any attached AMS units) available in Home-Assistant. It offers plenty of sensors and control.

If you have any issues, leave a comment below (requires joining) or leave an issue on the (new) github for these flows, which contains more detailed information. You can also message me on Discord (@wolfwithsword), or anywhere listed here.

Additional findings and ideas can be discussed on the Home-Assistant forum too!

GitHub - WolfwithSword/Bambu-HomeAssistant-Flows: A collection of HomeAssistant Dashboards and NodeRed Flows with a configurator to connect a BambuLabs printer to HomeAssistant through MQTT - based off of my Gists
A collection of HomeAssistant Dashboards and NodeRed Flows with a configurator to connect a BambuLabs printer to HomeAssistant through MQTT - based off of my Gists - GitHub - WolfwithSword/Bambu-Ho…

Notes

  • The configuration form will always be up to date with the latest github changes
  • You do not need to enable LAN Only or keep it enabled for the access code to work. It does not change unless you regenerate it
  • If the printer is continuously offline, and NodeRed has messages in the debugger that the printer is not reachable, verify that the printer is not randomly disconnecting from the network. If you have multiple VLANs/networks or a non-simple home-network setup, this may be the cause. Either move the printer and NodeRed's host to the same VLAN/network, or allow some stuff through the firewall rules.
  • The "reset filter" button is not for the printer, but for the NodeRed flow. Clicking it will force sensors to "clear" and be updated when new data comes through. If you have sensor data issues and this does not solve it, you may need to debug and delete some topics in HomeAssistant MQTT using MQTT Explorer
  • If you restart HomeAssistant, sensors may be unavailable and seem "broken". Wait about 5 minutes and it will be fixed if your printer is online - it's just HA not updating from MQTT until I reset it, which I force every 5 minutes. Without it, your HA logs would be bombarded every second.
  • If any sensor is unavailable and you expect it to be there, wait 6 minutes, if still unavailable, click the "force reset". If still unavailable after another few minutes, then leave a comment to ask about it.
  • There are number-boxes which can set the target temperature of the bed and nozzle. They have limits but use at your own risk. They are useful for pre-heating the chamber in a script or modifying on the fly, for example.
Example of using the printer and an AMS in a Home-Assistant dashboard

Tags

WolfwithSword

A maker & hobbyist. Everything creative from the digital to the physical. I strive to make the world around me, rather than let it make me.