Skip to content

Instantly share code, notes, and snippets.

@WolfwithSword
Last active April 26, 2024 05:57
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save WolfwithSword/4175a46c872f69542376206bab4ccfc3 to your computer and use it in GitHub Desktop.
Save WolfwithSword/4175a46c872f69542376206bab4ccfc3 to your computer and use it in GitHub Desktop.
Bambu X1C + NodeRed HomeAssistant YAML Snippet
type: picture-elements
view_layout:
column: 1
elements:
- type: custom:config-template-card
entities:
- sensor.{HA_PRINTER_DEVICE_NAME}_vt_tray
element:
type: state-icon
entity: sensor.{HA_PRINTER_DEVICE_NAME}_vt_tray
icon: >-
${states['sensor.{HA_PRINTER_DEVICE_NAME}_vt_tray'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 50%
left: 50%
transform: translate(-50%, -50%) scale(200%)
'--paper-item-icon-color': var(--tray_vt_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_vt_bg)
border-radius: 50px
'--mdc-icon-size': 1.8em
- type: state-label
entity: sensor.{HA_PRINTER_DEVICE_NAME}_vt_tray
attribute: type
tap_action:
action: none
style:
top: 50%
left: 85%
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'
- entity: button.{HA_PRINTER_DEVICE_NAME}_clear_external_spool
icon: mdi:delete
service: button.press
style:
top: 40%
color: rgb(180,33,50)
'--mdc-icon-size': 3.5em
left: 2%
transform: initial
tap_action:
action: call-service
service: button.press
target:
entity_id: button.{HA_PRINTER_DEVICE_NAME}_clear_external_spool
type: icon
image: /local/media/bambuprinter/spool.png
style: |
ha-card {
margin-left: auto;
margin-right: auto;
width: 60%;
height: 60%;
background: none !important;
border: none !important;
box-shadow: none !important;
--tray_vt_color: {{state_attr('sensor.{HA_PRINTER_DEVICE_NAME}_vt_tray', 'color') }};
--tray_vt_bg: {% if is_state_attr('sensor.{HA_PRINTER_DEVICE_NAME}_vt_tray', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
type: picture-elements
view_layout:
column: 1
elements:
- type: custom:config-template-card
entities:
- sensor.{HA_AMS_DEVICE_NAME}_tray_0
element:
type: state-icon
entity: sensor.{HA_AMS_DEVICE_NAME}_tray_0
icon: >-
${states['sensor.{HA_AMS_DEVICE_NAME}_tray_0'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 21.4%
'--paper-item-icon-color': var(--tray_0_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_0_bg)
border-radius: 50px
'--mdc-icon-size': 2.4em
- type: state-label
entity: sensor.{HA_AMS_DEVICE_NAME}_tray_0
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.{HA_AMS_DEVICE_NAME}_tray_1
element:
type: state-icon
entity: sensor.{HA_AMS_DEVICE_NAME}_tray_1
icon: >-
${states['sensor.{HA_AMS_DEVICE_NAME}_tray_1'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 39.7%
'--paper-item-icon-color': var(--tray_1_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_1_bg)
border-radius: 50px
'--mdc-icon-size': 2.4em
- type: state-label
entity: sensor.{HA_AMS_DEVICE_NAME}_tray_1
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.{HA_AMS_DEVICE_NAME}_tray_2
element:
type: state-icon
entity: sensor.{HA_AMS_DEVICE_NAME}_tray_2
icon: >-
${states['sensor.{HA_AMS_DEVICE_NAME}_tray_2'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 59.7%
'--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.{HA_AMS_DEVICE_NAME}_tray_2
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.{HA_AMS_DEVICE_NAME}_tray_3
element:
type: state-icon
entity: sensor.{HA_AMS_DEVICE_NAME}_tray_3
icon: >-
${states['sensor.{HA_AMS_DEVICE_NAME}_tray_3'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 79.6%
'--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.{HA_AMS_DEVICE_NAME}_tray_3
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.{HA_PRINTER_DEVICE_NAME}_print_status
state_not: OFFLINE
elements:
- entity: sensor.{HA_AMS_DEVICE_NAME}_temp
type: state-badge
style:
top: 18%
left: 8%
font-size: 0.75em
color: rgba(0,0,0,0)
- entity: sensor.{HA_AMS_DEVICE_NAME}_humidity
type: state-badge
style:
top: 18%
left: 92.5%
font-size: 0.75em
color: rgba(0,0,0,0)
'--label-badge-red': '#2F9AC5'
image: /local/media/AMS_2.png
style: |
ha-card {
background: none !important;
border: none !important;
box-shadow: none !important;
--tray_0_color: {{state_attr('sensor.{HA_AMS_DEVICE_NAME}_tray_0', 'color') }};
--tray_1_color: {{state_attr('sensor.{HA_AMS_DEVICE_NAME}_tray_1', 'color') }};
--tray_2_color: {{state_attr('sensor.{HA_AMS_DEVICE_NAME}_tray_2', 'color') }};
--tray_3_color: {{state_attr('sensor.{HA_AMS_DEVICE_NAME}_tray_3', 'color') }};
--tray_0_bg: {% if is_state_attr('sensor.{HA_AMS_DEVICE_NAME}_tray_0', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_1_bg: {% if is_state_attr('sensor.{HA_AMS_DEVICE_NAME}_tray_1', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_2_bg: {% if is_state_attr('sensor.{HA_AMS_DEVICE_NAME}_tray_2', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_3_bg: {% if is_state_attr('sensor.{HA_AMS_DEVICE_NAME}_tray_3', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
}
type: vertical-stack
view_layout:
column: 3
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
show_name: false
show_icon: true
tap_action:
action: toggle
entity: switch.{HA_PRINTER_SMARTPLUG_NAME}
icon: mdi:printer-3d
state:
- value: 'on'
icon: mdi:power
color: green
- value: 'off'
icon: mdi:power
color: grey
aspect_ratio: 2
style: |
ha-card {
box-shadow: none !important;
background: rgba(0,0,0,0);
border: none;
}
- type: custom:mushroom-title-card
title: {PRINTER_TITLE}
alignment: center
- type: custom:gap-card
- type: custom:gap-card
height: 25
- type: custom:hui-element
card_type: horizontal-stack
cards:
- type: custom:hui-element
card_type: button
entity: select.{HA_PRINTER_DEVICE_NAME}_speed
name: Silent
icon: mdi:speedometer-slow
tap_action:
action: call-service
service: select.select_option
data:
option: Silent
target:
entity_id: select.{HA_PRINTER_DEVICE_NAME}_speed
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--pbs-button-color: {% if is_state('select.{HA_PRINTER_DEVICE_NAME}_speed', 'Silent') %} yellow; {% else %} grey; {% endif %}
--paper-item-icon-color: {% if is_state('select.{HA_PRINTER_DEVICE_NAME}_speed', 'Silent') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.{HA_PRINTER_DEVICE_NAME}_speed
name: Standard
icon: mdi:speedometer-medium
tap_action:
action: call-service
service: select.select_option
data:
option: Standard
target:
entity_id: select.{HA_PRINTER_DEVICE_NAME}_speed
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.{HA_PRINTER_DEVICE_NAME}_speed', 'Standard') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.{HA_PRINTER_DEVICE_NAME}_speed
name: Sport
icon: mdi:speedometer
tap_action:
action: call-service
service: select.select_option
data:
option: Sport
target:
entity_id: select.{HA_PRINTER_DEVICE_NAME}_speed
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.{HA_PRINTER_DEVICE_NAME}_speed', 'Sport') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.{HA_PRINTER_DEVICE_NAME}_speed
name: Ludicrous
icon: mdi:speedometer
tap_action:
action: call-service
service: select.select_option
data:
option: Ludicrous
target:
entity_id: select.{HA_PRINTER_DEVICE_NAME}_speed
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.{HA_PRINTER_DEVICE_NAME}_speed', 'Ludicrous') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:gap-card
height: 25
- type: custom:hui-element
card_type: horizontal-stack
cards:
- type: custom:button-card
variables:
pause_entity: button.{HA_PRINTER_DEVICE_NAME}_pause_print
start_entity: button.{HA_PRINTER_DEVICE_NAME}_resume_print
entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_status
name: |
[[[ if (entity.state == 'RUNNING') return "Pause";
else if (entity.state =='PAUSE') return "Resume";
else return ''; ]]]
state:
- value: RUNNING
icon: mdi:pause
color: orange
- value: PAUSE
icon: mdi:play
color: orange
- value: OFFLINE
icon: mdi:void
color: grey
- value: IDLE
icon: mdi:void
color: grey
- value: FAILED
icon: mdi:void
color: grey
- value: FINISH
icon: mdi:void
color: grey
- value: PREPARE
icon: mdi:void
color: grey
tap_action:
action: >
[[[ if (entity.state == 'RUNNING' || entity.state == 'PAUSE') return
"call-service";
else return "none";
]]]
service: button.press
service_data:
entity_id: >
[[[ if (states['sensor.{HA_PRINTER_DEVICE_NAME}_print_status'].state ==
'RUNNING')
return variables.pause_entity;
if (states['sensor.{HA_PRINTER_DEVICE_NAME}_print_status'].state == 'PAUSE')
return variables.start_entity;
else return "";
]]]
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('sensor.{HA_PRINTER_DEVICE_NAME}_print_status', 'RUNNING') or is_state('sensor.{HA_PRINTER_DEVICE_NAME}_print_status', 'PAUSE') %} orange; {% else %} grey; {% endif %}
}
- type: custom:gap-card
- type: custom:button-card
entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_status
name: |
[[[ if (entity.state == 'RUNNING') return "Cancel";
else if (entity.state =='PAUSE') return "Cancel";
else return ''; ]]]
confirmation:
text: Cancel Print?
state:
- value: RUNNING
icon: mdi:cancel
color: red
- value: PAUSE
icon: mdi:cancel
color: red
- value: OFFLINE
icon: mdi:void
color: grey
- value: IDLE
icon: mdi:void
color: grey
- value: FAILED
icon: mdi:void
color: grey
- value: FINISH
icon: mdi:void
color: grey
- value: PREPARE
icon: mdi:void
color: grey
tap_action:
action: >
[[[ if (entity.state == 'RUNNING' || entity.state == 'PAUSE') return
"call-service"; else return "none"; ]]]
service: button.press
service_data:
entity_id: button.{HA_PRINTER_DEVICE_NAME}_stop_print
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('sensor.{HA_PRINTER_DEVICE_NAME}_print_status', 'RUNNING') or is_state('sensor.{HA_PRINTER_DEVICE_NAME}_print_status', 'PAUSE') %} red; {% else %} grey; {% endif %}
}
- type: custom:mushroom-title-card
title: ''
subtitle: Print Details
alignment: center
- type: custom:mushroom-entity-card
entity: sensor.{HA_PRINTER_DEVICE_NAME}_subtask
name: Task
- type: horizontal-stack
cards:
- type: custom:mushroom-entity-card
entity: sensor.{HA_PRINTER_DEVICE_NAME}_print
name: Details
- type: custom:mushroom-entity-card
entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_progress
name: Progress
- type: custom:mushroom-template-card
primary: Layer
icon_color: var(--rgb-state-entity)
secondary: >-
{{states('sensor.{HA_PRINTER_DEVICE_NAME}_layer_num')}} /
{{states('sensor.{HA_PRINTER_DEVICE_NAME}_total_layer_num')}}
icon: mdi:layers
- type: vertical-stack
cards:
- type: entities
entities:
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_stage
name: Stage
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_hms
name: HMS Errors
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_start_time
name: Start Time
attribute: start_time
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_end_time
name: End Time
attribute: end_time
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_remaining_time
type: picture-elements
view_layout:
column: 1
elements:
- type: conditional
conditions:
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_status
state_not: OFFLINE
elements:
- entity: light.{HA_PRINTER_DEVICE_NAME}_chamber_light
type: state-icon
style:
top: 46%
left: 18%
'--mdc-icon-size': 2.6em
tap_action:
action: toggle
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_status
type: state-label
style:
top: 8.6%
left: 32.8%
font-size: 1.2em
color: '#FFFFFF'
- type: conditional
conditions:
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_status
state: RUNNING
elements:
- type: custom:hui-element
card_type: picture-entity
show_name: false
show_state: false
entity: camera.{HA_PRINTER_DEVICE_NAME}_print_preview
style:
top: 50%
left: 50%
transform: translate(-45%, -40%) scale(75%, 75%)
'--ha-card-border-width': 0px
'--ha-card-background': none
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_progress
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.{HA_PRINTER_DEVICE_NAME}_nozzle_temperature
type: state-badge
style:
top: 31%
left: 51%
font-size: 0.8em
color: rgba(0,0,0,0)
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_bed_temperature
type: state-badge
style:
top: 78%
left: 51%
font-size: 0.8em
color: rgba(0,0,0,0)
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_chamber_temperature
type: state-badge
style:
font-size: 0.8em
top: 31%
left: 19%
color: rgba(0,0,0,0)
style: |
ha-card {
box-shadow: none !important;
background: none !important;
border: none !important;
}
image: /local/media/bambuprinter/on_lighton_2.png
entity: light.{HA_PRINTER_DEVICE_NAME}_chamber_light
state_image:
unavailable: /local/media/bambuprinter/off.png
'on': /local/media/bambuprinter/on_lighton_2.png
'off': /local/media/bambuprinter/off.png
type: picture-elements
view_layout:
column: 1
elements:
- type: conditional
conditions:
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_status
state_not: OFFLINE
elements:
- entity: light.{HA_PRINTER_DEVICE_NAME}_chamber_light
type: state-icon
style:
top: 46%
left: 18%
'--mdc-icon-size': 2.6em
tap_action:
action: toggle
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_status
type: state-label
style:
top: 9.8%
left: 21.8%
font-size: 1.2em
color: '#FFFFFF'
- type: conditional
conditions:
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_status
state: RUNNING
elements:
- type: custom:hui-element
card_type: picture-entity
show_name: false
show_state: false
entity: camera.{HA_PRINTER_DEVICE_NAME}_print_preview
style:
top: 50%
left: 50%
transform: translate(-45%, -40%) scale(75%, 75%)
'--ha-card-border-width': 0px
'--ha-card-background': none
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_print_progress
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.{HA_PRINTER_DEVICE_NAME}_nozzle_temperature
type: state-badge
style:
top: 31%
left: 51%
font-size: 0.8em
color: rgba(0,0,0,0)
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_bed_temperature
type: state-badge
style:
top: 78%
left: 51%
font-size: 0.8em
color: rgba(0,0,0,0)
- entity: sensor.{HA_PRINTER_DEVICE_NAME}_chamber_temperature
type: state-badge
style:
font-size: 0.8em
top: 31%
left: 19%
color: rgba(0,0,0,0)
style: |
ha-card {
box-shadow: none !important;
background: none !important;
border: none !important;
}
image: /local/media/bambuprinter/on_p1p.png
entity: light.{HA_PRINTER_DEVICE_NAME}_chamber_light
state_image:
unavailable: /local/media/bambuprinter/off_p1p.png
'on': /local/media/bambuprinter/on_p1p.png
'off': /local/media/bambuprinter/off_p1p.png
type: custom:layout-card
layout_type: custom:horizontal-layout
layout:
max_cols: 3
cards:
- type: picture-elements
view_layout:
column: 1
elements:
- type: custom:config-template-card
entities:
- sensor.ams_0_{PRINTER_NAME}_tray_0
element:
type: state-icon
entity: sensor.ams_0_{PRINTER_NAME}_tray_0
icon: >-
${states['sensor.ams_0_{PRINTER_NAME}_tray_0'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 21.4%
'--paper-item-icon-color': var(--tray_0_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_0_bg)
border-radius: 50px
'--mdc-icon-size': 2.4em
- type: state-label
entity: sensor.ams_0_{PRINTER_NAME}_tray_0
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
- type: custom:config-template-card
entities:
- sensor.ams_0_{PRINTER_NAME}_tray_1
element:
type: state-icon
entity: sensor.ams_0_{PRINTER_NAME}_tray_1
icon: >-
${states['sensor.ams_0_{PRINTER_NAME}_tray_1'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 39.7%
'--paper-item-icon-color': var(--tray_1_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_1_bg)
border-radius: 50px
'--mdc-icon-size': 2.4em
- type: state-label
entity: sensor.ams_0_{PRINTER_NAME}_tray_1
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
- type: custom:config-template-card
entities:
- sensor.ams_0_{PRINTER_NAME}_tray_2
element:
type: state-icon
entity: sensor.ams_0_{PRINTER_NAME}_tray_2
icon: >-
${states['sensor.ams_0_{PRINTER_NAME}_tray_2'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 59.7%
'--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.ams_0_{PRINTER_NAME}_tray_2
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
- type: custom:config-template-card
entities:
- sensor.ams_0_{PRINTER_NAME}_tray_3
element:
type: state-icon
entity: sensor.ams_0_{PRINTER_NAME}_tray_3
icon: >-
${states['sensor.ams_0_{PRINTER_NAME}_tray_3'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 79.6%
'--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.ams_0_{PRINTER_NAME}_tray_3
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
- type: conditional
conditions:
- entity: sensor.x1c_{PRINTER_NAME}_print_status
state_not: OFFLINE
elements:
- entity: sensor.ams_0_{PRINTER_NAME}_temp
type: state-badge
style:
top: 18%
left: 8%
font-size: 0.75em
color: rgba(0,0,0,0)
- entity: sensor.ams_0_{PRINTER_NAME}_humidity
type: state-badge
style:
top: 18%
left: 92.5%
font-size: 0.75em
color: rgba(0,0,0,0)
'--label-badge-red': '#2F9AC5'
image: /local/media/AMS_2.png
style: |
ha-card {
background: none !important;
border: none !important;
--tray_0_color: {{state_attr('sensor.ams_0_{PRINTER_NAME}_tray_0', 'color') }};
--tray_1_color: {{state_attr('sensor.ams_0_{PRINTER_NAME}_tray_1', 'color') }};
--tray_2_color: {{state_attr('sensor.ams_0_{PRINTER_NAME}_tray_2', 'color') }};
--tray_3_color: {{state_attr('sensor.ams_0_{PRINTER_NAME}_tray_3', 'color') }};
--tray_0_bg: {% if is_state_attr('sensor.ams_0_{PRINTER_NAME}_tray_0', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_1_bg: {% if is_state_attr('sensor.ams_0_{PRINTER_NAME}_tray_1', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_2_bg: {% if is_state_attr('sensor.ams_0_{PRINTER_NAME}_tray_2', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_3_bg: {% if is_state_attr('sensor.ams_0_{PRINTER_NAME}_tray_3', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
}
- type: picture-elements
view_layout:
column: 1
elements:
- type: conditional
conditions:
- entity: sensor.x1c_{PRINTER_NAME}_print_status
state_not: OFFLINE
elements:
- entity: light.x1c_{PRINTER_NAME}_chamber_light
type: state-icon
style:
top: 46%
left: 18%
'--mdc-icon-size': 2.6em
tap_action:
action: toggle
- entity: sensor.x1c_{PRINTER_NAME}_print_status
type: state-label
style:
top: 8.6%
left: 32.8%
font-size: 1.2em
- type: conditional
conditions:
- entity: sensor.x1c_{PRINTER_NAME}_print_status
state: RUNNING
elements:
- type: custom:hui-element
card_type: picture
entity: sensor.x1c_{PRINTER_NAME}_subtask
image: >-
{PREVIEW_URL}
style:
top: 50%
left: 50%
transform: translate(-45%, -50%) scale(60%, 60%)
'--ha-card-border-width': 0px
'--ha-card-background': none
- entity: sensor.x1c_{PRINTER_NAME}_print_progress
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_{PRINTER_NAME}_nozzle_temperature
type: state-badge
style:
top: 31%
left: 51%
font-size: 0.8em
color: rgba(0,0,0,0)
- entity: sensor.x1c_{PRINTER_NAME}_bed_temperature
type: state-badge
style:
top: 78%
left: 51%
font-size: 0.8em
color: rgba(0,0,0,0)
- entity: sensor.x1c_{PRINTER_NAME}_chamber_temperature
type: state-badge
style:
font-size: 0.8em
top: 31%
left: 19%
color: rgba(0,0,0,0)
style: |
ha-card {
background: none !important;
border: none !important;
}
image: /local/media/bambuprinter/on_lighton_2.png
entity: light.x1c_{PRINTER_NAME}_chamber_light
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
view_layout: null
column: 3
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
show_name: false
show_icon: true
tap_action:
action: toggle
entity: switch.bambu_printer
icon: mdi:printer-3d
state:
- value: 'on'
icon: mdi:power
color: green
- value: 'off'
icon: mdi:power
color: grey
aspect_ratio: 2
style: |
ha-card {
background: rgba(0,0,0,0);
border: none;
}
- type: custom:mushroom-title-card
title: X1-Carbon
alignment: center
- type: custom:gap-card
- type: custom:gap-card
height: 25
- type: custom:hui-element
card_type: horizontal-stack
cards:
- type: custom:hui-element
card_type: button
entity: select.x1c_{PRINTER_NAME}_speed
name: Silent
icon: mdi:speedometer-slow
tap_action:
action: call-service
service: select.select_option
data:
option: Silent
target:
entity_id: select.x1c_{PRINTER_NAME}_speed
style: |
ha-card {
background-color: rgba(0,0,0,0);
border: none;
--pbs-button-color: {% if is_state('select.x1c_{PRINTER_NAME}_speed', 'Silent') %} yellow; {% else %} grey; {% endif %}
--paper-item-icon-color: {% if is_state('select.x1c_{PRINTER_NAME}_speed', 'Silent') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.x1c_{PRINTER_NAME}_speed
name: Standard
icon: mdi:speedometer-medium
tap_action:
action: call-service
service: select.select_option
data:
option: Standard
target:
entity_id: select.x1c_{PRINTER_NAME}_speed
style: |
ha-card {
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.x1c_{PRINTER_NAME}_speed', 'Standard') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.x1c_{PRINTER_NAME}_speed
name: Sport
icon: mdi:speedometer
tap_action:
action: call-service
service: select.select_option
data:
option: Sport
target:
entity_id: select.x1c_{PRINTER_NAME}_speed
style: |
ha-card {
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.x1c_{PRINTER_NAME}_speed', 'Sport') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.x1c_{PRINTER_NAME}_speed
name: Ludicrous
icon: mdi:speedometer
tap_action:
action: call-service
service: select.select_option
data:
option: Ludicrous
target:
entity_id: select.x1c_{PRINTER_NAME}_speed
style: |
ha-card {
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.x1c_{PRINTER_NAME}_speed', 'Ludicrous') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:gap-card
height: 25
- type: custom:hui-element
card_type: horizontal-stack
cards:
- type: custom:button-card
variables:
pause_entity: button.x1c_{PRINTER_NAME}_pause_print
start_entity: button.x1c_{PRINTER_NAME}_resume_print
entity: sensor.x1c_{PRINTER_NAME}_print_status
name: |
[[[ if (entity.state == 'RUNNING') return "Pause";
else if (entity.state =='PAUSE') return "Resume";
else return ''; ]]]
state:
- value: RUNNING
icon: mdi:pause
color: orange
- value: PAUSE
icon: mdi:play
color: orange
- value: OFFLINE
icon: mdi:void
color: grey
- value: IDLE
icon: mdi:void
color: grey
- value: FAILED
icon: mdi:void
color: grey
- value: FINISH
icon: mdi:void
color: grey
tap_action:
action: >
[[[ if (entity.state == 'RUNNING' || entity.state == 'PAUSE')
return "call-service";
else return "none";
]]]
service: button.press
service_data:
entity_id: >
[[[ if (states['sensor.x1c_{PRINTER_NAME}_print_status'].state ==
'RUNNING')
return variables.pause_entity;
if (states['sensor.x1c_{PRINTER_NAME}_print_status'].state == 'PAUSE')
return variables.start_entity;
else return "";
]]]
style: |
ha-card {
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('sensor.x1c_{PRINTER_NAME}_print_status', 'RUNNING') or is_state('sensor.x1c_{PRINTER_NAME}_print_status', 'PAUSE') %} orange; {% else %} grey; {% endif %}
}
- type: custom:gap-card
- type: custom:button-card
entity: sensor.x1c_{PRINTER_NAME}_print_status
name: |
[[[ if (entity.state == 'RUNNING') return "Cancel";
else if (entity.state =='PAUSE') return "Cancel";
else return ''; ]]]
confirmation:
text: Cancel Print?
state:
- value: RUNNING
icon: mdi:cancel
color: red
- value: PAUSE
icon: mdi:cancel
color: red
- value: OFFLINE
icon: mdi:void
color: grey
- value: IDLE
icon: mdi:void
color: grey
- value: FAILED
icon: mdi:void
color: grey
- value: FINISH
icon: mdi:void
color: grey
tap_action:
action: >
[[[ if (entity.state == 'RUNNING' || entity.state == 'PAUSE')
return "call-service"; else return "none"; ]]]
service: button.press
service_data:
entity_id: button.x1c_{PRINTER_NAME}_stop_print
style: |
ha-card {
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('sensor.x1c_{PRINTER_NAME}_print_status', 'RUNNING') or is_state('sensor.x1c_{PRINTER_NAME}_print_status', 'PAUSE') %} red; {% else %} grey; {% endif %}
}
- type: custom:mushroom-title-card
title: ''
subtitle: Print Details
alignment: center
- type: custom:mushroom-entity-card
entity: sensor.x1c_{PRINTER_NAME}_subtask
name: Task
- type: horizontal-stack
cards:
- type: custom:mushroom-entity-card
entity: sensor.x1c_{PRINTER_NAME}_print
name: Details
- type: custom:mushroom-entity-card
entity: sensor.x1c_{PRINTER_NAME}_print_progress
name: Progress
- type: custom:mushroom-template-card
primary: Layer
icon_color: var(--rgb-state-entity)
secondary: >-
{{states('sensor.{PRINTER_NAME}_layer_num')}} /
{{states('sensor.{PRINTER_NAME}_total_layer_num')}}
icon: mdi:layers
- type: vertical-stack
cards:
- type: entities
entities:
- entity: sensor.x1c_{PRINTER_NAME}_stage
name: Stage
- entity: sensor.x1c_{PRINTER_NAME}_hms
name: HMS Errors
- entity: sensor.x1c_{PRINTER_NAME}_print_start_time
name: Start Time
attribute: start_time
- entity: sensor.x1c_{PRINTER_NAME}_print_end_time
name: End Time
attribute: end_time
- entity: sensor.x1c_{PRINTER_NAME}_print_remaining_time
type: custom:layout-card
layout_type: custom:horizontal-layout
layout:
max_cols: 2
cards:
- type: vertical-stack
cards:
- type: entities
entities:
- entity: switch.{HA_PRINTER_DEVICE_NAME}_directory_bed_leveling
- entity: switch.{HA_PRINTER_DEVICE_NAME}_directory_first_layer_inspection
- entity: switch.{HA_PRINTER_DEVICE_NAME}_directory_flow_calibration
- entity: switch.{HA_PRINTER_DEVICE_NAME}_directory_timelapse
- entity: switch.{HA_PRINTER_DEVICE_NAME}_directory_vibration_calibration
- entity: switch.{HA_PRINTER_DEVICE_NAME}_directory_use_ams
show_header_toggle: false
view_layout:
column: 1
- type: custom:mushroom-title-card
title: ''
subtitle: >-
"Use AMS" will use filaments in slot order (1-4) regardless of
settings in Bambu Studio or Print File
- type: vertical-stack
cards:
- type: custom:mushroom-select-card
entity: select.{HA_PRINTER_DEVICE_NAME}_directory_files
secondary_info: none
fill_container: false
primary_info: name
- type: custom:mushroom-number-card
entity: number.{HA_PRINTER_DEVICE_NAME}_directory_plate_number
display_mode: buttons
secondary_info: none
layout: horizontal
- show_name: true
show_icon: true
type: custom:button-card
aspect_ratio: 3
icon: mdi:gesture-tap-button
tap_action:
action: call-service
service: button.press
service_data:
entity_id: button.{HA_PRINTER_DEVICE_NAME}_directory_print_with_settings
entity: button.{HA_PRINTER_DEVICE_NAME}_directory_print_with_settings
view_layout:
column: 2
@WolfwithSword
Copy link
Author

Rev 13 & 14: Added override for "color" in state labels to #FFFFFF white. As they are always on a dark background and if you are using lightmode in HA, they would otherwise be dark text.

@WolfwithSword
Copy link
Author

Rev 17: External spool now has a delete/clear button on the left

@Jwill8712
Copy link

is there someone that can give me a walkthrough

@WolfwithSword
Copy link
Author

is there someone that can give me a walkthrough

Surprised how you got to these links @Jwill8712 - they've been inactive for a year as I've switched all my yaml's to a repo now but if you want a walkthrough, I have my guides and configurators here which should answer all your questions: https://www.wolfwithsword.com/bambulab-home-assistant-dashboard/ and configure everything for you without needing to do it manually.

May I ask how you stumbled onto here? Pretty sure I had all my links updated away from the gists lol

If you still need help after trying the intended guide and configurator(s), feel free to message me on discord ( @wolfwithsword ) if it's easier.

@Jwill8712
Copy link

@WolfwithSword just thumbing through the internet to put us to my pi. I finally figured it out after getting fontawesome to finally downloaded. I was have a time with the yaml as this was my first time encountering them. Thanks for the reply I will check the new info.

@Jwill8712
Copy link

My set up so far @WolfwithSword
Uploading 1000013713.jpg…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment