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
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32px" height="32px" viewBox="0 0 32 32" version="1.1">
<g id="surface1">
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 12.65625 0.0390625 C 12.519531 0.0507812 12.082031 0.09375 11.6875 0.125 C 7.851562 0.46875 4.488281 1.738281 2.9375 3.425781 C 1.613281 4.863281 1.625 6.429688 2.96875 7.863281 C 4.574219 9.574219 7.742188 10.789062 11.6875 11.199219 C 12.699219 11.304688 15.550781 11.304688 16.5625 11.199219 C 21.917969 10.636719 25.835938 8.554688 26.269531 6.042969 C 26.59375 4.125 24.632812 2.1875 21.210938 1.070312 C 19.773438 0.59375 18.4375 0.320312 16.65625 0.125 C 16.019531 0.0546875 13.113281 -0.0078125 12.65625 0.0390625 Z M 15.625 2.960938 C 17.105469 3.257812 18.167969 3.90625 18.605469 4.792969 C 18.855469 5.3125 18.855469 5.9375 18.605469 6.457031 C 18.257812 7.164062 17.507812 7.726562 16.460938 8.070312 C 15.6875 8.320312 15.125 8.398438 14.125 8.398438 C 13.125 8.398438 12.5625 8.320312 11.789062 8.070312 C 10.742188 7.726562 9.992188 7.164062 9.644531 6.457031 C 9.394531 5.9375 9.394531 5.3125 9.644531 4.792969 C 9.992188 4.085938 10.742188 3.523438 11.800781 3.179688 C 12.25 3.03125 12.5625 2.96875 13.40625 2.851562 C 13.761719 2.800781 15.15625 2.867188 15.625 2.960938 Z M 13.085938 4.773438 C 12.292969 4.925781 11.71875 5.167969 11.445312 5.460938 L 11.292969 5.625 L 11.445312 5.789062 C 11.648438 6.011719 12.105469 6.230469 12.675781 6.386719 C 13.367188 6.582031 14.882812 6.582031 15.574219 6.386719 C 16.144531 6.230469 16.601562 6.011719 16.804688 5.789062 L 16.957031 5.625 L 16.804688 5.460938 C 16.601562 5.238281 16.136719 5.011719 15.574219 4.867188 C 14.949219 4.699219 13.707031 4.65625 13.085938 4.773438 Z M 4.632812 11.542969 C 4.742188 11.710938 5.023438 12.023438 5.25 12.25 C 6.601562 13.570312 8.925781 14.523438 11.75 14.917969 C 12.84375 15.070312 15.40625 15.070312 16.5 14.917969 C 19.324219 14.523438 21.648438 13.570312 23 12.25 C 23.4375 11.824219 23.867188 11.25 23.75 11.25 C 23.710938 11.25 23.542969 11.320312 23.382812 11.40625 C 22.695312 11.75 21.195312 12.257812 20.050781 12.523438 C 15.925781 13.5 10.792969 13.375 7 12.207031 C 6.28125 11.980469 5.242188 11.59375 4.867188 11.40625 C 4.707031 11.320312 4.539062 11.25 4.5 11.25 C 4.460938 11.25 4.523438 11.382812 4.632812 11.542969 Z M 3.9375 13.804688 C 3.9375 13.875 4.007812 14.117188 4.085938 14.335938 C 4.90625 16.511719 7.730469 18.105469 11.757812 18.667969 C 12.835938 18.820312 15.414062 18.820312 16.492188 18.667969 C 20.519531 18.105469 23.34375 16.511719 24.164062 14.335938 C 24.414062 13.667969 24.382812 13.632812 23.894531 14.019531 C 22 15.53125 19.539062 16.445312 16.34375 16.820312 C 15.960938 16.863281 14.980469 16.898438 14.125 16.898438 C 13.269531 16.898438 12.289062 16.863281 11.90625 16.820312 C 8.710938 16.445312 6.25 15.53125 4.363281 14.019531 C 4.007812 13.738281 3.9375 13.699219 3.9375 13.804688 Z M 24.03125 17.664062 C 23.894531 17.78125 23.542969 18.042969 23.25 18.242188 C 21.113281 19.710938 18.269531 20.523438 14.773438 20.664062 L 13.65625 20.707031 L 14.136719 21.199219 C 14.398438 21.46875 14.75 21.875 14.914062 22.09375 C 15.113281 22.367188 15.257812 22.5 15.335938 22.5 C 15.585938 22.5 17.09375 22.3125 17.582031 22.21875 C 20.960938 21.582031 23.554688 19.9375 24.1875 18.023438 C 24.375 17.476562 24.335938 17.398438 24.03125 17.664062 Z M 4.375 18.15625 C 3.84375 18.929688 3.699219 19.664062 3.929688 20.417969 C 4.34375 21.78125 5.730469 22.855469 8.15625 23.6875 C 9.25 24.070312 9.710938 24.292969 10.136719 24.675781 C 10.726562 25.207031 11.023438 25.804688 11.21875 26.84375 C 11.363281 27.648438 11.519531 28.144531 11.832031 28.78125 C 12.65625 30.46875 14.210938 31.644531 16.011719 31.9375 C 16.261719 31.976562 18.894531 32 23.238281 32 L 30.0625 32 L 30.0625 28.1875 L 23.175781 28.175781 L 16.28125 28.15625 L 15.960938 27.988281 C 15.648438 27.824219 15.269531 27.457031 15.117188 27.179688 C 15.082031 27.101562 14.957031 26.667969 14.84375 26.21875 C 14.582031 25.1875 14.25 24.417969 13.730469 23.644531 C 13.210938 22.867188 12.757812 22.363281 12.105469 21.835938 C 11.113281 21.039062 10.105469 20.53125 8.644531 20.101562 C 6.945312 19.59375 5.804688 19.011719 4.9375 18.207031 L 4.570312 17.867188 Z M 24.03125 21.335938 C 22.460938 22.726562 19.792969 23.804688 17.074219 24.164062 C 16.667969 24.21875 16.3125 24.269531 16.269531 24.28125 C 16.21875 24.300781 16.261719 24.488281 16.398438 24.886719 C 16.519531 25.207031 16.644531 25.65625 16.695312 25.886719 L 16.773438 26.3125 L 23.867188 26.3125 L 24.414062 25.992188 C 25.125 25.570312 25.875 24.84375 26.105469 24.335938 C 26.355469 23.804688 26.355469 23.179688 26.101562 22.65625 C 25.898438 22.238281 25.074219 21.375 24.648438 21.144531 L 24.398438 21.007812 Z M 2.324219 22.367188 C 1.726562 23.292969 1.84375 24.179688 2.6875 25.082031 C 3.570312 26.023438 5.074219 26.78125 7.195312 27.335938 C 8.148438 27.585938 9.429688 27.84375 9.480469 27.789062 C 9.550781 27.726562 9.199219 26.4375 9.0625 26.25 C 8.863281 25.976562 8.507812 25.789062 7.46875 25.4375 C 6.292969 25.039062 5.523438 24.675781 4.71875 24.144531 C 4.039062 23.6875 3.148438 22.851562 2.792969 22.320312 L 2.570312 21.980469 Z M 2.324219 22.367188 "/>
</g>
</svg>
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

WolfwithSword commented Dec 26, 2022

This gist contains custom yaml for homeassistant to replicate a portion of my Bambu X1C Dashboard. It supplies a picture entity for a single/first AMS unit, the X1C itself, basic printer speed controls + power control (requires a smart plug!), and basic print information. Not all sensors are represented here as I'm still working on how I best want those to look.

This requires a bunch of custom frontend code to be installed, as well as additional setup.

But if you don't feel like reading all these comments and also would enjoy the YAMLs for each segment separately, I have a new guide that can be found here: https://www.wolfwithsword.com/bambulab-home-assistant-dashboard/

image

  1. For print preview image, it is currently set to https://nodered.DOMAIN.com/get/media/X1C/preview.png. Change this to whatever you have for your nodered http server with the image from my NodeRed gist, or to the local file if you instead point that directory to the local media in homeassistant. If you do not want a print preview image during printing, simply remove that element

  2. This required a lot of frontend repos to be installed via HACS. I cannot remember all of them now but they definitely require card-mod, layout-card, custom hui elements, custom button card, mushroom cards, possibly config template config, and possibly custom-ui.

  3. This also requires custom SVG icons for the filament in the AMS if you want to replicate what I have. Currently I have them installed and setup as custom:filament-1. Please change this to something you have access to or it won't show up.

  4. Entity names will may or may not be different in your setup, either for smart plug switches or anything from node-red. When I was working on my NR flow, a lot of entity names are different due to me renaming them a lot, and HA didn't always pick up on renaming so, if something breaks try seeing if the entity names for a sensor are right or not.

@WolfwithSword
Copy link
Author

Also note: The dashboard I have this running in is in a grid-layout (layout-card), and this first entire panel is in a layout-card horizontal layout.

@WolfwithSword
Copy link
Author

WolfwithSword commented Dec 26, 2022

Forgot in the first comment, but here are the images as referenced by the code:

/local/media/AMS_2.png
AMS_2

/local/media/bambuprinter/*
Note: on_lighton.png and on_lightoff.png aren't actually used, that's leftover in my state_image code. Feel free to override them with one of the two other images.

  • off.png
    off

  • on_lighton_2.png
    on_lighton_2

For P1P

  • off_p1p.png
    off_p1p

  • on_p1p.png
    on_p1p

Both

  • spool.png
    spool

@alpine79
Copy link

alpine79 commented Jan 9, 2023

Thanks for sharing this! A couple things I wanted to share as I'm going through this.

-I can confirm that Config Template Card is required.
-Obviously the entiity names need to be updated based to add the printer name prefix, but it also looks like some of the entities were changed a bit after posting this (as you mentioned above in point #4). Lines 147-150 no longer use the id attribute from sensor.current_ams_filament_in_use, but rather just the state of sensor.ams_id
-the "_profile" part of the entity id should be dropped from lines 284, 300, 316, 332
-the "_details" part of the entity id should be dropped from line 343
-a "print" needs to be added to the entity id at line 360 so it becomes sensor.x1c_PRINTER_NAME_print_remaining_time

It looks like you created a custom icon for the filament, custom:filament-1 (ie first shows up at line 18). Would you be able to share it?

What did you do to create the buttons for the speed settings?

@WolfwithSword
Copy link
Author

@alpine79 This yaml was using my previous gist that used the HA Integration version of the nodered flow, I haven't updated it yet for the new nodered flow that doesn't use the HA integration. The old gist is outdated and not preferred anymore, so I'll update this one to reflect the new preferred gist, thanks for the reminder!

I'll update this later today. It should fix up most of those concerns.

For example, all the names will be appropriate. And for the speed setting buttons, in the new flow it's a select, but I still liked having buttons, so I made them call a service that sets the select. The new yaml will have this too :)

As for the custom icon, I made a few pulled from online sources, I believe the one I settled on is all good to use license wise and such but I had to modify it to the proper format. I can post that here too.

@WolfwithSword
Copy link
Author

WolfwithSword commented Jan 10, 2023

Rev 2: Updated to reflect the new nodered flow from https://gist.github.com/WolfwithSword/e3e4dc4f00629cc047b7cefd70d7b350

The following needs to be replaced with values as you need/want to configure:

  • {PRINTER_NAME} Name of the printer in lowercase as defined from the mqtt sensor/device name (without the X1C_ prefix)
  • {PREVIEW_URL} If you want to use image print previews using the FTP flow from the old nodered flow still, or have your own method, replace it here, otherwise remove this element.
  • This is also setup to use a switch for power controlling the printer. This can be removed if you don't have a smartplug/switch hooked up.

The custom icon I used for filaments is attached, goes into custom_icons folder, and requires the fontawesome hacs repo to be downloaded and setup so it can pull in custom svg's. Note: I didn't make the icon, just took a public one and edited it for HA.

filament-1

@alpine79 Hope this solves everything 😄

@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