Bambu Lab X1 X1C MQTT

Ah now I remember the print_type, yeah mine has always said cloud even when I was in lan or sdcard, but I haven’t tested it in a long time. Surprised it would say “idle” though.

I doubt you could ever have 5 colour prints with one AMS and the spooler holder, there would be no clean way to do the swap without manual intervention. It would be nice to categorize and display in HA when it’s in use for sure.

Spd_lvl 254 is likely just it being initialized to a nonstandard level perhaps? A custom speed profile maybe? Other sensors do this too such as tray_now when nothing is in use or loaded.

I think vt_tray is just the settings for the non-AMS filament you can set in the slicer. I’ll edit that to be 0.030 K value and try to remember to see if the value in the json changes to match.
image

1 Like

Maybe I need to update my slicer because I do not remember seeing that option ever, unless it’s just a P1P thing?

Yes, vt_tray is the external spool. The change of K value to 0.030 showed up under vt_tray. I think it’s a P1P thing since the Lidar is supposed to automatically choose the best K value for you on the X1. K == Pressure Advance.

Yeah I guess the external spool is a configuration only the P1P has unless I’m just missing it entirely. Hoping it gets added to the next firmware update and slicer release for X1C.

Don’t wonder if the MQTT part will no longer work after the current Firmware update. Bambu Labs implemented the TLS 1.2 security for LAN communication. So you need to enable SSL encryption and username (bblp) / password (LAN access code) on the Bambu MQTT Server connection in Node-Red.

2 Likes

MQTT no longer working after today’s firmware update

Refer to what @Obicom said, MQTT finally has credentials/auth. Username for all printers is bblp, and password is your LAN Access Code which you can get by enabling lan only mode, copying it, and then turning it back off if you wish. It doesn’t change unless you regenerate it.

Also need to enable TLS (no need to make a config) and swap to port 8883.

1 Like

In addition to the change, I’m also trying to debug the FTP connection. MQTT works fine after setting the auth, port change and enabling TLS, however my FTP nodes I am having trouble connecting, same with an FTP client.

1 Like

Firmware Bambu Lab X1 Carbon: 01.04.00.00 and AMS: 00.00.05.96

imagen

Add user/password on security tab

Thanks @WolfwithSword !

1 Like

You need to fill also User and PW on the security tab …

2 Likes

Updated the gist for the new MQTT connection info. Very minor change which is just to modify your MQTT server connection details (new port, enable tls without a config, and set user/password). Can be done manually easily for anyone already with it running, especially since the user/password security part has to be run manually regardless.

Still working on the FTP connection, need some time to dig into why it’s not working for me anymore, must be something small and dumb I’m missing.

1 Like

What are you all using to connect with the printer, I’ve never worked with node red. Is there any guide on how to do this? I was just compiling this python program:

Since the home assistant integration of bambu lab was buggy for me and making it work until the firmware update hit…

Und wie benutzt man das? Bin noch Anfänger in HA. Hatte mit Node-Red alles eingerichtet bis das Update kam. Und jetzt weiss ich nicht mehr weiter.

And how do you use that? I’m still a beginner in HA. Had everything set up with Node-Red until the update came. And now I don’t know what to do anymore.

You can edit your nodered flow as per this comment Node-RED Flow - BambuLab X1 MQTT Relay for Home Assistant MQTT Auto-Discovery · GitHub and it will work again.

Here’s a guide for doing it per the node-red setup:

You will also need to modify the MQTT node part, as per Bambu Lab X1 X1C MQTT - #206 by WolfwithSword

The integration that was a WIP will need to be updated with the new MQTT changes as well. That python library is the one used by the WIP integration so that updating would fix the other as well.

Bist du klar gekommen? Sonst kann ich dir das auch gerne auf Deutsch erklären …

If anyone is also tracking for some of the FTP changes, they’ve changed to use Implicit TLS (FTPS) over port 990.

That unfortunately makes things tricky. Node/JS FTB library doesn’t necessarily support FTPS to begin with, and any external packages for it are poorly maintained or do not support Implicit TLS. There’s supposedly even been a PR open for like 5+ years on it.

Python is an option, there is a workaround to make the ftplib library work with Implicit FTPS and reuse the socket connection, and the script below works on my local machine but when I try using a python-function node from multiple palettes in NodeRed, then all like to crash when returning or modifying the message :slight_smile:

(Python Script to list files from FTPS)

import ftplib
import ssl

ftplib.ssl_version = ssl.PROTOCOL_TLSv1_2

class ImplicitFTP_TLS(ftplib.FTP_TLS):
    """FTP_TLS subclass that automatically wraps sockets in SSL to support implicit FTPS."""

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._sock = None

    @property
    def sock(self):
        """Return the socket."""
        return self._sock

    @sock.setter
    def sock(self, value):
        """When modifying the socket, ensure that it is ssl wrapped."""
        if value is not None and not isinstance(value, ssl.SSLSocket):
            value = self.context.wrap_socket(value)
        self._sock = value

    def ntransfercmd(self, cmd, rest=None):
        conn, size = ftplib.FTP.ntransfercmd(self, cmd, rest)
        if self._prot_p:
            session = self.sock.session
            if isinstance(self.sock, ssl.SSLSocket):
                    session = self.sock.session
            conn = self.context.wrap_socket(conn,
                                            server_hostname=self.host,
                                            session=session)
        return conn, size
        
ftps = ImplicitFTP_TLS()
ftps.connect(host="PRINTER_IP", port=990)

ftps.login(user="bblp", passwd="ACCESS_CODE")
ftps.prot_p()
###print(ftps.retrlines('LIST'))
print(ftps.nlst("*.3mf"))
ftps.close()

EDIT: Changed script, the method of which I listed files broke it, but I got it working in nodered with a change! Will update it later. This works with the python node runner node-red-contrib-python-function-ps (node) - Node-RED

And good news - I got the NodeRed companion flow for the FTP fetching to work again. Gist is updated with a comment for those interested in the optional flow. Node-RED Flow - BambuLab X1 MQTT Relay for Home Assistant MQTT Auto-Discovery · GitHub

It looks like updating the python mqtt to use TLS is very straight forward. But I can’t test as I have a P1P and it hasn’t been updated yet to require TLS.