automations.yaml

This commit is contained in:
Home Assistant Version Control
2026-09-24 15:27:47 +00:00
parent 466c217bc5
commit bbeacf4d1c
+35 -102
View File
@@ -3547,132 +3547,65 @@
mode: single
- id: '1787462157568'
alias: 3D Print Early Layers Snapshot
description: Sends a webcam snapshot once per print when Z crosses 1.0 mm while
printing, approximating layers 4-5 at typical 0.2-0.28 mm layer heights.
description: Sends a SparkX i7 camera snapshot once per print when Z crosses 1.0
mm while printing.
triggers:
- above: 1
entity_id: sensor.octoprint_current_z
entity_id: sensor.sparkx_i7_position_z
trigger: numeric_state
conditions:
- condition: state
entity_id: binary_sensor.octoprint_printing
state: 'on'
entity_id: sensor.sparkx_i7_print_status
state: printing
actions:
- variables:
early_message: '{% set f = state_attr(''sensor.sparkx_i7_print_status'', ''file'')
or '''' %} {% set file = ''No file'' if f in ['''', none, ''unknown'', ''unavailable'']
else f.split(''/'')[-1].replace(''.gcode'', '''') %} {% set pct = states(''sensor.sparkx_i7_print_progress'')
| int(0) %} {% set elapsed = states(''sensor.sparkx_i7_print_job_time'') |
int(0) %} {% set remaining = states(''sensor.sparkx_i7_print_time_left'')
| int(0) %} {% set finish = (now() + timedelta(seconds=remaining)).strftime(''%I:%M
%p'').lstrip(''0'') if remaining > 0 else ''unknown'' %} {{ file }} Progress:
{{ pct }}% · Elapsed: {% if elapsed >= 3600 %}{{ elapsed // 3600 }}h {{ ((elapsed
% 3600) // 60) }}m{% else %}{{ ((elapsed % 3600) // 60) }}m{% endif %} · Left:
{% if remaining > 0 %}{% if remaining >= 3600 %}{{ remaining // 3600 }}h {{
((remaining % 3600) // 60) }}m{% else %}{{ ((remaining % 3600) // 60) }}m{%
endif %}{% else %}unknown{% endif %} Est. finish: {{ finish }}'
- action: camera.snapshot
target:
entity_id: camera.endercamera_duckdns_org
data:
filename: /config/www/octoprint_snapshot.jpg
filename: /config/www/sparkx_i7_early_snapshot.jpg
target:
entity_id: camera.sparkx_i7_printer_camera
- parallel:
- action: notify.mobile_app_sm_f956w
data:
title: 3D print early check
message: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file
= ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'',
'''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0)
| int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{%
set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'')
| as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h
{{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif
-%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M
%p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M
%p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %}
{{ file }}
Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts >
0 else ''unknown'' }}
Est. finish: {{ fin }}'
data:
image: /local/octoprint_snapshot.jpg
image: /local/sparkx_i7_early_snapshot.jpg
message: '{{ early_message }}'
title: 3D print early check
- action: notify.mobile_app_motorola_one_vision
data:
title: 3D print early check
message: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file
= ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'',
'''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0)
| int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{%
set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'')
| as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h
{{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif
-%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M
%p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M
%p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %}
{{ file }}
Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts >
0 else ''unknown'' }}
Est. finish: {{ fin }}'
data:
image: /local/octoprint_snapshot.jpg
image: /local/sparkx_i7_early_snapshot.jpg
message: '{{ early_message }}'
title: 3D print early check
- action: notify.mobile_app_francos_ipad
data:
title: 3D print early check
message: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file
= ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'',
'''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0)
| int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{%
set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'')
| as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h
{{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif
-%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M
%p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M
%p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %}
{{ file }}
Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts >
0 else ''unknown'' }}
Est. finish: {{ fin }}'
data:
image: /local/octoprint_snapshot.jpg
image: /local/sparkx_i7_early_snapshot.jpg
message: '{{ early_message }}'
title: 3D print early check
- action: notify.mobile_app_sm_t387w
data:
title: 3D print early check
message: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file
= ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'',
'''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0)
| int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{%
set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'')
| as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h
{{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif
-%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M
%p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M
%p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %}
{{ file }}
Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts >
0 else ''unknown'' }}
Est. finish: {{ fin }}'
data:
image: /local/octoprint_snapshot.jpg
image: /local/sparkx_i7_early_snapshot.jpg
message: '{{ early_message }}'
title: 3D print early check
- action: telegram_bot.send_photo
data:
caption: '{{ early_message }}'
entity_id: notify.franco
file: /config/www/octoprint_snapshot.jpg
caption: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file
= ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'',
'''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0)
| int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{%
set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'')
| as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h
{{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif
-%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M
%p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M
%p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %}
{{ file }}
Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts >
0 else ''unknown'' }}
Est. finish: {{ fin }}'
file: /config/www/sparkx_i7_early_snapshot.jpg
parse_mode: plain_text
mode: single
- id: '1787530101996'