diff --git a/.ha_mcp/backups/automation.automation.3d_print_complete_snapshot.20261003_151703.yaml b/.ha_mcp/backups/automation.automation.3d_print_complete_snapshot.20261003_151703.yaml new file mode 100644 index 00000000..89fdeb3c --- /dev/null +++ b/.ha_mcp/backups/automation.automation.3d_print_complete_snapshot.20261003_151703.yaml @@ -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 diff --git a/.ha_mcp/logs/mcp_usage.jsonl b/.ha_mcp/logs/mcp_usage.jsonl index 9d127d52..d7d7bca1 100644 --- a/.ha_mcp/logs/mcp_usage.jsonl +++ b/.ha_mcp/logs/mcp_usage.jsonl @@ -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: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: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} diff --git a/automations.yaml b/automations.yaml index a37398fe..70f66672 100644 --- a/automations.yaml +++ b/automations.yaml @@ -3525,11 +3525,6 @@ %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'') }}' @@ -3551,6 +3546,11 @@ entity_id: light.bedroom_lamp_2 - delay: seconds: 3 + - action: camera.snapshot + data: + filename: /config/www/sparkx_i7_complete_snapshot.jpg + target: + entity_id: camera.sparkx_i7_printer_camera - delay: seconds: 2 - if: