Skip to content

Instantly share code, notes, and snippets.

@WolfwithSword
Last active April 26, 2024 05:57
Show Gist options
  • 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
Loading
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
@alpine79
Copy link

This is awesome! I did replace the custom: part of 'custom:filament-1' with fapro: to load up the custom svg using fontawesome. Maybe you also had the older Custom Icons Loader or another custom integration installed from hacs to use custom:?

@WolfwithSword
Copy link
Author

WolfwithSword commented Jan 10, 2023

Yeah, honestly I spent 3 days and like 10 different methods to get custom svg's to load and I didn't know which worked - the fapro way did, but I wanted it to have the "custom" prefix so... I wish I could tell you which worked, but I do not know as I have like 5 different methods active and not sure which worked 😆

@Muyz
Copy link

Muyz commented Jan 12, 2023

Thanks for the great work! I have most of it running. One thing I cannot do is adjust the print speed. Somehow, the select entities are not available in HA. Any idea on how to solve this?

@WolfwithSword
Copy link
Author

WolfwithSword commented Jan 12, 2023

Thanks for the great work! I have most of it running. One thing I cannot do is adjust the print speed. Somehow, the select entities are not available in HA. Any idea on how to solve this?

@Muyz Are you using the updated nodered flow mentioned above? Not the first one that had the HA palette/nodes.

Is the select entity there on your printer in the MQTT device? Controls section should look like this:

image
& Mine has an entity id of select.x1c_3dp_00m_547_speed, for example.

@Muyz
Copy link

Muyz commented Jan 12, 2023

Thanks for your help. My controls look different:
Screenshot 2023-01-12 at 22 26 03
So speed is indeed missing.

I do use the nodered flow mentioned above, i.e. the one located here: https://gist.github.com/WolfwithSword/e3e4dc4f00629cc047b7cefd70d7b350

@WolfwithSword
Copy link
Author

Any errors in your nodered flow? If you connect to your HA MQTT instance with MQTT-Explorer, then go to select topic, anything for the printer?

You could try doing some debug nodes for whole message right before the X1C Config and X1C State nodes (put a switch in front to filter by msg.topic == speed) To see if anything comes through before the config nodes. Depending if you see anything or not, put a debug node before and after the "Translate X1C Speed Profile" function node. That should be what makes it based on the printer's reported status.

@alpine79
Copy link

alpine79 commented Jan 12, 2023

Mine is the same as well actually now that I look - no select for speed control. Speed does show up as a sensor, and if I manually publish one of the speeds ( ie Sport) to the set speed topic, it sends the corresponding MQTT message to the printer and the change is reflected in the speed sensor in HA.

EDIT: there was no select topic when I first connected to my HA MQTT instance with MQTT-Explorer.

@WolfwithSword
Copy link
Author

Welp, I found out why - I'm pushing a new update to both the nodered flow and this yaml in the next hour or so. Also fixes the select not showing the value internally :)

@WolfwithSword
Copy link
Author

Rev 3:

  • Fixed the Speed Control and Select Entity Control. Requires you to update the NodeRed flow.

@WolfwithSword
Copy link
Author

Rev 4:

  • Added AMS Temperature and Humidity to AMS layout
  • Changed custom:filament-1 to fapro:filament-1 as it's the easier way for people to use custom icons
  • Requires updating the nodered flow. Added Buttons for Pause/Resume and Cancel print (only appears when appropriate - both only active during a print, and pause/resume replace each other depending on state)
  • Requires nodered update. Added HMS Codes sensor to the list under Stage.

@WolfwithSword
Copy link
Author

WolfwithSword commented Feb 10, 2023

Rev 5-7: Can safely ignore. I have extracted and copied out the individual priner/ams/control yaml cards for use with an upcoming configuration tool I'm making.

Rev 8: Fixed the pause/resume and stop button icons not working when print state is "FINISH". Forgot about that one, whoops.

@WolfwithSword
Copy link
Author

New guide is up for the YAMLs https://www.wolfwithsword.com/bambulab-home-assistant-dashboard/ This should make it easier to configure for people, and to follow instead of looking through these comments.

@mainmind83
Copy link

Add some icons to final stack ;D

  - type: vertical-stack
    cards:
      - type: entities
        entities:
          - entity: sensor.x1c_{PRINTER_NAME}_stage
            icon: mdi:state-machine
            name: Stage
          - entity: sensor.x1c_{PRINTER_NAME}_hms
            icon: mdi:message-alert-outline
            name: HMS Errors
          - entity: sensor.x1c_{PRINTER_NAME}_print_start_time
            icon: mdi:clock-start
            name: Start Time
            attribute: start_time
          - entity: sensor.x1c_{PRINTER_NAME}_print_end_time
            name: End Time
            icon: mdi:clock-end
            attribute: end_time
          - entity: sensor.x1c_{PRINTER_NAME}_print_remaining_time

@WolfwithSword
Copy link
Author

@mainmind83 Awesome! I struggled to think of good icons for some of these. I think I'll add them direct into the nodered flow itself as defaults later!

@WolfwithSword
Copy link
Author

Rev 10: Introduced new file for Printer Control, see guide for it.

Rev 11:

  • Updated Printer Image YAML. No longer will a URL be required for the preview image (no more {PREVIEW_URL}). Instead it will use a mqtt-based camera entity created by Rev 33 of the main/advanced flow (will remain blank if not configured).

@WolfwithSword
Copy link
Author

Forgot to mention Rev 12: Added individual yaml for a P1P

@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