My Bambu Lab X1C Dashboard & Automations

I attempted to replicate the functionality of the Bambu Handy app within Home Assistant, to the extent feasible. However, work has gone a bit stale. So, I figured I might as well share what I have so far.

Preview:

Code:

https://gist.github.com/bbbenji/69e742803b1e0841909854e84cb6612a

Requirements:


Automations:

  • Toggle an external light from the X1C screen
  • Turn off the internal X1C light when a print finishes
  • Send notification when X1C encounters error

Code:

https://gist.github.com/bbbenji/2c73261e7de41b05ac9a27947350f07f

15 Likes

Thanks for the code, pretty easy to install.
only problem I have is the camera, it doesnt show up :confused:

tried this amazing tutorial, tried all the suggestions, but still no feed.
https://www.wolfwithsword.com/bambulabs-x1c-camera-in-home-assistant/

1 Like

No need to follow that guide as the ha-bambulab integration already exposes the video feed. However, it is a bit flaky. I had issues with it for weeks, then suddenly it started working for me reliably. I’ve read others still have issues with the camera. YMMV

Thanks for the code, this is awesome!

I was also having some issues with the camera feed not working reliably, but might try again after updating the firmware and integration to the latest versions.

Great Code!

Unfortunately, the camera doesn’t work for me either. Does anyone here already have a solution?

I have a P1S and I don’t have a camera entity created but I do get an image entity from the Bambu Labs integration so I used a Picture card to display the image and it updates like every second.

2 Likes

That’s great! I’m gonna study to do something similar, for the moment I’ve just tried the camera for my X1C and it doesn’t work.

first of all this is great and clean. thanks for sharing!

i’m wondering if anyone knows if we can make a snapshot of the image entity exposed by the official integration? i’ve been trying to get an image preview on ios notifications for this but because its an ‘image’ entity and not ‘camera’ i can’t seem to work it out

1 Like

I finally manage to make it works with WebRTC using go2rtc (and optionally with Frigate)

EDIT: and it DOES NOT require “LAN Only Mode”

Here is go2rtc/frigate config & printer config :

go2rtc config file :

bambulab:
- ffmpeg:rtsps://bblp:[email protected]/streaming/live/1
  #replace 888888 by yours local/LAN access code
  #replace 192.168.0.246 by yours Bambulab LAN(local net) IP

IMPORTANT NOTE ::

I HAD TO refresh my (LAN) access code using the menu button on printer to make the camera works :
image

Before refreshing it, I did not managed to make the camera works reliably works.

Now the integration works well and I got a webRTC Bambulab cam happy! :slight_smile:

Some more information for Frigate :

frigate.yaml :

go2rtc:
  streams:
    bambulab:
    - "ffmpeg:rtsps://bblp:[email protected]/streaming/live/1"

cameras:
  bambulab:
     ffmpeg:
       hwaccel_args: preset-rpi-64-h264
       inputs:
       - path: rtsp://192.168.0.90:8554/bambulab
         input_args: preset-rtsp-restream
         roles:
         - record

Now I need to find a coral model for spaghetti detection :upside_down_face:

More seriously, it could be really great in conjonction with frigate HA cards from @dermotduffy : https://github.com/dermotduffy/frigate-hass-card

  • Can slide between différents camera
  • Can easily zoom
  • Can take snapshot
  • Easy full screen or PIP camera mode
  • Nearly zero latency (thanks to go2rtc @AlexxIT )
  • etc… etc…

FYI Octoeverywhere works with BambuLab printers now. Could help with your spaghetti detection. I know its not strictly HA related but its an option.

hi
i only have one ip address which is the ip address of the printer.

on your sample above it looks like the 192.168.0.246 is your printer address. what is the other address 192.168.0.90?

I’m trying to add the bamboo camera in frigate
I have my other house camera working, but I cannot figure out How to add bambulab printer

thanks in advance.

it is usually the ip from the server:

  front2:
    ffmpeg:
      inputs:
      - path: rtsp://127.0.0.1:8554/front2?video=copy&audio=copy
        input_args: preset-rtsp-restream-low-latency
        roles:
        - record

      - path: rtsp://127.0.0.1:8554/front2_sub?video=copy   # <--- the name here must match the name of the camera in restream rtsp://frigate_user:[email protected]:554/h264Preview_01_sub
        input_args: preset-rtsp-restream-low-latency
        roles:
        - detect

Hi,

What could be the problem with the colors?

Thanks in advance.

Hey, this is great work! Thank you!

I have one quick comment, then a question.

Comment: when I first copied this dashboard for my X1C I didn’t get a picture as well, then I read on the HA Bambu instructions that I need to enable “LAN Mode LiveView”. I hope this helps other people.

Question: when one of the filaments in the AMS is white, I don’t get a border, it shows completely washed out. How can I fix that?

Sorry, my question is no longer relevant. I had to refresh the dashboard because I added another component, and now the white PLA has a grey circle around it. However that makes me wonder what will happen when I add a grey filament. :thinking:

Thank you!

Hello,

I copied your code but I have a problem with the ratio on the line where there is the AMS and the external spool.

Can you help me?

Hello, @benji,

I am facing the same issue as @sel13015 with the ratio between the AMS and the external spool. Unfortunately, my CSS knowledge is not advanced enough to help either of us resolve this problem. Could someone please assist us with this?

Also, thank you for the great solution overall!

Thank you in advance!

Hello,

I managed to solve the problem

Before

type: custom:mod-card
card_mod:
  style:
    hui-horizontal-stack-card $: |
      div#root > :first-child {
        width: 25%;
        flex: auto; 
      }
      div#root > :last-child {
        width: 80%;
        flex: auto; 
      }

After

type: custom:mod-card
card_mod:
  style:
    hui-horizontal-stack-card $: |
      div#root > :first-child > * {
        width: 25%;
        flex: auto; 
      }
      div#root > :last-child > * {
        width: 80%;
        flex: auto; 
      }

To fix the card height as it relates to the outer spool, simply add this following the code above.:

height: 130px;

card:
  type: horizontal-stack
  cards:
    - type: custom:mod-card
      card_mod:
        style: |
          ha-card {
            height: 130px;
            font-size: 10px;
1 Like

Hey thanks! Looks good. I just updated the gist with your changes.

1 Like

I have made some modifications to the code.


Tried to get it close to the original app as possible. The green bambu labs use is #4fac53. But that looked dim on my computer so changed a bit. This is for the A1.

- type: markdown
  content: >
    <font size="5">{{ states.sensor.a1_task_name.state }}</font>

    <table width=100%><tr><td align=left>Printed layers<td align=right><font color=#77fc54 ; size="4">{{ states.sensor.a1_current_layer.state}}</font>/{{states.sensor.a1_total_layer_count.state}}</td></tr></table>

    <table width=100%><tr>
    <td align=left><font size="5";color=#77fc54>{{ states.sensor.a1_print_progress.state}}%<td align=right>   
    {% if (states.sensor.a1_remaining_time.state | int) == 0 %}
      Success  
    {% else %}
      <font color=#959595>-{{(states.sensor.a1_remaining_time.state | int/60) | int  }}h{{ states.sensor.a1_remaining_time.state| int % 60 }}m 
    {% endif %}
    </td>
    </tr></table>

- type: 'custom:bar-card'           

  entity: sensor.a1_print_progress
  icon: 'off'
  name: Progress
  positions:
    icon: 'off'
    indicator: 'off'
    title: inside
    value: inside
  severity:

    - color: green
      from: 0
      to: 100

These are the buttons part:

        - type: horizontal-stack
          cards:
          
          - type: custom:button-card
            # color: rgb(0, 255, 0)
            color_type: icon
            entity: button.a1_resume_printing
            
            icon: mdi:play
            name: Resume
            layout: icon_name            
            card_mod:
              style: |
                ha-card {
                  height: 60px;
                }

          - type: custom:button-card
            color: rgb(0, 255, 0)
            color_type: icon
            entity: button.a1_pause_printing
            
            icon: mdi:pause
            name: Pause
            card_mod:
              style: |
                :host {
                    --paper-item-icon-color: red}
                ha-card {
                  height: 60px;
                }       
            layout: icon_name_state
            confirmation:
              text: '[[[ return `Pause the print?` ]]]' 


          - type: custom:button-card
            color: rgb(255, 0, 0)
            color_type: icon
            entity: button.a1_stop_printing
            
            icon: mdi:stop
            name: Stop
            card_mod:
              style: |
                :host {
                    --paper-item-icon-color: red}
                ha-card {
                  height: 60px;
                }
            layout: icon_name_state                
            confirmation:
              text: '[[[ return `Stop the Print?` ]]]'      
1 Like