automations.yaml
This commit is contained in:
1 parent
466c217bc5
commit
bbeacf4d1c
1 file changed
+35
-102
+35
-102
@@ -3547,132 +3547,65 @@
|
|||||||
mode: single
|
mode: single
|
||||||
- id: '1787462157568'
|
- id: '1787462157568'
|
||||||
alias: 3D Print Early Layers Snapshot
|
alias: 3D Print Early Layers Snapshot
|
||||||
description: Sends a webcam snapshot once per print when Z crosses 1.0 mm while
|
description: Sends a SparkX i7 camera snapshot once per print when Z crosses 1.0
|
||||||
printing, approximating layers 4-5 at typical 0.2-0.28 mm layer heights.
|
mm while printing.
|
||||||
triggers:
|
triggers:
|
||||||
- above: 1
|
- above: 1
|
||||||
entity_id: sensor.octoprint_current_z
|
entity_id: sensor.sparkx_i7_position_z
|
||||||
trigger: numeric_state
|
trigger: numeric_state
|
||||||
conditions:
|
conditions:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: binary_sensor.octoprint_printing
|
entity_id: sensor.sparkx_i7_print_status
|
||||||
state: 'on'
|
state: printing
|
||||||
actions:
|
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
|
- action: camera.snapshot
|
||||||
target:
|
|
||||||
entity_id: camera.endercamera_duckdns_org
|
|
||||||
data:
|
data:
|
||||||
filename: /config/www/octoprint_snapshot.jpg
|
filename: /config/www/sparkx_i7_early_snapshot.jpg
|
||||||
|
target:
|
||||||
|
entity_id: camera.sparkx_i7_printer_camera
|
||||||
- parallel:
|
- parallel:
|
||||||
- action: notify.mobile_app_sm_f956w
|
- action: notify.mobile_app_sm_f956w
|
||||||
data:
|
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:
|
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
|
- action: notify.mobile_app_motorola_one_vision
|
||||||
data:
|
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:
|
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
|
- action: notify.mobile_app_francos_ipad
|
||||||
data:
|
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:
|
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
|
- action: notify.mobile_app_sm_t387w
|
||||||
data:
|
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:
|
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
|
- action: telegram_bot.send_photo
|
||||||
data:
|
data:
|
||||||
|
caption: '{{ early_message }}'
|
||||||
entity_id: notify.franco
|
entity_id: notify.franco
|
||||||
file: /config/www/octoprint_snapshot.jpg
|
file: /config/www/sparkx_i7_early_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 }}'
|
|
||||||
parse_mode: plain_text
|
parse_mode: plain_text
|
||||||
mode: single
|
mode: single
|
||||||
- id: '1787530101996'
|
- id: '1787530101996'
|
||||||
|
|||||||
Reference in new issue
Block a user