3 files
This commit is contained in:
@@ -0,0 +1,78 @@
|
|||||||
|
# ha_mcp_backup
|
||||||
|
schema_version: 1
|
||||||
|
domain: automation
|
||||||
|
entity_id: automation.3d_print_complete_snapshot
|
||||||
|
captured: '2026-10-03T15:17:03.603772+00:00'
|
||||||
|
tool: ha_config_set_automation
|
||||||
|
config:
|
||||||
|
id: '1787462132503'
|
||||||
|
alias: 3D Print Complete Snapshot - Telegram
|
||||||
|
description: Sends a Telegram photo with a SparkX i7 camera snapshot when a print
|
||||||
|
finishes successfully. Mobile completion notifications are handled by the Creality
|
||||||
|
integration.
|
||||||
|
triggers:
|
||||||
|
- entity_id: sensor.sparkx_i7_print_status
|
||||||
|
from: printing
|
||||||
|
to: completed
|
||||||
|
trigger: state
|
||||||
|
actions:
|
||||||
|
- variables:
|
||||||
|
completion_message: '{% set file = trigger.to_state.attributes.get(''file'',
|
||||||
|
'''') %} {% set name = ''Print'' if file in ['''', none, ''unknown'', ''unavailable'']
|
||||||
|
else file.split(''/'')[-1].replace(''.gcode'', '''') %} {% set seconds = trigger.to_state.attributes.get(''job_time_s'',
|
||||||
|
0) | int(0) %} {{ name }} finished successfully at {{ now().strftime(''%I:%M
|
||||||
|
%p'').lstrip(''0'') }}. Total time: {% if seconds >= 3600 %}{{ seconds //
|
||||||
|
3600 }}h {{ ((seconds % 3600) // 60) }}m {% else %}{{ ((seconds % 3600) //
|
||||||
|
60) }}m{% endif %}'
|
||||||
|
- action: camera.snapshot
|
||||||
|
data:
|
||||||
|
filename: /config/www/sparkx_i7_complete_snapshot.jpg
|
||||||
|
target:
|
||||||
|
entity_id: camera.sparkx_i7_printer_camera
|
||||||
|
- variables:
|
||||||
|
sparkx_needs_light: '{{ not is_state(''light.sparkx_i7_light'', ''on'') }}'
|
||||||
|
bedroom_needs_light: '{{ not is_state(''light.bedroom_lamp_2'', ''on'') }}'
|
||||||
|
- if:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ sparkx_needs_light }}'
|
||||||
|
then:
|
||||||
|
- action: light.turn_on
|
||||||
|
continue_on_error: true
|
||||||
|
target:
|
||||||
|
entity_id: light.sparkx_i7_light
|
||||||
|
- if:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ bedroom_needs_light }}'
|
||||||
|
then:
|
||||||
|
- action: light.turn_on
|
||||||
|
continue_on_error: true
|
||||||
|
target:
|
||||||
|
entity_id: light.bedroom_lamp_2
|
||||||
|
- delay:
|
||||||
|
seconds: 3
|
||||||
|
- delay:
|
||||||
|
seconds: 2
|
||||||
|
- if:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ sparkx_needs_light }}'
|
||||||
|
then:
|
||||||
|
- action: light.turn_off
|
||||||
|
continue_on_error: true
|
||||||
|
target:
|
||||||
|
entity_id: light.sparkx_i7_light
|
||||||
|
- if:
|
||||||
|
- condition: template
|
||||||
|
value_template: '{{ bedroom_needs_light }}'
|
||||||
|
then:
|
||||||
|
- action: light.turn_off
|
||||||
|
continue_on_error: true
|
||||||
|
target:
|
||||||
|
entity_id: light.bedroom_lamp_2
|
||||||
|
- action: telegram_bot.send_photo
|
||||||
|
data:
|
||||||
|
caption: '{{ completion_message }}'
|
||||||
|
file: /config/www/sparkx_i7_complete_snapshot.jpg
|
||||||
|
parse_mode: plain_text
|
||||||
|
target:
|
||||||
|
entity_id: notify.franco
|
||||||
|
mode: single
|
||||||
@@ -3835,3 +3835,4 @@
|
|||||||
{"timestamp": "2026-10-03T15:12:38.440661+00:00", "tool_name": "ha_get_entity", "parameters": {"entity_id": ["camera.sparkx_i7_printer_camera", "camera.endercamera_duckdns_org", "camera.endercamera2_duckdns_org", "light.sparkx_i7_light", "light.bedroom_lamp_2"], "unique_id": null, "domain": null, "platform": null}, "execution_time_ms": 10.793209075927734, "success": true, "error_message": null, "response_size_bytes": 2923, "user_context": null}
|
{"timestamp": "2026-10-03T15:12:38.440661+00:00", "tool_name": "ha_get_entity", "parameters": {"entity_id": ["camera.sparkx_i7_printer_camera", "camera.endercamera_duckdns_org", "camera.endercamera2_duckdns_org", "light.sparkx_i7_light", "light.bedroom_lamp_2"], "unique_id": null, "domain": null, "platform": null}, "execution_time_ms": 10.793209075927734, "success": true, "error_message": null, "response_size_bytes": 2923, "user_context": null}
|
||||||
{"timestamp": "2026-10-03T15:16:23.999457+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": null, "identifier": "automation.3d_print_complete_snapshot", "python_transform": "config['actions'][2:2] = [{'variables': {'sparkx_needs_light': \"{{ not is_state('light.sparkx_i7_light', 'on') }}\", 'bedroom_needs_light': \"{{ not is_state('light.bedroom_lamp_2', 'on') }}\"}}, {'if': [{'condition': 'template', 'value_template': '{{ sparkx_needs_light }}'}], 'then': [{'action': 'light.turn_on', 'continue_on_error': True, 'target': {'entity_id': 'light.sparkx_i7_light'}}]}, {'if': [{'condition': 'template', 'value_template': '{{ bedroom_needs_light }}'}], 'then': [{'action': 'light.turn_on', 'continue_on_error': True, 'target': {'entity_id': 'light.bedroom_lamp_2'}}]}, {'delay': {'seconds': 3}}]; config['actions'][6:6] = [{'delay': {'seconds': 2}}, {'if': [{'condition': 'template', 'value_template': '{{ sparkx_needs_light }}'}], 'then': [{'action': 'light.turn_off', 'continue_on_error': True, 'target': {'entity_id': 'light.sparkx_i7_light'}}]}, {'if': [{'condition': 'template', 'value_template': '{{ bedroom_needs_light }}'}], 'then': [{'action': 'light.turn_off', 'continue_on_error': True, 'target': {'entity_id': 'light.bedroom_lamp_2'}}]}]", "config_hash": "c556c12c1113197d", "take_control_of_blueprint": false, "category": null, "wait": true, "enabled": null, "run_actions": false, "MandatoryBPS": true, "BestPracticeKey": null}, "execution_time_ms": 1338.163137435913, "success": true, "error_message": null, "response_size_bytes": 80044, "user_context": null}
|
{"timestamp": "2026-10-03T15:16:23.999457+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": null, "identifier": "automation.3d_print_complete_snapshot", "python_transform": "config['actions'][2:2] = [{'variables': {'sparkx_needs_light': \"{{ not is_state('light.sparkx_i7_light', 'on') }}\", 'bedroom_needs_light': \"{{ not is_state('light.bedroom_lamp_2', 'on') }}\"}}, {'if': [{'condition': 'template', 'value_template': '{{ sparkx_needs_light }}'}], 'then': [{'action': 'light.turn_on', 'continue_on_error': True, 'target': {'entity_id': 'light.sparkx_i7_light'}}]}, {'if': [{'condition': 'template', 'value_template': '{{ bedroom_needs_light }}'}], 'then': [{'action': 'light.turn_on', 'continue_on_error': True, 'target': {'entity_id': 'light.bedroom_lamp_2'}}]}, {'delay': {'seconds': 3}}]; config['actions'][6:6] = [{'delay': {'seconds': 2}}, {'if': [{'condition': 'template', 'value_template': '{{ sparkx_needs_light }}'}], 'then': [{'action': 'light.turn_off', 'continue_on_error': True, 'target': {'entity_id': 'light.sparkx_i7_light'}}]}, {'if': [{'condition': 'template', 'value_template': '{{ bedroom_needs_light }}'}], 'then': [{'action': 'light.turn_off', 'continue_on_error': True, 'target': {'entity_id': 'light.bedroom_lamp_2'}}]}]", "config_hash": "c556c12c1113197d", "take_control_of_blueprint": false, "category": null, "wait": true, "enabled": null, "run_actions": false, "MandatoryBPS": true, "BestPracticeKey": null}, "execution_time_ms": 1338.163137435913, "success": true, "error_message": null, "response_size_bytes": 80044, "user_context": null}
|
||||||
{"timestamp": "2026-10-03T15:16:46.076785+00:00", "tool_name": "ha_config_get_automation", "parameters": {"identifier": "automation.3d_print_complete_snapshot"}, "execution_time_ms": 1385.5891227722168, "success": true, "error_message": null, "response_size_bytes": 2466, "user_context": null}
|
{"timestamp": "2026-10-03T15:16:46.076785+00:00", "tool_name": "ha_config_get_automation", "parameters": {"identifier": "automation.3d_print_complete_snapshot"}, "execution_time_ms": 1385.5891227722168, "success": true, "error_message": null, "response_size_bytes": 2466, "user_context": null}
|
||||||
|
{"timestamp": "2026-10-03T15:17:09.505446+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": null, "identifier": "automation.3d_print_complete_snapshot", "python_transform": "config['actions'].insert(5, config['actions'].pop(1))", "config_hash": "99f339679fff3ffd", "take_control_of_blueprint": false, "category": null, "wait": true, "enabled": null, "run_actions": false, "MandatoryBPS": true, "BestPracticeKey": null}, "execution_time_ms": 5776.839017868042, "success": true, "error_message": null, "response_size_bytes": 78904, "user_context": null}
|
||||||
|
|||||||
+5
-5
@@ -3525,11 +3525,6 @@
|
|||||||
%p'').lstrip(''0'') }}. Total time: {% if seconds >= 3600 %}{{ seconds //
|
%p'').lstrip(''0'') }}. Total time: {% if seconds >= 3600 %}{{ seconds //
|
||||||
3600 }}h {{ ((seconds % 3600) // 60) }}m {% else %}{{ ((seconds % 3600) //
|
3600 }}h {{ ((seconds % 3600) // 60) }}m {% else %}{{ ((seconds % 3600) //
|
||||||
60) }}m{% endif %}'
|
60) }}m{% endif %}'
|
||||||
- action: camera.snapshot
|
|
||||||
data:
|
|
||||||
filename: /config/www/sparkx_i7_complete_snapshot.jpg
|
|
||||||
target:
|
|
||||||
entity_id: camera.sparkx_i7_printer_camera
|
|
||||||
- variables:
|
- variables:
|
||||||
sparkx_needs_light: '{{ not is_state(''light.sparkx_i7_light'', ''on'') }}'
|
sparkx_needs_light: '{{ not is_state(''light.sparkx_i7_light'', ''on'') }}'
|
||||||
bedroom_needs_light: '{{ not is_state(''light.bedroom_lamp_2'', ''on'') }}'
|
bedroom_needs_light: '{{ not is_state(''light.bedroom_lamp_2'', ''on'') }}'
|
||||||
@@ -3551,6 +3546,11 @@
|
|||||||
entity_id: light.bedroom_lamp_2
|
entity_id: light.bedroom_lamp_2
|
||||||
- delay:
|
- delay:
|
||||||
seconds: 3
|
seconds: 3
|
||||||
|
- action: camera.snapshot
|
||||||
|
data:
|
||||||
|
filename: /config/www/sparkx_i7_complete_snapshot.jpg
|
||||||
|
target:
|
||||||
|
entity_id: camera.sparkx_i7_printer_camera
|
||||||
- delay:
|
- delay:
|
||||||
seconds: 2
|
seconds: 2
|
||||||
- if:
|
- if:
|
||||||
|
|||||||
Reference in New Issue
Block a user