From 7a2a9123180c6edbea217706f8bd39f057d6e028 Mon Sep 17 00:00:00 2001 From: Home Assistant Version Control Date: Thu, 17 Sep 2026 14:38:10 +0000 Subject: [PATCH] .ha_mcp/logs/mcp_usage.jsonl, automations.yaml --- .ha_mcp/logs/mcp_usage.jsonl | 1 + automations.yaml | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/.ha_mcp/logs/mcp_usage.jsonl b/.ha_mcp/logs/mcp_usage.jsonl index c0b36c93..8d3a37b9 100644 --- a/.ha_mcp/logs/mcp_usage.jsonl +++ b/.ha_mcp/logs/mcp_usage.jsonl @@ -3647,3 +3647,4 @@ {"timestamp": "2026-09-17T14:37:18.274236+00:00", "tool_name": "ha_eval_template", "parameters": {"template": "{% set samples = [{'entity_id': 'input_boolean.3d_printer_running'},\n{'entity_id': ['input_boolean.3d_printer_running']},\n{'target': {'entity_id': 'input_boolean.3d_printer_running'}},\n{'target': {'area_id': 'printer'}},\n{'entity_id': 'input_boolean.other'}] %}\n{% for sd in samples %}\n{% set eid = sd.get('entity_id') if sd is mapping else none %}\n{% set tgt = sd.get('target', {}) if sd is mapping else {} %}\n{% set tid = tgt.get('entity_id') if tgt is mapping else none %}\n{% set hits = [] %}\n{% for item in [eid, tid] if item %}\n {% if item is string %}{% set hits = hits + [item] %}{% elif item is sequence %}{% set hits = hits + item %}{% endif %}\n{% endfor %}\n{{ sd }} => matched={{ 'input_boolean.3d_printer_running' in hits }}\n{% endfor %}", "timeout": 3, "report_errors": true}, "execution_time_ms": 42.06442832946777, "success": true, "error_message": null, "response_size_bytes": 1244, "user_context": null} {"timestamp": "2026-09-17T14:37:38.255760+00:00", "tool_name": "ha_eval_template", "parameters": {"template": "{% set sd = {'entity_id': 'input_boolean.3d_printer_running'} %}\n{% set eid = sd.get('entity_id') %}\n{% set tgt = sd.get('target', {}) %}\n{% set tid = tgt.get('entity_id') %}\neid={{ eid }} tid={{ tid }} target_is={{ tgt }}\n{{ 'input_boolean.3d_printer_running' == eid }}", "timeout": 3, "report_errors": true}, "execution_time_ms": 12.509346008300781, "success": true, "error_message": null, "response_size_bytes": 430, "user_context": null} {"timestamp": "2026-09-17T14:37:52.230919+00:00", "tool_name": "ha_eval_template", "parameters": {"template": "{% set samples = [{'entity_id': 'input_boolean.3d_printer_running'}, {'entity_id': ['input_boolean.3d_printer_running']}, {'target': {'entity_id': 'input_boolean.3d_printer_running'}}, {'target': {'area_id': 'printer'}}, {'entity_id': 'input_boolean.other'}] %}\n{% for sd in samples %}\n{% set eid = sd.get('entity_id') if sd is mapping else none %}\n{% set tgt = sd.get('target', {}) if sd is mapping else {} %}\n{% set tid = tgt.get('entity_id') if tgt is mapping else none %}\n{% set ns = namespace(hits=[]) %}\n{% for item in [eid, tid] if item %}\n{% if item is string %}{% set ns.hits = ns.hits + [item] %}{% elif item is sequence %}{% set ns.hits = ns.hits + item %}{% endif %}\n{% endfor %}\n{{ sd }} => matched={{ 'input_boolean.3d_printer_running' in ns.hits }}\n{% endfor %}", "timeout": 3, "report_errors": true}, "execution_time_ms": 64.96596336364746, "success": true, "error_message": null, "response_size_bytes": 1258, "user_context": null} +{"timestamp": "2026-09-17T14:38:07.445004+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": {"actions": [{"action": "input_boolean.turn_off", "target": {"entity_id": "input_boolean.3d_printer_running"}}, {"delay": {"seconds": 2}}, {"action": "input_boolean.turn_on", "target": {"entity_id": "input_boolean.3d_printer_running"}}], "alias": "3D Printer Running - Reset Stale Boolean", "conditions": [{"condition": "state", "entity_id": "input_boolean.3d_printer_running", "state": "on"}, {"condition": "template", "value_template": "{% set sd = trigger.event.data.get('service_data', {}) %}\n{% set eid = sd.get('entity_id') %}\n{% set tgt = sd.get('target', {}) if sd else {} %}\n{% set tid = tgt.get('entity_id') %}\n{% set ns = namespace(hits=[]) %}\n{% for item in [eid, tid] if item %}\n{% if item is string %}{% set ns.hits = ns.hits + [item] %}{% elif item is sequence %}{% set ns.hits = ns.hits + item %}{% endif %}\n{% endfor %}\n{{ 'input_boolean.3d_printer_running' in ns.hits and (now() - states['input_boolean.3d_printer_running'].last_changed).total_seconds() > 5 }}"}], "description": "If input_boolean.3d_printer_running is commanded on while already on (e.g. after a printer crash left it on, so no off->on transition fires the main automation), force a quick off->on bounce so the main automation runs its print-started actions. The >5s stale check prevents responding to its own bounce.", "mode": "single", "triggers": [{"event_data": {"domain": "input_boolean", "service": "turn_on"}, "event_type": "call_service", "id": "cmd_on", "trigger": "event"}]}, "identifier": null, "python_transform": null, "config_hash": null, "take_control_of_blueprint": false, "category": null, "wait": true, "MandatoryBPS": false, "BestPracticeKey": null}, "execution_time_ms": 4352.312088012695, "success": true, "error_message": null, "response_size_bytes": 1964, "user_context": null} diff --git a/automations.yaml b/automations.yaml index 45b2da7d..00537395 100644 --- a/automations.yaml +++ b/automations.yaml @@ -3955,3 +3955,50 @@ target: entity_id: switch.filter mode: single +- id: '1789655883265' + alias: 3D Printer Running - Reset Stale Boolean + description: If input_boolean.3d_printer_running is commanded on while already on + (e.g. after a printer crash left it on, so no off->on transition fires the main + automation), force a quick off->on bounce so the main automation runs its print-started + actions. The >5s stale check prevents responding to its own bounce. + triggers: + - event_data: + domain: input_boolean + service: turn_on + event_type: call_service + id: cmd_on + trigger: event + conditions: + - condition: state + entity_id: input_boolean.3d_printer_running + state: 'on' + - condition: template + value_template: '{% set sd = trigger.event.data.get(''service_data'', {}) %} + + {% set eid = sd.get(''entity_id'') %} + + {% set tgt = sd.get(''target'', {}) if sd else {} %} + + {% set tid = tgt.get(''entity_id'') %} + + {% set ns = namespace(hits=[]) %} + + {% for item in [eid, tid] if item %} + + {% if item is string %}{% set ns.hits = ns.hits + [item] %}{% elif item is sequence + %}{% set ns.hits = ns.hits + item %}{% endif %} + + {% endfor %} + + {{ ''input_boolean.3d_printer_running'' in ns.hits and (now() - states[''input_boolean.3d_printer_running''].last_changed).total_seconds() + > 5 }}' + actions: + - action: input_boolean.turn_off + target: + entity_id: input_boolean.3d_printer_running + - delay: + seconds: 2 + - action: input_boolean.turn_on + target: + entity_id: input_boolean.3d_printer_running + mode: single