This commit is contained in:
Home Assistant Version Control
2026-10-16 20:29:58 +00:00
parent 6cfbc9a91e
commit 1481e2c87e
3 changed files with 742 additions and 24 deletions
+236 -24
View File
@@ -28,47 +28,259 @@
},
"cards": [
{
"type": "custom:mushroom-template-card",
"type": "button-card",
"entity": "sensor.sparkx_i7_cfs_box_1_slot_1_color",
"name": "",
"icon": "none",
"primary": "{% if states('sensor.sparkx_i7_print_status') in ['printing', 'paused'] %}{% set gcm = states('input_number.sparkx_i7_filament_g_cm') | float(0.0298) %}{% set cur = states('sensor.sparkx_i7_used_material_length') | float(0) %}{% set ck = states('input_number.sparkx_i7_spoolman_length_checkpoint') | float(0) %}{% set booked = states('input_number.sparkx_i7_slot_1_grams') | float(0) %}{% set live = booked + ((([cur - ck, 0] | max) * gcm) if states('sensor.sparkx_i7_active_filament_slot') == 'box_1_slot_1' else 0) %}{{ live | round(1) }}g{% else %}{{ (states('input_number.sparkx_i7_slot_1_grams') | float(0)) | round(1) }}g{% endif %}",
"secondary": "",
"card_mod": {
"style": "ha-card { text-align: left; padding: 0 4px; font-size: 12px; line-height: 1.2; } .mushroom-state { text-align: left; }"
"show_icon": false,
"show_state": false,
"show_name": false,
"custom_fields": {
"value": "{% if states('sensor.sparkx_i7_print_status') in ['printing', 'paused'] %}{% set gcm = states('input_number.sparkx_i7_filament_g_cm') | float(0.0298) %}{% set cur = states('sensor.sparkx_i7_used_material_length') | float(0) %}{% set ck = states('input_number.sparkx_i7_spoolman_length_checkpoint') | float(0) %}{% set booked = states('input_number.sparkx_i7_slot_1_grams') | float(0) %}{% set live = booked + ((([cur - ck, 0] | max) * gcm) if states('sensor.sparkx_i7_active_filament_slot') == 'box_1_slot_1' else 0) %}{{ live | round(1) }}g{% else %}{{ (states('input_number.sparkx_i7_slot_1_grams') | float(0)) | round(1) }}g{% endif %}"
},
"styles": {
"card": [
{
"background": "transparent"
},
{
"box-shadow": "none"
},
{
"border": "none"
},
{
"padding": "0 2px"
},
{
"text-align": "left"
},
{
"justify-content": "flex-start"
},
{
"align-items": "flex-start"
}
],
"custom_fields": {
"value": [
{
"text-align": "left"
},
{
"font-size": "11px"
},
{
"line-height": "1.1"
},
{
"padding": "0"
},
{
"margin": "0"
},
{
"justify-content": "flex-start"
},
{
"display": "flex"
}
]
}
},
"tap_action": {
"action": "none"
}
},
{
"type": "custom:mushroom-template-card",
"type": "button-card",
"entity": "sensor.sparkx_i7_cfs_box_1_slot_2_color",
"name": "",
"icon": "none",
"primary": "{% if states('sensor.sparkx_i7_print_status') in ['printing', 'paused'] %}{% set gcm = states('input_number.sparkx_i7_filament_g_cm') | float(0.0298) %}{% set cur = states('sensor.sparkx_i7_used_material_length') | float(0) %}{% set ck = states('input_number.sparkx_i7_spoolman_length_checkpoint') | float(0) %}{% set booked = states('input_number.sparkx_i7_slot_2_grams') | float(0) %}{% set live = booked + ((([cur - ck, 0] | max) * gcm) if states('sensor.sparkx_i7_active_filament_slot') == 'box_1_slot_2' else 0) %}{{ live | round(1) }}g{% else %}{{ (states('input_number.sparkx_i7_slot_2_grams') | float(0)) | round(1) }}g{% endif %}",
"secondary": "",
"card_mod": {
"style": "ha-card { text-align: left; padding: 0 4px; font-size: 12px; line-height: 1.2; } .mushroom-state { text-align: left; }"
"show_icon": false,
"show_state": false,
"show_name": false,
"custom_fields": {
"value": "{% if states('sensor.sparkx_i7_print_status') in ['printing', 'paused'] %}{% set gcm = states('input_number.sparkx_i7_filament_g_cm') | float(0.0298) %}{% set cur = states('sensor.sparkx_i7_used_material_length') | float(0) %}{% set ck = states('input_number.sparkx_i7_spoolman_length_checkpoint') | float(0) %}{% set booked = states('input_number.sparkx_i7_slot_2_grams') | float(0) %}{% set live = booked + ((([cur - ck, 0] | max) * gcm) if states('sensor.sparkx_i7_active_filament_slot') == 'box_1_slot_2' else 0) %}{{ live | round(1) }}g{% else %}{{ (states('input_number.sparkx_i7_slot_2_grams') | float(0)) | round(1) }}g{% endif %}"
},
"styles": {
"card": [
{
"background": "transparent"
},
{
"box-shadow": "none"
},
{
"border": "none"
},
{
"padding": "0 2px"
},
{
"text-align": "left"
},
{
"justify-content": "flex-start"
},
{
"align-items": "flex-start"
}
],
"custom_fields": {
"value": [
{
"text-align": "left"
},
{
"font-size": "11px"
},
{
"line-height": "1.1"
},
{
"padding": "0"
},
{
"margin": "0"
},
{
"justify-content": "flex-start"
},
{
"display": "flex"
}
]
}
},
"tap_action": {
"action": "none"
}
},
{
"type": "custom:mushroom-template-card",
"type": "button-card",
"entity": "sensor.sparkx_i7_cfs_box_1_slot_3_color",
"name": "",
"icon": "none",
"primary": "{% if states('sensor.sparkx_i7_print_status') in ['printing', 'paused'] %}{% set gcm = states('input_number.sparkx_i7_filament_g_cm') | float(0.0298) %}{% set cur = states('sensor.sparkx_i7_used_material_length') | float(0) %}{% set ck = states('input_number.sparkx_i7_spoolman_length_checkpoint') | float(0) %}{% set booked = states('input_number.sparkx_i7_slot_3_grams') | float(0) %}{% set live = booked + ((([cur - ck, 0] | max) * gcm) if states('sensor.sparkx_i7_active_filament_slot') == 'box_1_slot_3' else 0) %}{{ live | round(1) }}g{% else %}{{ (states('input_number.sparkx_i7_slot_3_grams') | float(0)) | round(1) }}g{% endif %}",
"secondary": "",
"card_mod": {
"style": "ha-card { text-align: left; padding: 0 4px; font-size: 12px; line-height: 1.2; } .mushroom-state { text-align: left; }"
"show_icon": false,
"show_state": false,
"show_name": false,
"custom_fields": {
"value": "{% if states('sensor.sparkx_i7_print_status') in ['printing', 'paused'] %}{% set gcm = states('input_number.sparkx_i7_filament_g_cm') | float(0.0298) %}{% set cur = states('sensor.sparkx_i7_used_material_length') | float(0) %}{% set ck = states('input_number.sparkx_i7_spoolman_length_checkpoint') | float(0) %}{% set booked = states('input_number.sparkx_i7_slot_3_grams') | float(0) %}{% set live = booked + ((([cur - ck, 0] | max) * gcm) if states('sensor.sparkx_i7_active_filament_slot') == 'box_1_slot_3' else 0) %}{{ live | round(1) }}g{% else %}{{ (states('input_number.sparkx_i7_slot_3_grams') | float(0)) | round(1) }}g{% endif %}"
},
"styles": {
"card": [
{
"background": "transparent"
},
{
"box-shadow": "none"
},
{
"border": "none"
},
{
"padding": "0 2px"
},
{
"text-align": "left"
},
{
"justify-content": "flex-start"
},
{
"align-items": "flex-start"
}
],
"custom_fields": {
"value": [
{
"text-align": "left"
},
{
"font-size": "11px"
},
{
"line-height": "1.1"
},
{
"padding": "0"
},
{
"margin": "0"
},
{
"justify-content": "flex-start"
},
{
"display": "flex"
}
]
}
},
"tap_action": {
"action": "none"
}
},
{
"type": "custom:mushroom-template-card",
"type": "button-card",
"entity": "sensor.sparkx_i7_cfs_box_1_slot_4_color",
"name": "",
"icon": "none",
"primary": "{% if states('sensor.sparkx_i7_print_status') in ['printing', 'paused'] %}{% set gcm = states('input_number.sparkx_i7_filament_g_cm') | float(0.0298) %}{% set cur = states('sensor.sparkx_i7_used_material_length') | float(0) %}{% set ck = states('input_number.sparkx_i7_spoolman_length_checkpoint') | float(0) %}{% set booked = states('input_number.sparkx_i7_slot_4_grams') | float(0) %}{% set live = booked + ((([cur - ck, 0] | max) * gcm) if states('sensor.sparkx_i7_active_filament_slot') == 'box_1_slot_4' else 0) %}{{ live | round(1) }}g{% else %}{{ (states('input_number.sparkx_i7_slot_4_grams') | float(0)) | round(1) }}g{% endif %}",
"secondary": "",
"card_mod": {
"style": "ha-card { text-align: left; padding: 0 4px; font-size: 12px; line-height: 1.2; } .mushroom-state { text-align: left; }"
"show_icon": false,
"show_state": false,
"show_name": false,
"custom_fields": {
"value": "{% if states('sensor.sparkx_i7_print_status') in ['printing', 'paused'] %}{% set gcm = states('input_number.sparkx_i7_filament_g_cm') | float(0.0298) %}{% set cur = states('sensor.sparkx_i7_used_material_length') | float(0) %}{% set ck = states('input_number.sparkx_i7_spoolman_length_checkpoint') | float(0) %}{% set booked = states('input_number.sparkx_i7_slot_4_grams') | float(0) %}{% set live = booked + ((([cur - ck, 0] | max) * gcm) if states('sensor.sparkx_i7_active_filament_slot') == 'box_1_slot_4' else 0) %}{{ live | round(1) }}g{% else %}{{ (states('input_number.sparkx_i7_slot_4_grams') | float(0)) | round(1) }}g{% endif %}"
},
"styles": {
"card": [
{
"background": "transparent"
},
{
"box-shadow": "none"
},
{
"border": "none"
},
{
"padding": "0 2px"
},
{
"text-align": "left"
},
{
"justify-content": "flex-start"
},
{
"align-items": "flex-start"
}
],
"custom_fields": {
"value": [
{
"text-align": "left"
},
{
"font-size": "11px"
},
{
"line-height": "1.1"
},
{
"padding": "0"
},
{
"margin": "0"
},
{
"justify-content": "flex-start"
},
{
"display": "flex"
}
]
}
},
"tap_action": {
"action": "none"
}
}
]