diff --git a/.ha_mcp/backups/automation.automation.3d_print_early_layers_snapshot.20261001_234931.yaml b/.ha_mcp/backups/automation.automation.3d_print_early_layers_snapshot.20261001_234931.yaml new file mode 100644 index 00000000..84c472df --- /dev/null +++ b/.ha_mcp/backups/automation.automation.3d_print_early_layers_snapshot.20261001_234931.yaml @@ -0,0 +1,122 @@ +# ha_mcp_backup +schema_version: 1 +domain: automation +entity_id: automation.3d_print_early_layers_snapshot +captured: '2026-10-01T23:49:31.000350+00:00' +tool: ha_config_set_automation +config: + id: '1787462157568' + alias: 3D Print Early Layers Snapshot + description: Telegram-only snapshots from all 3 printer cameras. Fires when Z crosses + 1.0 mm, then again at 25%, 50% and 75% print progress. Lights the SparkX i7 and + bedroom lamp only if they are currently off, then restores whatever state they + were in before capturing. + triggers: + - above: 5 + entity_id: sensor.sparkx_i7_print_progress + trigger: numeric_state + - above: 25 + entity_id: sensor.sparkx_i7_print_progress + trigger: numeric_state + - above: 50 + entity_id: sensor.sparkx_i7_print_progress + trigger: numeric_state + - above: 75 + entity_id: sensor.sparkx_i7_print_progress + trigger: numeric_state + conditions: + - condition: state + entity_id: sensor.sparkx_i7_print_status + state: printing + actions: + - variables: + milestone: '{% set above = trigger.get(''above'', 0) | int(0) %}{% if above + >= 75 %} 75% complete{% elif above >= 50 %} 50% complete{% elif above >= 25 + %} 25% complete{% elif above >= 5 %} 5% complete{% else %} Print progress + {{ above }}%{% endif %}' + tag: p{{ trigger.get('above', 0) | int(0) }} + - variables: + bedroom_needs_light: '{{ not is_state(''light.bedroom_lamp_2'', ''on'') }}' + message: "{% set file = state_attr('sensor.sparkx_i7_print_status', 'file')\ + \ or '' %} {% set name = 'Print' if file in ['', none, 'unknown', 'unavailable']\ + \ else file.split('/')[-1].replace('.gcode', '') %} {% set pct = states('sensor.sparkx_i7_print_progress')\ + \ | int(0) %} {% set left = states('sensor.sparkx_i7_print_time_left') | int(0)\ + \ %} 3D print \xB7 {{ milestone }} \xB7 {{ name }} at {{ pct }}%{% if left\ + \ > 0 %} \xB7 {{ (left // 3600) }}h {{ ((left % 3600) // 60) }}m left{% endif\ + \ %}" + sparkx_needs_light: '{{ not is_state(''light.sparkx_i7_light'', ''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 + - parallel: + - action: camera.snapshot + data: + filename: /config/www/sparkx_{{ tag }}.jpg + target: + entity_id: camera.sparkx_i7_printer_camera + - action: camera.snapshot + data: + filename: /config/www/ender5_{{ tag }}.jpg + target: + entity_id: camera.endercamera_duckdns_org + - action: camera.snapshot + data: + filename: /config/www/ender_cam2_{{ tag }}.jpg + target: + entity_id: camera.endercamera2_duckdns_org + - 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: "SparkX i7 \u2014 {{ message }}" + file: /config/www/sparkx_{{ tag }}.jpg + parse_mode: plain_text + target: + entity_id: notify.franco + - action: telegram_bot.send_photo + data: + caption: "Back Camera \u2014 {{ message }}" + file: /config/www/ender5_{{ tag }}.jpg + parse_mode: plain_text + target: + entity_id: notify.franco + - action: telegram_bot.send_photo + data: + caption: "Bed Camera \u2014 {{ message }}" + file: /config/www/ender_cam2_{{ tag }}.jpg + parse_mode: plain_text + target: + entity_id: notify.franco + max: 4 + mode: parallel diff --git a/.ha_mcp/logs/mcp_usage.jsonl b/.ha_mcp/logs/mcp_usage.jsonl index e26e9e48..9e501b10 100644 --- a/.ha_mcp/logs/mcp_usage.jsonl +++ b/.ha_mcp/logs/mcp_usage.jsonl @@ -3810,3 +3810,4 @@ {"timestamp": "2026-10-01T23:47:07.102911+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": null, "identifier": "automation.3d_print_early_layers_snapshot", "python_transform": "config['triggers'] = [\n {'above': 5, 'entity_id': 'sensor.sparkx_i7_print_progress', 'trigger': 'numeric_state'},\n {'above': 25, 'entity_id': 'sensor.sparkx_i7_print_progress', 'trigger': 'numeric_state'},\n {'above': 50, 'entity_id': 'sensor.sparkx_i7_print_progress', 'trigger': 'numeric_state'},\n {'above': 75, 'entity_id': 'sensor.sparkx_i7_print_progress', 'trigger': 'numeric_state'},\n]\nvars_block = config['actions'][0]\nif 'variables' in vars_block:\n vars_block['variables']['milestone'] = \"{% set above = trigger.get('above', 0) | int(0) %}{% if above >= 75 %} 75% complete{% elif above >= 50 %} 50% complete{% elif above >= 25 %} 25% complete{% elif above >= 5 %} 5% complete{% else %} Print progress {{ above }}%{% endif %}\"\n vars_block['variables']['tag'] = \"p{{ trigger.get('above', 0) | int(0) }}\"\n", "config_hash": "dfee78ad53e9bab4", "take_control_of_blueprint": false, "category": null, "wait": true, "enabled": null, "run_actions": false, "MandatoryBPS": true, "BestPracticeKey": null}, "execution_time_ms": 1468.022346496582, "success": true, "error_message": null, "response_size_bytes": 79747, "user_context": null} {"timestamp": "2026-10-01T23:47:26.119347+00:00", "tool_name": "ha_config_get_automation", "parameters": {"identifier": "automation.3d_print_early_layers_snapshot"}, "execution_time_ms": 270.92695236206055, "success": true, "error_message": null, "response_size_bytes": 3926, "user_context": null} {"timestamp": "2026-10-01T23:49:13.738711+00:00", "tool_name": "ha_config_get_automation", "parameters": {"identifier": "automation.3d_print_early_layers_snapshot"}, "execution_time_ms": 204.79702949523926, "success": true, "error_message": null, "response_size_bytes": 3926, "user_context": null} +{"timestamp": "2026-10-01T23:49:32.036275+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": null, "identifier": "automation.3d_print_early_layers_snapshot", "python_transform": "config['description'] = 'Telegram-only snapshots from all 3 printer cameras. Fires at 5%, 25%, 50% and 75% print progress. Lights the SparkX i7 and bedroom lamp only if they are currently off, then restores whatever state they were in before capturing.'", "config_hash": "e30f542b24057b0e", "take_control_of_blueprint": false, "category": null, "wait": true, "enabled": null, "run_actions": false, "MandatoryBPS": true, "BestPracticeKey": null}, "execution_time_ms": 1022.9160785675049, "success": true, "error_message": null, "response_size_bytes": 79116, "user_context": null} diff --git a/automations.yaml b/automations.yaml index f9fb8dd5..62b72d64 100644 --- a/automations.yaml +++ b/automations.yaml @@ -3540,10 +3540,9 @@ mode: single - id: '1787462157568' alias: 3D Print Early Layers Snapshot - description: Telegram-only snapshots from all 3 printer cameras. Fires when Z crosses - 1.0 mm, then again at 25%, 50% and 75% print progress. Lights the SparkX i7 and - bedroom lamp only if they are currently off, then restores whatever state they - were in before capturing. + description: Telegram-only snapshots from all 3 printer cameras. Fires at 5%, 25%, + 50% and 75% print progress. Lights the SparkX i7 and bedroom lamp only if they + are currently off, then restores whatever state they were in before capturing. triggers: - above: 5 entity_id: sensor.sparkx_i7_print_progress