Skip to main content

BambuLab Integration

Damit ihr euren BambuLab in Homeassistant integrieren könnt nutzt einfach folgende HACS Integration:

image.png

Benötigte HACS Cards:

  • config-template-card
  • card-mod
  • lovelace-layout-card
  • hui-element
  • button-card
  • mushroom
  • config-template-card
  • FontAwesome (in HACS Integrationen, nicht frontend) (nach dem download bitte in Geräte & Dienste die Integration installieren)
  • custom-ui

Files: x1c bambu-ha-media-files.zip (bitte entpackt diese wie in der Zip in die richtigen Ordner)

Als Dashboard könnt ihr folgenden Code für euch anpassen - hier musst du nur mit Notepad++ den Text "DEINBAMBU" mit deinem Druckernamen aus der Config ersetzen:

Entitäten auf Deutsch
type: horizontal-stack
cards:
  - type: vertical-stack
    cards:
      - type: picture-elements
        elements:
          - type: conditional
            conditions:
              - condition: state
                state_not: unavailable
                entity: sensor.x1c_DEINBAMBU_ams_1_id
              - condition: state
                state_not: unknown
                entity: sensor.x1c_DEINBAMBU_ams_1_id
            elements:
              - type: state-label
                entity: sensor.x1c_DEINBAMBU_ams_1_id
                tap_action:
                  action: none
                style:
                  top: 77%
                  left: 9.6%
                  text-align: center
                  font-size: 0.8em
                  background-color: rgba(0,0,0,0)
                  box-shadow: 0 0 3px 3px rgba(0, 0, 0, 0)
                  border-radius: 10px
                  pointer-events: none
                  color: '#FFFFFF'
          - type: custom:config-template-card
            entities:
              - sensor.x1c_DEINBAMBU_ams_1_slot_1
            element:
              type: state-icon
              entity: sensor.x1c_DEINBAMBU_ams_1_slot_1
              icon: >-
                ${states['sensor.x1c_DEINBAMBU_ams_1_slot_1'].state !=
                'empty' ? 'fapro:filament-1' : 'mdi:slot' }
            style:
              top: 28%
              left: 21.4%
              '--paper-item-icon-color': var(--slot_1_color)
              background-color: rgba(0,0,0,0.5)
              box-shadow: 0 0 5px 5px var(--slot_1_bg)
              border-radius: 50px
              '--mdc-icon-size': 2.4em
          - type: state-label
            entity: sensor.x1c_DEINBAMBU_ams_1_slot_1
            attribute: type
            tap_action:
              action: none
            style:
              top: 77%
              left: 21%
              text-align: center
              font-size: 1em
              background-color: rgba(0,0,0,0.4)
              box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
              border-radius: 50px
              pointer-events: none
              color: '#FFFFFF'
          - type: custom:config-template-card
            entities:
              - sensor.x1c_DEINBAMBU_ams_1_slot_2
            element:
              type: state-icon
              entity: sensor.x1c_DEINBAMBU_ams_1_slot_2
              icon: >-
                ${states['sensor.x1c_DEINBAMBU_ams_1_slot_2'].state !=
                'empty' ? 'fapro:filament-1' : 'mdi:slot' }
            style:
              top: 28%
              left: 39.7%
              '--paper-item-icon-color': var(--slot_2_color)
              background-color: rgba(0,0,0,0.5)
              box-shadow: 0 0 5px 5px  var(--slot_2_bg)
              border-radius: 50px
              '--mdc-icon-size': 2.4em
          - type: state-label
            entity: sensor.x1c_DEINBAMBU_ams_1_slot_2
            attribute: type
            tap_action:
              action: none
            style:
              top: 77%
              left: 40%
              text-align: center
              font-size: 1em
              background-color: rgba(0,0,0,0.4)
              box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
              border-radius: 50px
              pointer-events: none
              color: '#FFFFFF'
          - type: custom:config-template-card
            entities:
              - sensor.x1c_DEINBAMBU_ams_1_slot_3
            element:
              type: state-icon
              entity: sensor.x1c_DEINBAMBU_ams_1_slot_3
              icon: >-
                ${states['sensor.x1c_DEINBAMBU_ams_1_slot_3'].state !=
                'empty' ? 'fapro:filament-1' : 'mdi:slot' }
            style:
              top: 28%
              left: 59.7%
              '--paper-item-icon-color': var(--slot_3_color)
              background-color: rgba(0,0,0,0.5)
              box-shadow: 0 0 5px 5px  var(--slot_3_bg)
              border-radius: 50px
              '--mdc-icon-size': 2.4em
          - type: state-label
            entity: sensor.x1c_DEINBAMBU_ams_1_slot_3
            attribute: type
            tap_action:
              action: none
            style:
              top: 77%
              left: 60%
              text-align: center
              font-size: 1em
              background-color: rgba(0,0,0,0.4)
              box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
              border-radius: 50px
              pointer-events: none
              color: '#FFFFFF'
          - type: custom:config-template-card
            entities:
              - sensor.x1c_DEINBAMBU_ams_1_slot_4
            element:
              type: state-icon
              entity: sensor.x1c_DEINBAMBU_ams_1_slot_4
              icon: >-
                ${states['sensor.x1c_DEINBAMBU_ams_1_slot_4'].state !=
                'empty' ? 'fapro:filament-1' : 'mdi:slot' }
            style:
              top: 28%
              left: 79.6%
              '--paper-item-icon-color': var(--slot_4_color)
              background-color: rgba(0,0,0,0.5)
              box-shadow: 0 0 5px 5px var(--slot_4_bg)
              border-radius: 50px
              '--mdc-icon-size': 2.4em
          - type: state-label
            entity: sensor.x1c_DEINBAMBU_ams_1_slot_4
            attribute: type
            tap_action:
              action: none
            style:
              top: 77%
              left: 79.6%
              text-align: center
              font-size: 1em
              background-color: rgba(0,0,0,0.4)
              box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
              border-radius: 50px
              pointer-events: none
              color: '#FFFFFF'
          - type: conditional
            conditions:
              - entity: sensor.x1c_DEINBAMBU_druckstatus
                state_not: offline
            elements:
              - type: conditional
                conditions:
                  - entity: sensor.x1c_DEINBAMBU_ams_1_ams_temperatur
                    state_not:
                      - unavailable
                      - unknown
                elements:
                  - entity: sensor.x1c_DEINBAMBU_ams_1_ams_temperatur
                    type: state-badge
                    style:
                      top: 50.75%
                      left: 8%
                      font-size: 0.75em
                      color: rgba(0,0,0,0)
              - type: custom:config-template-card
                entities:
                  - sensor.x1c_DEINBAMBU_ams_1_index_der_luftfeuchtigkeit
                element:
                  type: state-icon
                  entity: sensor.x1c_DEINBAMBU_ams_1_index_der_luftfeuchtigkeit
                  icon: >-
                    ${'fapro:humidity-level-dark-' +
                    states['sensor.x1c_DEINBAMBU_ams_1_index_der_luftfeuchtigkeit'].state
                    + '#fullcolor'}
                style:
                  top: 38.5%
                  left: 92.5%
                  background-color: '#1c1c1c'
                  border-radius: 50px
                  border: 0.12em solid var(--humidity-border-color)
                  '--mdc-icon-size': 2.05em
        image: /local/media/bambuprinter/AMS_2.png
        card_mod:
          style: |
            ha-card {
              background: none !important;
              border: none !important;
              box-shadow: none !important;
              --humidity-border-color: {% if states('sensor.x1c_DEINBAMBU_ams_1_index_der_luftfeuchtigkeit')  != 'unavailable' and states('sensor.x1c_DEINBAMBU_ams_1_index_der_luftfeuchtigkeit') | int > 3 %} rgba(255, 255, 126, 0.5); {% elif states('sensor.x1c_DEINBAMBU_ams_1_index_der_luftfeuchtigkeit')  != 'unavailable' and states('sensor.x1c_DEINBAMBU_ams_1_index_der_luftfeuchtigkeit') | int > 1 %} rgba(228,127,97,1.0); {% else %} rgba(194,74,72,1.0); {% endif %}
              --slot_1_color: {{state_attr('sensor.x1c_DEINBAMBU_ams_1_slot_1', 'color') }};
              --slot_2_color: {{state_attr('sensor.x1c_DEINBAMBU_ams_1_slot_2', 'color') }};
              --slot_3_color: {{state_attr('sensor.x1c_DEINBAMBU_ams_1_slot_3', 'color') }};
              --slot_4_color: {{state_attr('sensor.x1c_DEINBAMBU_ams_1_slot_4', 'color') }};
              --slot_1_bg: {% if is_state_attr('sensor.x1c_DEINBAMBU_ams_1_slot_1', 'active', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
              --slot_2_bg: {% if is_state_attr('sensor.x1c_DEINBAMBU_ams_1_slot_2', 'active', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
              --slot_3_bg: {% if is_state_attr('sensor.x1c_DEINBAMBU_ams_1_slot_3', 'active', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
              --slot_4_bg: {% if is_state_attr('sensor.x1c_DEINBAMBU_ams_1_slot_4', 'active', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
            }
      - type: picture-elements
        elements:
          - type: conditional
            conditions:
              - entity: sensor.x1c_DEINBAMBU_druckstatus
                state_not: offline
            elements:
              - entity: light.x1c_DEINBAMBU_druckraumbeleuchtung
                type: state-icon
                style:
                  top: 46%
                  left: 18%
                  '--mdc-icon-size': 2.6em
                tap_action:
                  action: toggle
              - entity: sensor.x1c_DEINBAMBU_druckstatus
                type: state-label
                style:
                  top: 8.6%
                  left: 32.8%
                  font-size: 1.2em
                  color: '#FFFFFF'
              - type: conditional
                conditions:
                  - entity: sensor.x1c_DEINBAMBU_druckstatus
                    state:
                      - running
                      - pause
                elements:
                  - type: conditional
                    conditions:
                      - entity: image.x1c_DEINBAMBU_titelbild
                        state_not: unavailable
                    elements:
                      - type: custom:hui-element
                        card_type: picture-entity
                        show_name: false
                        show_state: false
                        entity: image.x1c_DEINBAMBU_titelbild
                        style:
                          top: 50%
                          left: 50%
                          transform: translate(-45%, -40%) scale(75%, 75%)
                          '--ha-card-border-width': 0px
                          '--ha-card-background': none
                  - entity: sensor.x1c_DEINBAMBU_druckfortschritt
                    type: state-badge
                    tap_action:
                      action: none
                    style:
                      top: 18.5%
                      left: 81%
                      font-size: 1em
                      color: rgba(0,0,0,0)
                      '--label-badge-red': '#11739D'
              - entity: sensor.x1c_DEINBAMBU_temperatur_der_duse
                type: state-badge
                style:
                  top: 31%
                  left: 51%
                  font-size: 0.8em
                  color: rgba(0,0,0,0)
              - entity: sensor.x1c_DEINBAMBU_druckbetttemperatur
                type: state-badge
                style:
                  top: 84%
                  left: 51%
                  font-size: 0.8em
                  color: rgba(0,0,0,0)
              - type: conditional
                conditions:
                  - entity: sensor.x1c_DEINBAMBU_temperatur_im_druckraum
                    state_not: unavailable
                elements:
                  - entity: sensor.x1c_DEINBAMBU_temperatur_im_druckraum
                    type: state-badge
                    style:
                      font-size: 0.8em
                      top: 31%
                      left: 19%
                      color: rgba(0,0,0,0)
        card_mod:
          style: |
            ha-card {
              background: none !important;
              border: none !important; 
              box-shadow: none !important;
            }
        image: /local/media/bambuprinter/on_lighton_2.png
        entity: light.x1c_DEINBAMBU_druckraumbeleuchtung
        state_image:
          unavailable: /local/media/bambuprinter/off.png
          'on': /local/media/bambuprinter/on_lighton_2.png
          'off': /local/media/bambuprinter/off.png
  - type: vertical-stack
    cards:
      - type: custom:mushroom-entity-card
        entity: switch.switch_3d_drucker
        icon: mdi:power
        icon_color: yellow
        layout: horizontal
        name: X1 Carbon
        secondary_info: none
        tap_action:
          action: call-service
          service: script.3d_drucker_ausschalten
          data: {}
          target: {}
      - type: custom:mushroom-template-card
        primary: Automatisierung
        secondary: ''
        icon: ''
      - type: custom:mushroom-template-card
        primary: Abschaltung nach Druck
        secondary: >-
          {{ states('sensor.x1c_DEINBAMBU_remaining_time') }} Minuten
          verbleibend
        icon: mdi:timer
        icon_color: >-
          {% if is_state('automation.3d_drucker_automatische_abschaltung', 'on')
          %}
            yellow
          {% endif %}
        tap_action:
          action: call-service
          service: automation.toggle
          data: {}
          target:
            entity_id: automation.3d_drucker_automatische_abschaltung
      - type: custom:mushroom-entity-card
        entity: automation.benachrichtigung_3d_drucker_ist_fertig
        icon_color: yellow
        tap_action:
          action: toggle
      - type: custom:mushroom-template-card
        primary: '  Auto - Light'
        secondary: ''
        icon: mdi:light-flood-down
        icon_color: |-
          {% if is_state('automation.3d_drucker_licht', 'on') %}
            yellow
          {% endif %}
        tap_action:
          action: toggle
        entity: automation.3d_drucker_licht
      - type: custom:mushroom-template-card
        primary: Beleuchtung
        secondary: ''
        icon: ''
        icon_color: ''
      - type: custom:mushroom-light-card
        entity: light.switch_3d_drucker_licht
        name: Zusatzbeleuchtung
        icon: mdi:led-strip-variant
      - type: custom:mushroom-light-card
        entity: light.x1c_DEINBAMBU_druckraumbeleuchtung
        name: Bauraumbeleuchtung
        icon: mdi:led-strip
      - type: custom:mushroom-template-card
        primary: Stats
        secondary: ''
        icon: ''
      - type: custom:mushroom-select-card
        entity: select.x1c_DEINBAMBU_druckgeschwindigkeit
        name: Speed
        layout: horizontal
      - type: custom:mushroom-fan-card
        entity: fan.x1c_DEINBAMBU_bauteillufter
        icon_animation: true
        show_percentage_control: true
        layout: horizontal
        name: Bauteillüfter
        show_oscillate_control: false
        collapsible_controls: false
      - type: custom:mushroom-fan-card
        entity: fan.x1c_DEINBAMBU_druckkopflufter
        icon_animation: true
        show_percentage_control: true
        layout: horizontal
        show_oscillate_control: false
        collapsible_controls: false
        name: Druckkopflüfter
      - type: custom:mushroom-fan-card
        entity: fan.x1c_DEINBAMBU_druckraumlufter
        icon_animation: true
        show_percentage_control: true
        layout: horizontal
        name: Druckraumlüfter
        show_oscillate_control: false
        collapsible_controls: false
  - type: vertical-stack
    cards:
      - type: entities
        entities:
          - entity: sensor.3d_druck_taglich
            name: Verbrauch - heute
          - entity: sensor.switch_3d_drucker_power
        title: Verbrauch
      - type: entities
        entities:
          - entity: sensor.x1c_DEINBAMBU_vrs_fertigstellung
            name: 'Fertig um:'
      - type: custom:bar-card
        entities:
          - entity: sensor.x1c_DEINBAMBU_druckfortschritt
        name: Druckfortschritt
        color: green
        icon: mdi:progress-check
        entity_row: false
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-entity-card
            entity: button.x1c_DEINBAMBU_druckvorgang_fortsetzen
            primary_info: none
            secondary_info: none
            tap_action:
              action: toggle
            layout: vertical
          - type: custom:mushroom-entity-card
            entity: button.x1c_DEINBAMBU_druckvorgang_anhalten
            primary_info: none
            secondary_info: none
            tap_action:
              action: toggle
            layout: vertical
          - type: custom:mushroom-entity-card
            entity: button.x1c_DEINBAMBU_druckvorgang_beenden
            primary_info: none
            secondary_info: none
            tap_action:
              action: toggle
            layout: vertical

 

Entitäten auf englisch:
type: vertical-stack
cards:
  - type: picture-elements
    elements:
      - type: custom:config-template-card
        entities:
          - sensor.DEINBAMBU_ams_1_tray_1
        element:
          type: state-icon
          entity: sensor.DEINBAMBU_ams_1_tray_1
          icon: >-
            ${states['sensor.DEINBAMBU_ams_1_tray_1'].state != 'Empty'
            ? 'mdi:bullseye' : 'mdi:tray' }
        style:
          top: 28%
          left: 18%
          '--paper-item-icon-color': var(--tray_1_color)
          background-color: rgba(0,0,0,0.4)
          box-shadow: 0 0 5px 5px var(--tray_1_bg)
          border-radius: 50px
          '--mdc-icon-size': 2.4em
      - type: state-label
        entity: sensor.DEINBAMBU_ams_1_tray_1
        attribute: type
        tap_action:
          action: none
        style:
          top: 77%
          left: 18%
          text-align: center
          font-size: 1em
          background-color: rgba(0,0,0,0.4)
          box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
          border-radius: 50px
          pointer-events: none
      - type: custom:config-template-card
        entities:
          - sensor.DEINBAMBU_ams_1_tray_2
        element:
          type: state-icon
          entity: sensor.DEINBAMBU_ams_1_tray_2
          icon: >-
            ${states['sensor.DEINBAMBU_ams_1_tray_2'].state != 'Empty'
            ? 'mdi:bullseye' : 'mdi:tray' }
        style:
          top: 28%
          left: 39%
          '--paper-item-icon-color': var(--tray_2_color)
          background-color: rgba(0,0,0,0.5)
          box-shadow: 0 0 5px 5px  var(--tray_2_bg)
          border-radius: 50px
          '--mdc-icon-size': 2.4em
      - type: state-label
        entity: sensor.DEINBAMBU_ams_1_tray_2
        attribute: type
        tap_action:
          action: none
        style:
          top: 77%
          left: 39%
          text-align: center
          font-size: 1em
          background-color: rgba(0,0,0,0.4)
          box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
          border-radius: 50px
          pointer-events: none
      - type: custom:config-template-card
        entities:
          - sensor.DEINBAMBU_ams_1_tray_3
        element:
          type: state-icon
          entity: sensor.DEINBAMBU_ams_1_tray_3
          icon: >-
            ${states['sensor.DEINBAMBU_ams_1_tray_3'].state != 'Empty'
            ? 'mdi:bullseye' : 'mdi:tray' }
        style:
          top: 28%
          left: 61%
          '--paper-item-icon-color': var(--tray_3_color)
          background-color: rgba(0,0,0,0.5)
          box-shadow: 0 0 5px 5px  var(--tray_3_bg)
          border-radius: 50px
          '--mdc-icon-size': 2.4em
      - type: state-label
        entity: sensor.DEINBAMBU_ams_1_tray_3
        attribute: type
        tap_action:
          action: none
        style:
          top: 77%
          left: 61%
          text-align: center
          font-size: 1em
          background-color: rgba(0,0,0,0.4)
          box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
          border-radius: 50px
          pointer-events: none
      - type: custom:config-template-card
        entities:
          - sensor.DEINBAMBU_ams_1_tray_4
        element:
          type: state-icon
          entity: sensor.DEINBAMBU_ams_1_tray_4
          icon: >-
            ${states['sensor.DEINBAMBU_ams_1_tray_4'].state != 'Empty'
            ? 'mdi:bullseye' : 'mdi:tray' }
        style:
          top: 28%
          left: 83%
          '--paper-item-icon-color': var(--tray_4_color)
          background-color: rgba(0,0,0,0.5)
          box-shadow: 0 0 5px 5px var(--tray_4_bg)
          border-radius: 50px
          '--mdc-icon-size': 2.4em
      - type: state-label
        entity: sensor.DEINBAMBU_ams_1_tray_4
        attribute: type
        tap_action:
          action: none
        style:
          top: 77%
          left: 83%
          text-align: center
          font-size: 1em
          background-color: rgba(0,0,0,0.4)
          box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
          border-radius: 50px
          pointer-events: none
      - type: state-badge
        entity: sensor.DEINBAMBU_ams_1_humidity_index
        style:
          top: 20%
          left: 29%
          color: transparent
      - type: state-badge
        entity: sensor.DEINBAMBU_ams_1_ams_temperature
        style:
          top: 20%
          left: 72%
          color: transparent
    image: /local/ams.png
    style: |
      ha-card {
        background: none !important;
        border: none !important;
        --tray_1_color: {% if is_state('sensor.DEINBAMBU_ams_1_tray_1', 'Empty') %} grey; {% else %} {{
            state_attr('sensor.DEINBAMBU_ams_1_tray_1', 'Color') }}; {% endif %}
        --tray_2_color: {% if is_state('sensor.DEINBAMBU_ams_1_tray_2', 'Empty') %} grey; {% else %} {{
            state_attr('sensor.DEINBAMBU_ams_1_tray_2', 'Color') }}; {% endif %}
        --tray_3_color: {% if is_state('sensor.DEINBAMBU_ams_1_tray_3', 'Empty') %} grey; {% else %} {{
            state_attr('sensor.DEINBAMBU_ams_1_tray_3', 'Color') }}; {% endif %}
        --tray_4_color: {% if is_state('sensor.DEINBAMBU_ams_1_tray_4', 'Empty') %} grey; {% else %} {{
            state_attr('sensor.DEINBAMBU_ams_1_tray_4', 'Color') }}; {% endif %}
        --tray_1_bg: {% if is_state_attr('sensor.DEINBAMBU_ams_1_tray_1', 'id', state_attr('sensor.DEINBAMBU_active_tray_index', 'id')) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
        --tray_2_bg: {% if is_state_attr('sensor.DEINBAMBU_ams_1_tray_2', 'id', state_attr('sensor.DEINBAMBU_active_tray_index', 'id')) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
        --tray_3_bg: {% if is_state_attr('sensor.DEINBAMBU_ams_1_tray_3', 'id', state_attr('sensor.DEINBAMBU_active_tray_index', 'id')) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
        --tray_4_bg: {% if is_state_attr('sensor.DEINBAMBU_ams_1_tray_4', 'id', state_attr('sensor.DEINBAMBU_active_tray_index', 'id')) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
      }
  - type: picture-elements
    elements:
      - type: state-badge
        entity: sensor.DEINBAMBU_bed_temperature
        style:
          top: 75%
          left: 50%
          color: transparent
      - type: state-badge
        entity: sensor.DEINBAMBU_nozzle_temperature
        style:
          top: 32%
          left: 50%
          color: transparent
      - type: state-badge
        entity: sensor.DEINBAMBU_chamber_temperature
        style:
          top: 32%
          left: 80%
          color: transparent
      - type: state-icon
        entity: light.DEINBAMBU_chamber_light
        tap_action:
          action: toggle
        style:
          top: 32%
          left: 12%
          transform: scale(1.5,1.5)
        icon: mdi:led-strip
      - type: state-icon
        entity: light.switch_3d_drucker_licht
        tap_action:
          action: toggle
        style:
          top: 25%
          left: 12%
          transform: scale(1.5,1.5)
        icon: mdi:led-strip-variant
    image: /local/x1c.png
    style: |
      ha-card {
        background: none !important;
        border: none !important;
        --tray_0_color: {% if is_state('sensor.ams_0_bambu_x1c_tray_0', 'Empty') %} grey; {% else %} {{
            state_attr('sensor.ams_0_bambu_x1c_tray_0', 'color') }}; {% endif %}
        --tray_1_color: {% if is_state('sensor.ams_0_bambu_x1c_tray_1', 'Empty') %} grey; {% else %} {{
            state_attr('sensor.ams_0_bambu_x1c_tray_1', 'color') }}; {% endif %}
        --tray_2_color: {% if is_state('sensor.ams_0_bambu_x1c_tray_2', 'Empty') %} grey; {% else %} {{
            state_attr('sensor.ams_0_bambu_x1c_tray_2', 'color') }}; {% endif %}
        --tray_3_color: {% if is_state('sensor.ams_0_bambu_x1c_tray_3', 'Empty') %} grey; {% else %} {{
            state_attr('sensor.ams_0_bambu_x1c_tray_3', 'color') }}; {% endif %}
        --tray_0_bg: {% if is_state_attr('sensor.ams_0_bambu_x1c_tray_0', 'id', state_attr('sensor.current_ams_filament_in_use', 'id')) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
        --tray_1_bg: {% if is_state_attr('sensor.ams_0_bambu_x1c_tray_1', 'id', state_attr('sensor.current_ams_filament_in_use', 'id')) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
        --tray_2_bg: {% if is_state_attr('sensor.ams_0_bambu_x1c_tray_2', 'id', state_attr('sensor.current_ams_filament_in_use', 'id')) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
        --tray_3_bg: {% if is_state_attr('sensor.ams_0_bambu_x1c_tray_3', 'id', state_attr('sensor.current_ams_filament_in_use', 'id')) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
      }