Bambu Lab X1 X1C MQTT

If you have a print running currently, click the little box on the “FORCE FETCH” node there, then take another screenshot of that whole group again after ~10-20 seconds. Will be helpful to see if one of the nodes failed and when some last ran. Also if any errors come up on the debug panel on the right.

Also - I notice that said you’re on REV 36 but you’re missing quite a few nodes from the rev 36 update…
Ex:

And there are required changes in the main flow to support it too.

The stuff you’re missing shouldn’t technically affect if you’re in newest firmware cloudmode or old firmware lan mode, it was mostly for supporting using the cloud server for the P1P, which may be required for FTP if it times out since the P1P tends to cut out on FTP calls after a bit.

If I leave Request in this flow, main flows for mqtt can’t connect to printer.
If I use FORCE FETCH node red crashes with information:

image

What do you mean exactly with the first part? I’m a bit confused.

For the second part, generally that means the python code could not run, and I see you are running supervisor HassOS for nodered. In which case, did you make sure to add python to the list of extra packages for NodeRed?

I mean MQTT Relay stops working when using flow with mqtt request from HTTP/FTPS Print Fetch

Python also installed

For the python I don’t mean the palette, I mean when you installed NodeRed in HassOS, you need to add python3 to as per this. It may be python instead of python3, I’m not sure, but others have run into this issue if using HassOS instead and this resolved it.

The reason the mqtt gets disconnected - which of these did you select?
image
If you selected the first one, then did you also install the extra flow the requires you to put in your bambu account email and password? That is required to connect to the remote MQTT server instead of local. The first selection is also required if you want to use the cloud 3mf file instead of FTP on the P1P printer.

Choosing either of the other two options will not use the global mqtt server and instead use lan, which should connect without needing that additional flow with bambu login details. However, then all mqtt is local (as is always the case for x1c btw) but also it will rely on FTP to get the 3mf file, which as some users experienced can cut out and drop after a few kb.

Edit: I’m updating the wording on the webpage soon so it may look a bit different but the order will be the same. Just because of recent firmware resolving some issues.

If this doesn’t resolve the mqtt connection issues the last thing I can think of is to check and verify the broker information saves in the node’s config → it’s possible if you’re using LAN instead of cloud for P1P (since the cloud method I override the connection details) that maybe during importing the new update your NodeRed changes or duplicated the servers. So just verify the broker server config selected is right and details are good.

Damn, I’m so lame at NR. Sorry for that and thank you for your patience.
Only python3 is available to add as system packages and I added it to NR.
I’m pretty sure that previously I choosed option with latest firmware: No (Cloud Enabled, Firmware>=01.02.03.00

I did everything once again with newest generator with only cloud option to YES and now Request flow connecting properly but still some new problems.

Now when trying to fetch .3mf file and I get this error:

FYI I modified the site to make it say “cloud server only” Yes/No, where Yes will use cloud mqtt/3mf file fetching and No does all local + FTP. So with the current “Yes” option, it shouldn’t even run the python nodes at all as it won’t FTP.

Error 550 in ftp is permission errors… I wonder if they changed it so ftp on the P1P needs additional perms now, of which, I cannot test or really work around as ftp perms are usually server side only.

Perhaps this didn’t help but get this error on debugging request every connection attempt:

image

Connection to sftp from FileZilla works ok.

Hm, yeah that error is unrelated - that’s the request topic from MQTT, for some reason it’s not receiving a json string which is weird… Might be an instance of it being empty, but not sure. Either way it does not affect the FTP at all - that node is the MQTT read from the printer’s request topic, it’s only used here if you chose Cloud P1P in which cause it skips FTP entirely and never runs FTP, but will listen to the request topic for the HTTP GET url for the 3mf file.

Just confirm (and don’t share due to the code) that in the List 3MF Files (Py) and Fetch 3MF File (Py) nodes that the access_code password is correct.

Edit: Wait, do you mean FTPS? Or did they switch to SFTP…

Checked access_code earlier, it’s correct.

My fault, I mean FTPS.

On a multi-AMS machine, what does the AMS mqtt json payload look like?

        # "ams": {
        #     "ams": [
        #         {
        #             "id": "0",
        #             "humidity": "4",
        #             "temp": "0.0",
        #             "tray": [
        #                 {
        #                     "id": "0",

Is what I see with my single AMS. With multiple do you get an ams index of 0…3 and tray ids for each of 0…3 or does the tray id get forced to monotic so ams 1 has tray ids of 4…7?

That’s really nice. I’ve never really played much with creating fancy looking HA dashboard - mostly I’ve only done functional ones to maximize usability on a phone screen with sliders and tabbed cards. How do you go about creating such a polished looking layout?

What’s the best sensor format for color with HA? Printer format is a string RRGGBBAA. AA seems useless since that’ll always be FF. Should I split the string in integer rgb values as separate sensors?

Here is code for my card:

type: custom:vertical-stack-in-card
cards:
  - type: horizontal-stack
    cards:
      - type: picture-elements
        title: null
        image: /local/images/devices/p1p.png
        style: |
          ha-card { ;
           --ha-card-background: "rgba(0, 0, 0, 0.6)";
           --ha-card-box-shadow: 'none';
          }
        elements:
          - entity: switch.licznik_bambu_lab_p1p
            show_state: false
            show_name: false
            state:
              - color: rgb(0, 153, 51)
                icon: mdi:power-standby
                value: 'on'
              - color: rgba(255, 0, 0, 0)
                icon: mdi:power-standby
                value: null
            styles:
              card:
                - height: 54px
                - background-color: rgba(0, 0, 0, 0.0)
                - width: 150px
                - box-shadow: 0px 0px 0px 0px
              name:
                - font-size: 13px
            style:
              '--paper-item-icon-color': red
              '--paper-item-icon-active-color': green
              '--iron-icon-height': 60px
              '--iron-icon-width': 60px
              font-size: 10%
              font-weight: bold
              left: 11%
              top: 14%
            type: custom:button-card
            icon: mdi:power-standby
          - type: custom:button-card
            entity: sensor.bambu_lab_p1p_nozzle_temperature
            state_display: |
              [[[
                return Math.round(Number(entity.state)).toFixed(0) + '°C';
              ]]]
            name: null
            show_name: false
            show_state: true
            show_icon: false
            icon: mdi:printer-3d-nozzle-heat-outline
            aspect_ratio: 9/7
            style:
              top: 29%
              left: 45%
              width: 60px
              height: 35px
            styles:
              card:
                - background-color: rgba(255, 255, 255, 0.3)
                - height: 20px
          - type: custom:button-card
            entity: sensor.bambu_lab_p1p_bed_temperature
            state_display: |
              [[[
                return Math.round(Number(entity.state)).toFixed(0) + '°C';
              ]]]
            name: null
            show_name: false
            show_state: true
            show_icon: false
            icon: mdi:heating-coil
            aspect_ratio: 9/7
            style:
              top: 84%
              left: 50%
              width: 45px
            styles:
              card:
                - background-color: rgba(255, 255, 255, 0.3)
                - height: 20px
          - type: custom:mushroom-light-card
            entity: light.bambu_lab_p1p_chamber_light
            name: LED
            icon: mdi:lightbulb-outline
            secondary_info: none
            style:
              top: 60%
              left: 82%
              width: 50px
              '--ha-card-background': rgba(0, 0, 0, 0.0)
              '--ha-card-box-shadow': none
              '--mush-icon-size': 45px
          - type: custom:mushroom-template-card
            primary: Pauza
            icon: mdi:pause
            icon_color: |-
              {% if is_state('button.bambu_lab_p1p_pause_print', 'unknown') %}
              orange
              {% else %}
              grey
              {% endif %}
            layout: vertical
            secondary: ''
            style:
              top: 40%
              left: 11%
              width: 70px
              height: null
              '--ha-card-background': rgba(0, 0, 0, 0.0)
              '--ha-card-box-shadow': none
              '--mush-icon-size': 35px
            hold_action:
              action: call-service
              service: button.press
              service_data: {}
              target:
                entity_id: button.bambu_lab_p1p_pause_print
          - type: custom:mushroom-template-card
            primary: Wzów
            icon: mdi:play
            icon_color: |-
              {% if is_state('button.bambu_lab_p1p_resume_print', 'unknown') %}
              green
              {% else %}
              grey
              {% endif %}
            layout: vertical
            secondary: ''
            style:
              top: 63%
              left: 11%
              width: 70px
              '--ha-card-background': rgba(0, 0, 0, 0.0)
              '--ha-card-box-shadow': none
              '--mush-icon-size': 35px
            hold_action:
              action: call-service
              service: button.press
              service_data: {}
              target:
                entity_id: button.bambu_lab_p1p_resume_print
          - type: custom:mushroom-template-card
            primary: Anuluj
            icon: mdi:stop
            icon_color: |-
              {% if is_state('button.bambu_lab_p1p_stop_print', 'unknown') %}
              red
              {% else %}
              grey
              {% endif %}
            layout: vertical
            secondary: ''
            style:
              top: 86%
              left: 11%
              width: 70px
              '--ha-card-background': rgba(0, 0, 0, 0.0)
              '--ha-card-box-shadow': none
              '--mush-icon-size': 35px
            styles:
              card:
                - height: 30px
                - background-color: rgba(0, 0, 0, 0.0)
                - width: 10px
                - box-shadow: 0px 0px 0px 0px
              name:
                - font-size: 13px
            hold_action:
              action: call-service
              service: button.press
              service_data: {}
              target:
                entity_id: button.bambu_lab_p1p_stop_print
  - type: vertical-stack
    cards:
      - entities:
          - entity: select.bambu_lab_p1p_speed
            icon: mdi:speedometer
            style:
              ha-paper-dropdown-menu:
                $:
                  paper-input:
                    $:
                      paper-input-container: |
                        label {
                           font-size: 16px;
                           color: white;
        type: entities
        style: |
          ha-card { ;
           --ha-card-background: "rgba(0, 0, 0, 0.6)";
           --ha-card-box-shadow: 'none';
          }
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-entity-card
            entity: sensor.bambu_lab_p1p_subtask
            name: Model
            icon: mdi:printer-3d
            icon_color: yellow
            style: |
              ha-card { ;
               --ha-card-background: "rgba(0, 0, 0, 0.6)";
              --ha-card-box-shadow: 'none';
              }
          - type: custom:mushroom-entity-card
            entity: sensor.bambu_lab_p1p_print_progress
            name: Postęp
            icon: mdi:rotate-3d-variant
            style: |
              ha-card { ;
               --ha-card-background: "rgba(0, 0, 0, 0.6)";
               --ha-card-box-shadow: 'none';
              }
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-entity-card
            entity: sensor.bambu_lab_p1p_print
            icon: mdi:cog
            icon_color: green
            name: Tryb
            style: |
              ha-card { ;
               --ha-card-background: "rgba(0, 0, 0, 0.6)";
               --ha-card-box-shadow: 'none';
              }
          - type: custom:mushroom-entity-card
            entity: sensor.bambu_lab_p1p_print_remaining_time
            name: Pozostały czas
            style: |
              ha-card { ;
               --ha-card-background: "rgba(0, 0, 0, 0.6)";
               --ha-card-box-shadow: 'none';
              }
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-entity-card
            entity: sensor.bambu_lab_p1p_hms
            name: Błędy HMS
            icon: mdi:alert-circle-outline
            icon_color: grey
            style: |
              ha-card { ;
               --ha-card-background: "rgba(0, 0, 0, 0.6)";
               --ha-card-box-shadow: 'none';
              }

And PNG:

1 Like

Yep, trays are always 0-3, and ams id is 0+. For this you need to do some code function to identify which tray is used as the actual active tray in use id will be say, 5 or 6 if on the second AMS.

*I haven’t tested this but many months ago when I first made the flow, others confirmed this for me so I have coded in a function to parse this for a “current tray in use” function to highlight it in HomeAssistant,

1 Like

@WolfwithSword i saw a mention in a previous comment where you referenced REV 36, is there somewhere that lists your changes or what the current version is? It looks like im on REV 27 of the bambu mqtt NR flow…

Yep - kinda. All the changes I updated and said what changed through comments in the gists of the associated guides. I need to find a better way to put something in place to show current version numbers in the posts for each flow.

For ex, here’s the comment for rev 36, Node-RED Flow - BambuLab X1 MQTT Relay for Home Assistant MQTT Auto-Discovery · GitHub

@WolfwithSword what is the best way to upgrade to a new rev? just import the flow, update it and delete the old one?

I’d recommend exporting current flow to json as a backup, deleting it then importing the new one. If it says there’s duplicates in this case, it’s the config details for servers and such and not the nodes - go to the “view duplicate nodes” (or whatever it’s called) and then after press OK/Import (it won’t select and import the duplicate configs in this case, which is what you want - to import nodes as new but do not re-import server config details).

If you don’t delete the previous flow first then importing may create duplicates of everything and cause some errors with server configs.