Bambu Lab X1 X1C MQTT

@WolfwithSword I found your website and imported the flow. But where do I go in HA to find the entities it created?

Yeah it really sucks that they only allow one connection… I have my HA setup, when I open bambu studio HA stops… and I want to have xtouch together with HA… but that will never gonna work I think…

@WolfwithSword Is this btw the same for X1C or only on P1?

@nappyjim The entities are under the MQTT integration in Devices & Services.

@SMAW The limitation is only for P1 series (and possibly A1 series). X1 series does not have this limitation.

I am currently working on a “hub” to bridge multiple printers to one MQTT broker that should allow third party stuff (I.E., my flows, xtouch, blled, hacs integration etc) to all connect to it instead and it will mirror multiple printers in one device.

I hope to have some more time to work on it over the holidays. It will require some device to run it (RPI for example) as it’s a docker-compose stack of stuff, but it will act as a single connection to each printer, and in turn third party stuff can connect to it instead. There may need to be some work needed on third party stuff in case they use stuff hardcoded like the printer IP, but otherwise it should act as a drop-in replacement.

2 Likes

@SMAW

If you downgrade firmware you can connect multiple on the P1P. But then you obviously lose any fixes present in the newer firmware.

I wonder why they limited it? I hope it has a purpose other than limiting the P1P so that it and the X1 have a greater disparity in features.

Ah, since when was it restricted?

@WolfwithSword
I was already looking for an relay MQTT server. And found : http://www.steves-internet-guide.com/mosquitto-bridge-configuration/

But Bambu Studio will proberbly looking at the server directly, because of UDP broadcast messages (SSDP) … So when starting your bambu studio, your hub will still stop…

already requested at bambu if I can still upgrade to x1c (still in the 30 days of receiving)

Found the reason why I think, and the version where they “broke” it :wink:

P1 series OTA version 01.04.01.00(20230927)

Fixed the printer restart problem caused by continuous reconnection of MQTT using third-party tools.

@SMAW Yeah that’s bridging to one server but lacks complex configuration, and you are correct, BS and handy app go direct to printer (or cloud if remote on handy).

What I’m developing is a bit more “aware”. It’ll pickup printers on the network, store configuration for access codes and such with an interface to manage their connections, work as a repeater for multiple printers but also enrich the payloads a bit with the original printer IP and online/offline statuses. It’ll be much more plug n’ play than a normal bridged broker. Also planning to add to it a REST API and state db later on as an addon, so it can enable development of things that don’t use MQTT.

The hub won’t stop due to this issue necessarily, as the “limit” for P1 series isn’t one device, just more than 2 or sometimes 3 depending on handy app (though I theorize handy app does reconnect attempts constantly, so it’s 2 but a false 3). Theory is, printer is connected to slicer and hub, all good. Everything else that is third party goes to the Hub.

As for the reason they added in the limitation, it appears that someone’s third party tool was abusing the printer’s broker with constant requests and it was causing someone to submit logs to bambu for printer crashes. No clue still which third-party connection caused it, but I can tell you it wasn’t any of the well-known ones currently (HACs, my NodeRed, BLLED, XTouch etc). We all either put in long timers on repeated requests, or don’t make them at all.

It could also have been caused by someone using them all at once too, but they made that change really early into development of some of the well-known third party tools.

But the P1 series (and A1 series) use ESP32 chips, so much less power than the X1 series, hence why it could crash due to being overloaded like that.

Ironically the disparity between the MQTT’s has been becoming less and less with each update until recently. For X1 they just re-enabled the full-status message every second after multiple FW’s of it being like the P1 series’ minor messages.

So with P1 they do less and less messages sending. and upgrading on the X1C haha… Well hope they won’t phase out the whole MQTT, it was a reason for me to for the P1S instead of the X1C, as said I already asked if an upgrade is possible… Please keep us posted about your little project… I’m very interested!

I think I was on 1.02 and I could connect mqtt to my slicer and the HA integration.

Then updated to 1.04.xx and it stopped working and then saw when I went to reconnect it in the integration, a message popped up alerting me that firmware 1.04.xx won’t allow multiple connections.

@WolfwithSword

I don’t see any new entities in mqtt. I still have the HACS integration which used to be MQTT (now cloud). Could that be interfering?

If the printer is idle, should I be seeing “connecting”? Or should I be seeing “connected”? (Dont mind the blue dots. I’m on my cell and accidentally moved everything so now it wants to be deployed again)

So it won’t add anything until it connects but what you’re seeing is a different problem.

The “connecting” you see is from HomeAssistant’s MQTT broker which you also need to setup. The “printer’s” mqtt is higher up. When you setup the MQTT broker for homeassistant, you will also have an MQTT integration in addition to the addon to setup, which is where entities will appear.

You also need to deploy it to work.

image

Also my nodered stuff is not exactly compatible having it side by side with the HACS integration. It will work if you keep with the basic flow but the dashboard YAMLs or advanced flows might have conflicts.

If you want to continue using the HACs integration since you had it setup, then I’d suggest making a GH issue there for recommendations. Swapping over to my nodered stuff won’t fix the connection limit.

Hey just wanted to share, I learned some cool use cases from this thread and made a python library for interacting too. I know it’s not home assistant, but hopefully someone looking for a python option like me is able to find it. It’s on pypi here: bambu-connect · PyPI

1 Like

Speaking of Python, I’ve looked over the documentation and in the advanced method, I’m a bit unclear how to add python to the NR add-on. I clicked the link, but it didn’t clearly explain how to get it installed. Any pointers there?

If you’re using the NodeRed Addon in HA, you need to add it as per the linked instructions to the nodered configuration file - there may also be a UI config for it in homeassistant but it’s been a while since I checked an addon-version. Just need to add python3 to system_packages in the config, it gives examples if you scroll up on the linked page.

If you run NodeRed as a docker, it already has python as a system package in most cases.

also @mcar not sure if you’re aware but the python package used internally in the HACs repo has been extracted again and is receiving updates soon. Pybambu

Hi, I’m using your basic and advanced nodered flows side by side with the HACS integration. So far, I haven’t noticed any problem. What could be the friction points?

Thanks for your amazing work.

Mostly it comes down to the dashboard yamls as even though I have separate versions for each, if both the HACs integration and my flows are used, some sensor names are “duplicates” and HA appends like a _2 etc to some, which aren’t accounted for in my YAML, and it depends which came first etc.

The advanced flow also does some lookups to HA sensors by entity name and there is a non-zero chance it can get the wrong one if this happened. If it works fully as expected then I’d say it’s lucky lol.

I mostly say they are incompatible because most who tried end up breaking something.

1 Like

I see. Thanks for the answer. In my dashboard I have a mix of entities from both integrations, but luckily it seems that I have broken nothing yet :slight_smile:

This would be awesome. Please do keep us updated on the progress :grinning:

It seems that since the last update BambuStudio and HomeAssistant again can connect again at the same time to the printer, maybe I’m lucky for now, but thought I would share it :wink: Will also try the Xtouch

Yes recent P1 series updates have increased the MQTT connection limit, though there is a chance they introduced a timeout feature (like the cloud now has). It will need testing for sure.