74 lines
2.4 KiB
YAML
74 lines
2.4 KiB
YAML
|
|
# ------------------------------------------------------------
|
||
|
|
# ELEGOO: Saturn (resin printer)
|
||
|
|
# Note: Uses current_status + file_name sensors (Elegoo integration)
|
||
|
|
# No weight, length, or filament data available
|
||
|
|
# Status values: "printing" / "complete" / "failed" — verify in Dev Tools
|
||
|
|
# ------------------------------------------------------------
|
||
|
|
- alias: "Print Log - Saturn - Start"
|
||
|
|
id: print_log_saturn_start
|
||
|
|
description: "Creates Notion entry when Saturn begins printing"
|
||
|
|
mode: single
|
||
|
|
trigger:
|
||
|
|
- platform: state
|
||
|
|
entity_id: sensor.saturn_iv_print_status
|
||
|
|
from:
|
||
|
|
- "idle"
|
||
|
|
- "stopped"
|
||
|
|
- "complete"
|
||
|
|
to: "printing"
|
||
|
|
condition:
|
||
|
|
- condition: template
|
||
|
|
value_template: "{{ states('input_text.notion_page_id_saturn') | length < 10 }}"
|
||
|
|
action:
|
||
|
|
- delay: "00:00:05"
|
||
|
|
- action: rest_command.notion_create_print
|
||
|
|
data:
|
||
|
|
file_name: "{{ states('sensor.saturn_file_name') }}"
|
||
|
|
printer_name: "Saturn"
|
||
|
|
filament_type: "Unknown"
|
||
|
|
filament_color: "Unknown"
|
||
|
|
started: "{{ now().strftime('%Y-%m-%dT%H:%M:%S') }}"
|
||
|
|
response_variable: notion_response
|
||
|
|
- action: input_text.set_value
|
||
|
|
target:
|
||
|
|
entity_id: input_text.notion_page_id_saturn
|
||
|
|
data:
|
||
|
|
value: "{{ notion_response.content.id | default('') }}"
|
||
|
|
|
||
|
|
- alias: "Print Log - Saturn - Finish"
|
||
|
|
id: print_log_saturn_finish
|
||
|
|
description: "Updates Notion entry when Saturn finishes or fails"
|
||
|
|
mode: single
|
||
|
|
trigger:
|
||
|
|
- platform: state
|
||
|
|
entity_id: sensor.saturn_iv_print_status
|
||
|
|
to: "complete"
|
||
|
|
id: completed
|
||
|
|
- platform: state
|
||
|
|
entity_id: sensor.saturn_iv_print_status
|
||
|
|
to: "failed"
|
||
|
|
id: failed
|
||
|
|
condition:
|
||
|
|
- condition: template
|
||
|
|
value_template: "{{ states('input_text.notion_page_id_saturn') | length > 10 }}"
|
||
|
|
action:
|
||
|
|
- delay: "00:00:05"
|
||
|
|
- variables:
|
||
|
|
page_id: "{{ states('input_text.notion_page_id_saturn') }}"
|
||
|
|
- condition: template
|
||
|
|
value_template: "{{ page_id | length > 10 }}"
|
||
|
|
- action: rest_command.notion_update_print
|
||
|
|
data:
|
||
|
|
page_id: "{{ page_id }}"
|
||
|
|
status: >
|
||
|
|
{% if trigger.id == 'completed' %}Completed
|
||
|
|
{% else %}Failed{% endif %}
|
||
|
|
weight: 0
|
||
|
|
length: 0
|
||
|
|
completed: "{{ now().strftime('%Y-%m-%dT%H:%M:%S') }}"
|
||
|
|
- action: input_text.set_value
|
||
|
|
target:
|
||
|
|
entity_id: input_text.notion_page_id_saturn
|
||
|
|
data:
|
||
|
|
value: ""
|