Bambu Lab X1 X1C MQTT

Just need to toggle on encryption (tls), turn off validate certificate, port 8883 and then the credentials should work. Protocol as mqtt:// of course.

Darn - that’s still not connecting for me. Double-checked & triple checked.

What topic should I have? The only one I have is the device/{SerialNo}/report as suggested earlier in the thread

Did someone try out if it is possible to use the locale rtsp stream with OBS? I was not able to configure it successful. If someone has a solution it would be great if you could share the right settings in OBS. Thank you in advance. (HA works fine )

Oh, nevermind. Guess I had to click “Abort” then “Connect” again to get it to work

1 Like

Yep that’s the right topic - you’ll need to specify it for P1 series printers, but for X1 series it should let you connect without specifying. Are you sure it’s all reachable from the network mqtt explorer is on? And that your access_code is correct? Glad you got it working!

@Obicom I haven’t tried yet but I would think if some have managed to get it working with ffmpeg (check the git issue thread on it, some people have been putting what works for them in there) then it shouldn’t be too hard to broadcast that into VLC player or similar, and add that as a source in OBS.

Which Git repository do you mean? @WolfwithSword

RTSP Feed for printer cameras ¡ Issue #1536 ¡ bambulab/BambuStudio ¡ GitHub Some of the responses in the last 50 or so when they finally introduced the feature have mentions of it working in non HA applications as well.

OBS is now working for my but not realy stable … after short time picture is freezing
But I guess was the same on your first tries … maybe will be stabelizing later

1 Like

It’s never been stable for me. I do not power down my printers. I did end up adding them to Frigate with recording and what-not disabled so I can use its preload feature to always have the stream going.

Sometimes it can hang or have a minor lag and freeze due to the buffer, this also happens in bambu studio and handy app from time to time but they handle it better as they have a larger buffer (and a slightly bigger delay) from my non-scientific very limited testing :laughing:

Though I do wonder then since the liveview also works in lan mode now via bambustudio, if it’s still “slightly better” or equal to just using the camera tools stream to OBS built in bit.

As for my early testing, yeah it was very unstable and would drop connection if the printers were not restarted at least once since enabling the feature (or after firmware update). Afterward, has been completely stable. Though do note I have my printer off whenever not in use, so mine restarts often. It could be less stable perhaps if kept on for a really long time but I’ve never tested for more than say, 20 hours or so.

I have a P1P and am trying to work on a MQTT listener app. Do you mind sharing how you got these action mappings? Did you just watch the messages along with what the app/studio was reporting? I’m trying to figure out what mc_print_sub_stage and mc_print_stage are.

All the action mapping for the stages, ams status, rfid status, etc etc I got from looking at what BambuStudio’s code does in the DeviceManager.cpp file. Really helps when I check it every once in a while to see what might be coming mqtt-wise later. Unfortunately not everything is in there.

One other thing I just realized this morning which I was hoping if someone could help me here regarding the Handy app. The app can show the generated (or attached) image for a specific plate from a print 3mf file - however, I am curious as to how it gets it. I am unaware if it works in lan mode or for P1 series, but under the assumption it does, the only things I can think of is the app either does an FTP download from the printer, or if in cloud mode, fetching from bambu’s servers. I would really like to know as it could potentially solve a few edge-case limitations. It definitely takes some time to process it (currently running a print with a large 3mf file, and loading up the handy app for the first time with it, it takes a solid 30 seconds before the image appears).

1 Like

Just going to leave a note here that if anyone gets their hands on an A1 mini and/or the AMS lite, it would be really helpful to see what a full mqtt payload from them looks like.

I’ll likely be making a quick program that will connect to a printer just to get the full message once to help with this and will update this message with it, but if someone gets the printer and I haven’t updated it yet, please reach out :slight_smile:

1 Like

does anyone know where 3mf files are now stored on the x1c?

Has it changed recently? It’s still in the same places as it used to be for me. Root / for files you put on, and if you have cache prints on sd card enabled, any ones you just send to printer to print will be in /cache/.

something seems strange.

this is root
image

and this is cache
image

That looks normal to me aside from there being no 3mf files… Just ftp’d into mine now and I see the same but I have 3mf files in both directories.

Any files that are sent via HTTP btw (so makerworld, or some P1 series in cloud mode) don’t go onto the printer… wait a minute this was true for P1 series but I just noticed the test print I did from makerworld did save a 3mf in my cache directory (x1c)… I am so confused now lol

Does anybody have problems starting print via the project_file method for P1S via MQTT?
Everything works ok on X1/X1C but with P1S I got a successful response but the print doesn’t start

payload

{
  "print": {
    "sequence_id": 13,
    "command": "project_file",
    "param": "Metadata/plate_1.gcode",
    "subtask_name": "small_cube",
    "url": "ftp://small_cube.gcode.3mf",
    "bed_type": "auto",
    "timelapse": false,
    "bed_leveling": true,
    "flow_cali": false,
    "vibration_cali": false,
    "layer_inspect": true,
    "use_ams": true
  }
}

response:

{
  "print": {
    "sequence_id": 13,
    "command": "project_file",
    "param": "Metadata/plate_1.gcode",
    "subtask_name": "small_cube",
    "url": "ftp://small_cube.gcode.3mf",
    "bed_type": "auto",
    "timelapse": false,
    "bed_leveling": true,
    "flow_cali": false,
    "vibration_cali": false,
    "layer_inspect": true,
    "use_ams": true,
    "reason": "success",
    "result": "success"
  }
}

When I tried to send print on P1S with OrcaSlicer/BambuStudio (LAN Mode) - the print job started without problems

Solution: One of the possible workaround is to add a little sleep (5 sec) after ftp upload and add to payload

{
  "print": {
    "sequence_id": 13,
    "command": "project_file",
    "param": "Metadata/plate_1.gcode",
    "subtask_name": "small_cube",
    "url": "ftp://small_cube.gcode.3mf",
    "bed_type": "auto",
    "timelapse": false,
    "bed_leveling": true,
    "flow_cali": false,
    "vibration_cali": false,
    "layer_inspect": true,
    "use_ams": true,
    "profile_id": "0", // +
    "project_id": "0", // +
    "subtask_id": "0", // +
    "task_id": "0", // +
  }
}

I believe it might be related to the P1 series being slow with unpacking the 3mf files once they are loaded onto the printer. A 5s sleep after upload might be a good solution though I wonder if larger files may be an issue (in that case, 20s maybe to be super safe? or dynamic based on filesize if you can manage). Good way to test is to slice a very complex model and just try to get the filesize large and see if 5s is enough.

Also - you can actually use an HTTP url in the url field as well if you self-serve the files on some locally running host. Might be a decent way to avoid the upload delay requirement if you don’t need it on the printer and are able to host up the file on something local.