.ha_mcp/backups/automation.automation.3d_print_early_layers_snapshot.20261001_234705.yaml

This commit is contained in:
Home Assistant Version Control
2026-10-01 23:47:06 +00:00
parent 5c69d80700
commit 33ac9b7d5d
@@ -0,0 +1,126 @@
# ha_mcp_backup
schema_version: 1
domain: automation
entity_id: automation.3d_print_early_layers_snapshot
captured: '2026-10-01T23:47:05.577959+00:00'
tool: ha_config_set_automation
config:
id: '1787462157568'
alias: 3D Print Early Layers Snapshot
description: Telegram-only snapshots from all 3 printer cameras. Fires when Z crosses
1.0 mm, then again at 25%, 50% and 75% print progress. Lights the SparkX i7 and
bedroom lamp only if they are currently off, then restores whatever state they
were in before capturing.
triggers:
- above: 1
entity_id: sensor.sparkx_i7_position_z
trigger: numeric_state
- above: 25
entity_id: sensor.sparkx_i7_print_progress
trigger: numeric_state
- above: 50
entity_id: sensor.sparkx_i7_print_progress
trigger: numeric_state
- above: 75
entity_id: sensor.sparkx_i7_print_progress
trigger: numeric_state
conditions:
- condition: state
entity_id: sensor.sparkx_i7_print_status
state: printing
actions:
- variables:
milestone: '{% set source = trigger.get(''entity_id'', '''') %} {% set tstate
= trigger.get(''to_state'') %} {% set value = tstate.state | float(0) if tstate
else 0 %} {% if source == ''sensor.sparkx_i7_position_z'' %} First layers
(Z {{ value }} mm) {% elif source == ''sensor.sparkx_i7_print_progress'' %}
{% if value >= 75 %} 75% complete {% elif value >= 50 %} 50% complete {% else
%} 25% complete {% endif %} {% else %} Manual test {% endif %}'
tag: '{% set source = trigger.get(''entity_id'', '''') %} {% if source == ''sensor.sparkx_i7_position_z''
%} z1 {% elif source == ''sensor.sparkx_i7_print_progress'' %} p{{ trigger.get(''above'',
0) | int }} {% else %} test {% endif %}'
- variables:
bedroom_needs_light: '{{ not is_state(''light.bedroom_lamp_2'', ''on'') }}'
message: "{% set file = state_attr('sensor.sparkx_i7_print_status', 'file')\
\ or '' %} {% set name = 'Print' if file in ['', none, 'unknown', 'unavailable']\
\ else file.split('/')[-1].replace('.gcode', '') %} {% set pct = states('sensor.sparkx_i7_print_progress')\
\ | int(0) %} {% set left = states('sensor.sparkx_i7_print_time_left') | int(0)\
\ %} 3D print \xB7 {{ milestone }} \xB7 {{ name }} at {{ pct }}%{% if left\
\ > 0 %} \xB7 {{ (left // 3600) }}h {{ ((left % 3600) // 60) }}m left{% endif\
\ %}"
sparkx_needs_light: '{{ not is_state(''light.sparkx_i7_light'', ''on'') }}'
- if:
- condition: template
value_template: '{{ sparkx_needs_light }}'
then:
- action: light.turn_on
continue_on_error: true
target:
entity_id: light.sparkx_i7_light
- if:
- condition: template
value_template: '{{ bedroom_needs_light }}'
then:
- action: light.turn_on
continue_on_error: true
target:
entity_id: light.bedroom_lamp_2
- delay:
seconds: 3
- parallel:
- action: camera.snapshot
data:
filename: /config/www/sparkx_{{ tag }}.jpg
target:
entity_id: camera.sparkx_i7_printer_camera
- action: camera.snapshot
data:
filename: /config/www/ender5_{{ tag }}.jpg
target:
entity_id: camera.endercamera_duckdns_org
- action: camera.snapshot
data:
filename: /config/www/ender_cam2_{{ tag }}.jpg
target:
entity_id: camera.endercamera2_duckdns_org
- delay:
seconds: 2
- if:
- condition: template
value_template: '{{ sparkx_needs_light }}'
then:
- action: light.turn_off
continue_on_error: true
target:
entity_id: light.sparkx_i7_light
- if:
- condition: template
value_template: '{{ bedroom_needs_light }}'
then:
- action: light.turn_off
continue_on_error: true
target:
entity_id: light.bedroom_lamp_2
- action: telegram_bot.send_photo
data:
caption: "SparkX i7 \u2014 {{ message }}"
file: /config/www/sparkx_{{ tag }}.jpg
parse_mode: plain_text
target:
entity_id: notify.franco
- action: telegram_bot.send_photo
data:
caption: "Back Camera \u2014 {{ message }}"
file: /config/www/ender5_{{ tag }}.jpg
parse_mode: plain_text
target:
entity_id: notify.franco
- action: telegram_bot.send_photo
data:
caption: "Bed Camera \u2014 {{ message }}"
file: /config/www/ender_cam2_{{ tag }}.jpg
parse_mode: plain_text
target:
entity_id: notify.franco
max: 4
mode: parallel