BambuLab Integration

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

image.png

Benötigte HACS Cards:

Files: x1c files.zip

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:

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 %}
      }

Revision #9
Created 8 August 2023 20:18:38 by Cryd
Updated 15 October 2023 21:11:33 by Cryd