From 3d63c7cc30a376f64f9b3559dbcf6d026b945a67 Mon Sep 17 00:00:00 2001 From: Home Assistant Version Control Date: Thu, 15 Oct 2026 14:53:49 +0000 Subject: [PATCH] .ha_mcp/logs/mcp_usage.jsonl, automations.yaml --- .ha_mcp/logs/mcp_usage.jsonl | 1 + automations.yaml | 57 ++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/.ha_mcp/logs/mcp_usage.jsonl b/.ha_mcp/logs/mcp_usage.jsonl index ef731d7c..b5db1247 100644 --- a/.ha_mcp/logs/mcp_usage.jsonl +++ b/.ha_mcp/logs/mcp_usage.jsonl @@ -4587,3 +4587,4 @@ {"timestamp": "2026-10-15T14:45:12.536926+00:00", "tool_name": "ha_search", "parameters": {"query": "sparkx", "domain_filter": null, "area_filter": null, "search_types": null, "limit": 40, "offset": 0, "exact_match": true, "include_hidden": true, "include_config": false, "group_by_domain": false, "per_domain_limit": null, "state_filter": null, "result_fields": ["entity_id", "state", "friendly_name"], "fields": null, "config_time_budget": null, "ctx": "Context(_STATE_TTL_SECONDS=86400)"}, "execution_time_ms": 177.70075798034668, "success": true, "error_message": null, "response_size_bytes": 13854, "user_context": null} {"timestamp": "2026-10-15T14:51:54.163225+00:00", "tool_name": "ha_config_set_helper", "parameters": {"helper_type": "input_text", "name": "SparkX i7 Low Spool Notified", "helper_id": null, "entry_id": null, "subentry_type": null, "subentry_id": null, "show_advanced_options": false, "icon": null, "area_id": null, "labels": null, "min_value": null, "max_value": null, "step": null, "unit_of_measurement": null, "options": null, "initial": null, "mode": null, "has_date": null, "has_time": null, "restore": null, "duration": null, "monday": null, "tuesday": null, "wednesday": null, "thursday": null, "friday": null, "saturday": null, "sunday": null, "latitude": null, "longitude": null, "radius": null, "passive": null, "user_id": null, "device_trackers": null, "picture": null, "tag_id": null, "description": null, "pattern": null, "category": null, "config": {"max": 16}, "wait": true, "action": "create", "MandatoryBPS": true, "BestPracticeKey": null}, "execution_time_ms": 27.28867530822754, "success": true, "error_message": null, "response_size_bytes": 53347, "user_context": null} {"timestamp": "2026-10-15T14:52:06.777334+00:00", "tool_name": "ha_list_services", "parameters": {"domain": "input_text", "query": null, "limit": 50, "offset": 0, "detail_level": "summary", "service_fields": null, "fields": ["services"]}, "execution_time_ms": 30.26890754699707, "success": true, "error_message": null, "response_size_bytes": 737, "user_context": null} +{"timestamp": "2026-10-15T14:53:44.343382+00:00", "tool_name": "ha_config_set_automation", "parameters": {"config": {"alias": "SparkX i7 - Low spool alert", "description": "Periodic scan of the CFS Lite slots (per-slot Spoolman location). Alerts once when a loaded spool drops below 100 g and again when it drops below 25 g. The 4-digit band string in input_text.sparkx_i7_low_spool_notified (slots 1-4, 0=ok, 1=<100 g, 2=<25 g) prevents repeat alerts.", "triggers": [{"trigger": "time_pattern", "minutes": "/15"}], "conditions": [], "actions": [{"variables": {"bands": "{% set prev = states('input_text.sparkx_i7_low_spool_notified') | default('0000', true) %}{% set ns = namespace(s='') %}{% for n in ['1','2','3','4'] %}{% set sp = namespace(id='', rem=-1) %}{% for e in integration_entities('spoolman') if e.endswith('_color_hex') %}{% if sp.id == '' and (state_attr(e[:-10],'location') | default('', true) | lower) == ('cfs lite ' ~ n) %}{% set sp.id = e[:-10] %}{% set sp.rem = states(e[:-10]) | float(-1) %}{% endif %}{% endfor %}{% set band = 2 if (sp.rem >= 0 and sp.rem < 25) else (1 if (sp.rem >= 0 and sp.rem < 100) else 0) %}{% set ns.s = ns.s ~ band %}{% endfor %}{{ ns.s }}", "report": "{% set prev = states('input_text.sparkx_i7_low_spool_notified') | default('0000', true) %}{% set ns = namespace(low=[]) %}{% for n in ['1','2','3','4'] %}{% set sp = namespace(id='', rem=-1) %}{% for e in integration_entities('spoolman') if e.endswith('_color_hex') %}{% if sp.id == '' and (state_attr(e[:-10],'location') | default('', true) | lower) == ('cfs lite ' ~ n) %}{% set sp.id = e[:-10] %}{% set sp.rem = states(e[:-10]) | float(-1) %}{% endif %}{% endfor %}{% set band = 2 if (sp.rem >= 0 and sp.rem < 25) else (1 if (sp.rem >= 0 and sp.rem < 100) else 0) %}{% set oldb = prev[n | int - 1] | int(-1) %}{% if band > oldb and band > 0 %}{% set cname = states('sensor.sparkx_i7_slot_' ~ n ~ '_color_name') %}{% set cname = cname if cname not in ['','unknown','unavailable'] else ('slot ' ~ n) %}{% set tag = ' - critically low' if band == 2 else '' %}{% set ns.low = ns.low + ['Slot ' ~ n ~ ' ' ~ cname ~ ': ' ~ (sp.rem | round(0) | int) ~ ' g left' ~ tag] %}{% endif %}{% endfor %}{% if ns.low %}Low filament on the SparkX i7 CFS Lite:\\n- {{ ns.low | join('\\n- ') }}{% endif %}"}}, {"if": [{"condition": "template", "value_template": "{{ report | trim != '' }}"}], "then": [{"action": "notify.persistent_notification", "data": {"title": "[REDACTED]", "message": "[REDACTED]"}}, {"action": "notify.mobile_app_francos_ipad", "data": {"title": "[REDACTED]", "message": "[REDACTED]"}}, {"action": "notify.mobile_app_sm_f956w", "data": {"title": "[REDACTED]", "message": "[REDACTED]"}}]}, {"action": "input_text.set_value", "target": {"entity_id": "input_text.sparkx_i7_low_spool_notified"}, "data": {"value": "{{ bands }}"}}], "mode": "single"}, "identifier": null, "python_transform": null, "config_hash": null, "take_control_of_blueprint": false, "category": null, "wait": true, "enabled": null, "run_actions": false, "MandatoryBPS": false, "BestPracticeKey": null}, "execution_time_ms": 646.2757587432861, "success": true, "error_message": null, "response_size_bytes": 1712, "user_context": null} diff --git a/automations.yaml b/automations.yaml index ea475f5d..c5c3fbe5 100644 --- a/automations.yaml +++ b/automations.yaml @@ -4997,3 +4997,60 @@ title: Print started - filament check message: '{{ report }}' mode: single +- id: '1792076023718' + alias: SparkX i7 - Low spool alert + description: Periodic scan of the CFS Lite slots (per-slot Spoolman location). Alerts + once when a loaded spool drops below 100 g and again when it drops below 25 g. + The 4-digit band string in input_text.sparkx_i7_low_spool_notified (slots 1-4, + 0=ok, 1=<100 g, 2=<25 g) prevents repeat alerts. + triggers: + - trigger: time_pattern + minutes: /15 + conditions: [] + actions: + - variables: + bands: '{% set prev = states(''input_text.sparkx_i7_low_spool_notified'') | + default(''0000'', true) %}{% set ns = namespace(s='''') %}{% for n in [''1'',''2'',''3'',''4''] + %}{% set sp = namespace(id='''', rem=-1) %}{% for e in integration_entities(''spoolman'') + if e.endswith(''_color_hex'') %}{% if sp.id == '''' and (state_attr(e[:-10],''location'') + | default('''', true) | lower) == (''cfs lite '' ~ n) %}{% set sp.id = e[:-10] + %}{% set sp.rem = states(e[:-10]) | float(-1) %}{% endif %}{% endfor %}{% + set band = 2 if (sp.rem >= 0 and sp.rem < 25) else (1 if (sp.rem >= 0 and + sp.rem < 100) else 0) %}{% set ns.s = ns.s ~ band %}{% endfor %}{{ ns.s }}' + report: '{% set prev = states(''input_text.sparkx_i7_low_spool_notified'') | + default(''0000'', true) %}{% set ns = namespace(low=[]) %}{% for n in [''1'',''2'',''3'',''4''] + %}{% set sp = namespace(id='''', rem=-1) %}{% for e in integration_entities(''spoolman'') + if e.endswith(''_color_hex'') %}{% if sp.id == '''' and (state_attr(e[:-10],''location'') + | default('''', true) | lower) == (''cfs lite '' ~ n) %}{% set sp.id = e[:-10] + %}{% set sp.rem = states(e[:-10]) | float(-1) %}{% endif %}{% endfor %}{% + set band = 2 if (sp.rem >= 0 and sp.rem < 25) else (1 if (sp.rem >= 0 and + sp.rem < 100) else 0) %}{% set oldb = prev[n | int - 1] | int(-1) %}{% if + band > oldb and band > 0 %}{% set cname = states(''sensor.sparkx_i7_slot_'' + ~ n ~ ''_color_name'') %}{% set cname = cname if cname not in ['''',''unknown'',''unavailable''] + else (''slot '' ~ n) %}{% set tag = '' - critically low'' if band == 2 else + '''' %}{% set ns.low = ns.low + [''Slot '' ~ n ~ '' '' ~ cname ~ '': '' ~ + (sp.rem | round(0) | int) ~ '' g left'' ~ tag] %}{% endif %}{% endfor %}{% + if ns.low %}Low filament on the SparkX i7 CFS Lite:\n- {{ ns.low | join(''\n- + '') }}{% endif %}' + - if: + - condition: template + value_template: '{{ report | trim != '''' }}' + then: + - action: notify.persistent_notification + data: + title: SparkX i7 - low filament + message: '{{ report }}' + - action: notify.mobile_app_francos_ipad + data: + title: SparkX i7 - low filament + message: '{{ report }}' + - action: notify.mobile_app_sm_f956w + data: + title: SparkX i7 - low filament + message: '{{ report }}' + - action: input_text.set_value + target: + entity_id: input_text.sparkx_i7_low_spool_notified + data: + value: '{{ bands }}' + mode: single