diff --git a/.ha_mcp/logs/mcp_usage.jsonl b/.ha_mcp/logs/mcp_usage.jsonl index fa9c85e3..7fe1f697 100644 --- a/.ha_mcp/logs/mcp_usage.jsonl +++ b/.ha_mcp/logs/mcp_usage.jsonl @@ -1824,3 +1824,4 @@ {"timestamp": "2026-08-23T05:54:15.804738+00:00", "tool_name": "ha_list_services", "parameters": {"domain": "telegram_bot", "query": null, "limit": 50, "offset": 0, "detail_level": "full", "service_fields": ["name", "fields"], "fields": null}, "execution_time_ms": 118.43347549438477, "success": true, "error_message": null, "response_size_bytes": 36337, "user_context": null} {"timestamp": "2026-08-23T05:55:12.976461+00:00", "tool_name": "ha_eval_template", "parameters": {"template": "{% set f = states('sensor.octoprint_print_file') %}\n{% set file = 'No file' if f in ['unknown', 'unavailable', 'none'] else f.replace('.gcode', '') %}\n{% set pct = states('sensor.octoprint_print_progress') | round(0) | int(0) %}\n{% set es = states('sensor.octoprint_elapsed') | int(0) %}\n{% set ts = states('sensor.octoprint_time_left') | int(0) %}\n{% set dt = states('sensor.octoprint_approximate_completion_time') | as_datetime %}\n{% macro dur(s) -%}\n{%- if s >= 3600 -%}{{ (s // 3600) }}h {{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif -%}\n{%- endmacro %}\n{% if dt %}\n {% set fin = '~' + as_local(dt).strftime('%I:%M %p').lstrip('0') %}\n{% elif ts > 0 %}\n {% set fin = '~' + (now() + timedelta(seconds=ts)).strftime('%I:%M %p').lstrip('0') %}\n{% else %}\n {% set fin = 'unknown' %}\n{% endif %}\n{{ file }}\nProgress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts > 0 else 'unknown' }}\nEst. finish: {{ fin }}", "timeout": 3, "report_errors": true}, "execution_time_ms": 20.174026489257812, "success": true, "error_message": null, "response_size_bytes": 1153, "user_context": null} {"timestamp": "2026-08-23T05:55:15.198336+00:00", "tool_name": "ha_eval_template", "parameters": {"template": "{% set f = states('sensor.octoprint_print_file') %}\n{% set file = 'Print' if f in ['unknown', 'unavailable', 'none'] else f.replace('.gcode', '') %}\n{% set tt = state_attr('sensor.octoprint_print_progress', 'printTime') | int(0) %}\n{% set s = tt if tt > 0 else states('sensor.octoprint_elapsed') | int(0) %}\n{% macro dur(s) -%}\n{%- if s >= 3600 -%}{{ (s // 3600) }}h {{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif -%}\n{%- endmacro %}\n{{ file }} finished successfully at {{ now().strftime('%I:%M %p').lstrip('0') }}.\nTotal time: {{ dur(s) }}", "timeout": 3, "report_errors": true}, "execution_time_ms": 11.507987976074219, "success": true, "error_message": null, "response_size_bytes": 737, "user_context": null} +{"timestamp": "2026-08-23T05:56:09.967356+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": null, "identifier": "automation.3d_print_early_layers_snapshot", "python_transform": "body = \"{% set f = states('sensor.octoprint_print_file') %}{% set file = 'No file' if f in ['unknown', 'unavailable', 'none'] else f.replace('.gcode', '') %}{% set pct = states('sensor.octoprint_print_progress') | round(0) | int(0) %}{% set es = states('sensor.octoprint_elapsed') | int(0) %}{% set ts = states('sensor.octoprint_time_left') | int(0) %}{% set dt = states('sensor.octoprint_approximate_completion_time') | as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h {{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif -%}{%- endmacro %}{% if dt %}{% set fin = '~' + as_local(dt).strftime('%I:%M %p').lstrip('0') %}{% elif ts > 0 %}{% set fin = '~' + (now() + timedelta(seconds=ts)).strftime('%I:%M %p').lstrip('0') %}{% else %}{% set fin = 'unknown' %}{% endif %}\\n{{ file }}\\nProgress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts > 0 else 'unknown' }}\\nEst. finish: {{ fin }}\"; targets = [\"notify.mobile_app_sm_f956w\", \"notify.mobile_app_motorola_one_vision\", \"notify.mobile_app_francos_ipad\", \"notify.mobile_app_sm_t387w\"]; steps = [{\"action\": t, \"data\": {\"title\": \"3D print early check\", \"message\": body, \"data\": {\"image\": \"/local/octoprint_snapshot.jpg\"}}} for t in targets]; steps.append({\"action\": \"telegram_bot.send_photo\", \"data\": {\"entity_id\": \"notify.franco\", \"file\": \"/config/www/octoprint_snapshot.jpg\", \"caption\": body, \"parse_mode\": \"plain_text\"}}); config[\"actions\"] = [{\"action\": \"camera.snapshot\", \"target\": {\"entity_id\": \"camera.endercamera_duckdns_org\"}, \"data\": {\"filename\": \"/config/www/octoprint_snapshot.jpg\"}}, {\"parallel\": steps}]", "config_hash": "618faf493dd1ad1d", "category": null, "wait": true, "MandatoryBPS": false, "BestPracticeKey": null}, "execution_time_ms": 390.28310775756836, "success": true, "error_message": null, "response_size_bytes": 2016, "user_context": null} diff --git a/automations.yaml b/automations.yaml index c6cd6ef3..715600ef 100644 --- a/automations.yaml +++ b/automations.yaml @@ -3354,30 +3354,111 @@ - action: notify.mobile_app_sm_f956w data: title: 3D print early check - message: Print passed the first few layers (Z crossed 1 mm). + message: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file + = ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'', + '''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0) + | int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{% + set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'') + | as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h + {{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif + -%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M + %p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M + %p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %} + + {{ file }} + + Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts > + 0 else ''unknown'' }} + + Est. finish: {{ fin }}' data: image: /local/octoprint_snapshot.jpg - action: notify.mobile_app_motorola_one_vision data: title: 3D print early check - message: Print passed the first few layers (Z crossed 1 mm). + message: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file + = ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'', + '''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0) + | int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{% + set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'') + | as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h + {{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif + -%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M + %p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M + %p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %} + + {{ file }} + + Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts > + 0 else ''unknown'' }} + + Est. finish: {{ fin }}' data: image: /local/octoprint_snapshot.jpg - action: notify.mobile_app_francos_ipad data: title: 3D print early check - message: Print passed the first few layers (Z crossed 1 mm). + message: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file + = ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'', + '''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0) + | int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{% + set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'') + | as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h + {{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif + -%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M + %p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M + %p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %} + + {{ file }} + + Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts > + 0 else ''unknown'' }} + + Est. finish: {{ fin }}' data: image: /local/octoprint_snapshot.jpg - action: notify.mobile_app_sm_t387w data: title: 3D print early check - message: Print passed the first few layers (Z crossed 1 mm). + message: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file + = ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'', + '''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0) + | int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{% + set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'') + | as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h + {{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif + -%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M + %p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M + %p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %} + + {{ file }} + + Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts > + 0 else ''unknown'' }} + + Est. finish: {{ fin }}' data: image: /local/octoprint_snapshot.jpg - action: telegram_bot.send_photo data: entity_id: notify.franco file: /config/www/octoprint_snapshot.jpg - caption: Print passed the first few layers (Z crossed 1 mm). + caption: '{% set f = states(''sensor.octoprint_print_file'') %}{% set file + = ''No file'' if f in [''unknown'', ''unavailable'', ''none''] else f.replace(''.gcode'', + '''') %}{% set pct = states(''sensor.octoprint_print_progress'') | round(0) + | int(0) %}{% set es = states(''sensor.octoprint_elapsed'') | int(0) %}{% + set ts = states(''sensor.octoprint_time_left'') | int(0) %}{% set dt = states(''sensor.octoprint_approximate_completion_time'') + | as_datetime %}{% macro dur(s) -%}{%- if s >= 3600 -%}{{ (s // 3600) }}h + {{ ((s % 3600) // 60) }}m{%- else -%}{{ ((s % 3600) // 60) }}m{%- endif + -%}{%- endmacro %}{% if dt %}{% set fin = ''~'' + as_local(dt).strftime(''%I:%M + %p'').lstrip(''0'') %}{% elif ts > 0 %}{% set fin = ''~'' + (now() + timedelta(seconds=ts)).strftime(''%I:%M + %p'').lstrip(''0'') %}{% else %}{% set fin = ''unknown'' %}{% endif %} + + {{ file }} + + Progress: {{ pct }}% · Elapsed: {{ dur(es) }} · Left: {{ dur(ts) if ts > + 0 else ''unknown'' }} + + Est. finish: {{ fin }}' + parse_mode: plain_text mode: single