Bambu Lab X1 X1C MQTT

Not totally sure, but I was thinking about manual kinematics and temp control, would be cool to also be able to run a print from the previous ones on the sd card but that will probably be more involved.

Anyway, now that I got it to work I have been messing with both integrations and pretty much found what I was looking for, but it’s nice to see it sparked a bit of discussion.

Also thanks for adding the cloud option for the integration, although I think my P1P will stay in LAN mode as long as I don’t lose any important feature.

I found that I couldn’t send more than simple models successfully to the printer in lan mode. Had to revert to cloud mode to be able to print successfully. Other than that it was mostly just that bambu studio was more delayed in updating printer state and fairly regularly had to reconnect to it when the mqtt connection dropped - which was fairly frequently with the latest firmware vs essentially never (that I saw) with the older firmware.

It’s somewhat possible to trigger a sd-card file print through MQTT, but it will end up treating it like a pre-sliced file in regards to filaments and the AMS. If multi material and AMS is enabled, it goes in order of the trays 1-4 instead of any selected, and you can’t select for the print. Oh, and you need to know which plate number from the 3mf you want to print :slight_smile:

I discovered this when making Bambulab Remote Print Start from HomeAssistant but tbh I don’t even use it myself because of that limitation unless it’s a print I plan to do often and have in the name if it uses ams or not, number of and what materials etc, and know what I have loaded up in ams or external spool.

As for kinematics, should be simple to add but I’d be sketchy of it unless the home_flag attribute is set, because otherwise it could move indiscriminately (and probably even still, but at least with home_flag you have an indicator).Though I admit I don’t really see the usecase for homeassistant to have the kinematics there, any time I think I would want to use it, I would be in the same room as the printer.

I wonder how lan mode does it then. That seems to just be using ftps and mqtt for command and control and file transfer.

Another hope for bringing mqtt back. Still no update info on printer.

Is there any reason you couldn’t use mqtt on the P1P to trigger a dummy print on a virtual printer in octoprint to allow Obico to do spaghetti detection using any given camera? And then stop it when the P1P finishes printing?

Probably possible but it seems like a quick way to overcomplicate things. There are many diff ways to do camera-based spaghetti detection using any old camera, so probably could just hook that up separately, no need for figuring out how to setup a virtual printer and such, though I guess it likely wouldn’t use Obico then.

I red somewhere that P1P will get spaghetti detection based on stock camera with cloud algorithm.

Seems like the latest P1P firmware from a few days ago allows for MQTT while outside of LAN mode, but I don’t see the topic or anything published to it once connected

Yes, it has re-enabled it. You have to only subscribe to device/SERIAL/report to get anything.

device/<serial>/report don’t seem to work for me on either of my machines :frowning:

Connects, but just emptiness:

:laughing: I JUST added in (potential, largely untested) support for P1P in cloud mode in my flows lol. I guess if it’s re-enabled locally then it’s optional, but not necessary.

@RyanEwen Just to verify, you connection with tls enabled, bblp username and access code as password? I recall earlier before it was disabled, some users couldn’t connect to it via MQTT explorer but it still worked via nodered. I forget if anyone got it working in explorer with special settings or not, but I wouldn’t be surprised if due to its limited implementation if it can’t be viewed there but still connectable via NodeRed.

If you have nodered anywhere you can test by just making an MQTT out node go to a debug node and configure the broker as needed.

Yes to TLS with bblp / access code

I think the reason people had issues with MQTT explorer was that there are some other topics subscribed by-default that the printer didn’t like, but I’ll try Node RED as well

Seems you are correct! Works in Node RED:
image

I can also confirm that @greghesp 's HA integration connects if I re-add the printer and choose LAN mode (despite not being in LAN mode) :slight_smile:

EDIT

It seems to work in MQTT explorer as well but only after connecting from Greg’s integration or NodeRED. I couldn’t see any messages from my 2nd P1P until I first connected using something else, but now I’m getting them like so:

image

Looks good! I suspect then it must do some weird protocol or handshake in the nodered or HA integration connection using paho-mqtt that mqtt explorer can’t do, but probably “opens up” after which then works.

Always found it funny that the P1P reports temperature up to 3 degrees of precision :laughing:

I have it working fine in mqtt explorer. Just need to turn off the TLS validation since bambu decided to self-sign their TLS certificate.

1 Like

@WolfwithSword Is there any way how can I investigate lack of camera picture with P1P?

As in the print preview generated image? That will only come with the second advanced flow as it needs to FTP for the file from tbe printer.

Now the P1P is a bit finnicky with ftp and may fail/ cutout. So if you do have the adv flow already and it still doesn’t work, there is potentially now a workaround requiring the p1p to be in cloud mode. You will miss out on a bit of mqtt data such as start/end times and layer numbers, but if you redo the configurators I have updated them with a p1p cloud flag.

I need to redo the wording but if you choose the first option (No (Cloud Enabled, Firmware <= 01.02.02.00)) despite your fw, it will use http get from bambus server when you start a print from the slicer, and usethe global mqtt server. This is largely untested though as Ido not have a p1p.

EDIT: There seems to be a small bug with the FTP fetch now that someone has - a newline was introduced into the file but wasn’t escaping for some people who downloaded it and caused a dumb python error with a variable name not matching. If you had recently updated to the advanced flow, this could be why. Either redo the adv flow or just make the following edit:

On this line, delete the empty line after li = li + li2, and add a space after li2 to be sure.
image

For some reason the error doesn’t trigger for me but it did for someone so, just in case :wink:

I did create data/fetched folder, leaved only flow for fetching picture like in screenshot, my ‘li = li + li2’ line was correct and nothing happens… It seems that I’m too noobish in node-red :grinning: