This commit is contained in:
Home Assistant Version Control
2026-10-12 01:05:06 +00:00
parent c6b93676ed
commit 3eb9411a32
4 changed files with 213 additions and 40 deletions
+46 -27
View File
@@ -4397,13 +4397,28 @@
entity_id: sensor.sparkx_i7_print_status
from: printing
to: completed
conditions: []
id: complete
- trigger: state
entity_id: sensor.sparkx_i7_print_status
to: stopped
id: stopped
- trigger: state
entity_id: sensor.sparkx_i7_print_status
to: error
id: error
conditions:
- condition: template
value_template: '{{ trigger.id == ''complete'' or states(''input_text.sparkx_i7_print_spool_latch'')
not in ['''', ''unknown'', ''unavailable''] }}'
actions:
- variables:
old_slot: '{{ states(''input_text.sparkx_i7_print_spool_latch'') }}'
cur: '{{ states(''sensor.sparkx_i7_used_material_length'') | float(0) }}'
checkpoint: '{{ states(''input_number.sparkx_i7_spoolman_length_checkpoint'')
| float(0) }}'
outcome: '{% set tid = trigger.id | default(''complete'') %}{{ ''cancelled''
if tid == ''stopped'' else (''error'' if tid == ''error'' else ''complete'')
}}'
- variables:
final_grams: '{{ (([cur | float - (checkpoint | float), 0] | max) * (states(''input_number.sparkx_i7_filament_g_cm'')
| float(0.03))) | round(2) }}'
@@ -4450,25 +4465,25 @@
- action: notify.persistent_notification
data:
title: 'Spoolman: no spool for slot color'
message: 'Print completed: final segment of {{ final_grams }} g from {{
old_slot if old_slot else ''the active slot'' }} (color #{{ color | upper
}}) could not be deducted - no Spoolman spool in the CFS Lite location
message: 'Print {{ outcome }}: final segment of {{ final_grams }} g from
{{ old_slot if old_slot else ''the active slot'' }} (color #{{ color |
upper }}) could not be deducted - no Spoolman spool in the CFS Lite location
with remaining weight matches that color. Register the new roll in Spoolman
with location CFS Lite, then adjust manually if needed.'
- action: notify.mobile_app_francos_ipad
data:
title: 'Spoolman: no spool for slot color'
message: 'Print completed: final segment of {{ final_grams }} g from {{
old_slot if old_slot else ''the active slot'' }} (color #{{ color | upper
}}) could not be deducted - no Spoolman spool in the CFS Lite location
message: 'Print {{ outcome }}: final segment of {{ final_grams }} g from
{{ old_slot if old_slot else ''the active slot'' }} (color #{{ color |
upper }}) could not be deducted - no Spoolman spool in the CFS Lite location
with remaining weight matches that color. Register the new roll in Spoolman
with location CFS Lite, then adjust manually if needed.'
- action: notify.mobile_app_sm_f956w
data:
title: 'Spoolman: no spool for slot color'
message: 'Print completed: final segment of {{ final_grams }} g from {{
old_slot if old_slot else ''the active slot'' }} (color #{{ color | upper
}}) could not be deducted - no Spoolman spool in the CFS Lite location
message: 'Print {{ outcome }}: final segment of {{ final_grams }} g from
{{ old_slot if old_slot else ''the active slot'' }} (color #{{ color |
upper }}) could not be deducted - no Spoolman spool in the CFS Lite location
with remaining weight matches that color. Register the new roll in Spoolman
with location CFS Lite, then adjust manually if needed.'
- variables:
@@ -4491,33 +4506,37 @@
then:
- action: notify.persistent_notification
data:
title: Print complete - Spoolman updated
message: 'Print complete - Spoolman deducted {{ summary_total }} g
title: Print {{ outcome }} - Spoolman updated
message: 'Print {{ outcome }} - Spoolman deducted {{ summary_total }} g
{{ summary_lines }}'
- action: notify.mobile_app_francos_ipad
data:
title: Print complete - Spoolman updated
message: 'Print complete - Spoolman deducted {{ summary_total }} g
title: Print {{ outcome }} - Spoolman updated
message: 'Print {{ outcome }} - Spoolman deducted {{ summary_total }} g
{{ summary_lines }}'
- action: notify.mobile_app_sm_f956w
data:
title: Print complete - Spoolman updated
message: 'Print complete - Spoolman deducted {{ summary_total }} g
title: Print {{ outcome }} - Spoolman updated
message: 'Print {{ outcome }} - Spoolman deducted {{ summary_total }} g
{{ summary_lines }}'
- action: input_number.set_value
target:
entity_id: input_number.sparkx_i7_last_job_filament_weight
data:
value: '{{ final_grams }}'
- action: input_number.set_value
target:
entity_id: input_number.sparkx_i7_last_job_cost
data:
value: '{{ ((final_grams | float) * (states(''input_number.filament_price_per_kg'')
| float(25)) / 1000) | round(2) }}'
- if:
condition: template
value_template: '{{ trigger.id == ''complete'' }}'
then:
- action: input_number.set_value
target:
entity_id: input_number.sparkx_i7_last_job_filament_weight
data:
value: '{{ final_grams }}'
- action: input_number.set_value
target:
entity_id: input_number.sparkx_i7_last_job_cost
data:
value: '{{ ((final_grams | float) * (states(''input_number.filament_price_per_kg'')
| float(25)) / 1000) | round(2) }}'
- action: input_number.set_value
target:
entity_id: input_number.sparkx_i7_spoolman_length_checkpoint