Files
ha-elegoo-spaghetti-detection/examples/actionable_notification.yaml
T
2026-05-03 23:47:54 +03:00

78 lines
2.3 KiB
YAML

alias: Elegoo Spaghetti - Actionable Notification
mode: single
triggers:
- trigger: event
event_type: elegoo_spaghetti_detection_detected
event_data:
detector: elegoo_spaghetti_detection
id: detected
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: ELEGOO_SPAGHETTI_PAUSE_PRINT
id: pause_action
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: ELEGOO_SPAGHETTI_STOP_PRINT
id: stop_action
- trigger: event
event_type: mobile_app_notification_action
event_data:
action: ELEGOO_SPAGHETTI_RESUME_PRINT
id: resume_action
variables:
notify_service: notify.mobile_app_your_phone
pause_button: button.elegoo_centauri_carbon2_pause_print
resume_button: button.elegoo_centauri_carbon2_resume_print
stop_button: button.elegoo_centauri_carbon2_stop_print
actions:
- choose:
- conditions:
- condition: trigger
id: detected
sequence:
- action: "{{ notify_service }}"
data:
title: "Possible print failure"
message: >
Confidence:
{{ (trigger.event.data.confidence | float(0) * 100) | round(1) }}%.
Detections: {{ trigger.event.data.detections }}.
data:
image: "{{ trigger.event.data.image_url }}"
actions:
- action: ELEGOO_SPAGHETTI_PAUSE_PRINT
title: Pause print
- action: ELEGOO_SPAGHETTI_STOP_PRINT
title: Stop print
- action: ELEGOO_SPAGHETTI_RESUME_PRINT
title: Resume print
- conditions:
- condition: trigger
id: pause_action
sequence:
- action: button.press
target:
entity_id: "{{ pause_button }}"
- conditions:
- condition: trigger
id: stop_action
sequence:
- action: button.press
target:
entity_id: "{{ stop_button }}"
- conditions:
- condition: trigger
id: resume_action
sequence:
- action: button.press
target:
entity_id: "{{ resume_button }}"