.ha_mcp/logs/mcp_usage.jsonl, automations.yaml
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user