initial commit
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
# ------------------------------------------------------------
|
||||
# BAMBU: Polly-Pocket (A1 Mini)
|
||||
# ------------------------------------------------------------
|
||||
- alias: "Print Log - Polly-Pocket - Start"
|
||||
id: print_log_polly_pocket_start
|
||||
description: "Creates Notion entry when Polly-Pocket begins printing"
|
||||
mode: single
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.a1mini_0309ca580403653_print_status
|
||||
to: "running"
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ trigger.from_state.state != 'running' }}"
|
||||
- condition: template
|
||||
value_template: "{{ states('input_text.notion_page_id_polly_pocket') | length < 10 }}"
|
||||
action:
|
||||
- delay: "00:00:05"
|
||||
- action: rest_command.notion_create_print
|
||||
data:
|
||||
file_name: "{{ states('sensor.a1mini_0309ca580403653_gcode_filename') }}"
|
||||
printer_name: "Polly-Pocket"
|
||||
filament_type: "{{ state_attr('sensor.a1mini_0309ca580403653_active_tray', 'type') | default('Unknown') }}"
|
||||
filament_color: "{{ state_attr('sensor.a1mini_0309ca580403653_active_tray', 'color') | default('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_polly_pocket
|
||||
data:
|
||||
value: "{{ notion_response.content.id | default('') }}"
|
||||
|
||||
- alias: "Print Log - Polly-Pocket - Finish"
|
||||
id: print_log_polly_pocket_finish
|
||||
description: "Updates Notion entry when Polly-Pocket finishes, fails, or is cancelled"
|
||||
mode: single
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: sensor.a1mini_0309ca580403653_print_status
|
||||
to: "finish"
|
||||
id: completed
|
||||
- platform: state
|
||||
entity_id: sensor.a1mini_0309ca580403653_print_status
|
||||
to: "failed"
|
||||
id: failed
|
||||
- platform: state
|
||||
entity_id: sensor.a1mini_0309ca580403653_print_status
|
||||
to: "cancelled"
|
||||
id: cancelled
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ states('input_text.notion_page_id_polly_pocket') | length > 10 }}"
|
||||
action:
|
||||
- delay: "00:00:05"
|
||||
- variables:
|
||||
page_id: "{{ states('input_text.notion_page_id_polly_pocket') }}"
|
||||
- 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
|
||||
{% elif trigger.id == 'failed' %}Failed
|
||||
{% else %}Cancelled{% endif %}
|
||||
weight: "{{ states('sensor.a1mini_0309ca580403653_print_weight') | float(0) }}"
|
||||
length: "{{ states('sensor.a1mini_0309ca580403653_print_length') | float(0) }}"
|
||||
completed: "{{ now().strftime('%Y-%m-%dT%H:%M:%S') }}"
|
||||
- action: input_text.set_value
|
||||
target:
|
||||
entity_id: input_text.notion_page_id_polly_pocket
|
||||
data:
|
||||
value: ""
|
||||
Reference in New Issue
Block a user