3 files
This commit is contained in:
@@ -0,0 +1,60 @@
|
|||||||
|
# ha_mcp_backup
|
||||||
|
schema_version: 1
|
||||||
|
domain: script
|
||||||
|
entity_id: spoolman_set_spool_remaining
|
||||||
|
captured: '2026-10-09T00:26:18.075188+00:00'
|
||||||
|
tool: ha_config_set_script
|
||||||
|
config:
|
||||||
|
alias: Spoolman - Set Spool Remaining
|
||||||
|
fields:
|
||||||
|
slot:
|
||||||
|
name: CFS Slot
|
||||||
|
description: CFS slot number 1-4 - resolves the spool by the slot color hex
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 1
|
||||||
|
max: 4
|
||||||
|
mode: box
|
||||||
|
spool_id:
|
||||||
|
name: Spool ID
|
||||||
|
description: Direct Spoolman spool ID - used when no slot is given
|
||||||
|
selector:
|
||||||
|
number:
|
||||||
|
min: 1
|
||||||
|
max: 9999
|
||||||
|
mode: box
|
||||||
|
sequence:
|
||||||
|
- variables:
|
||||||
|
resolved_id: '{% set n = (slot | int(0)) if slot is defined else 0 %}{% if n
|
||||||
|
>= 1 %}{% set color = states(''sensor.sparkx_i7_cfs_box_1_slot_'' ~ (n | int)
|
||||||
|
~ ''_color'') | replace(''#'', '''') | lower %}{% set ns = namespace(id='''')
|
||||||
|
%}{% for e in integration_entities(''spoolman'') %}{% if e.endswith(''_color_hex'')
|
||||||
|
and (states(e) | replace(''#'', '''') | lower) == color and ns.id == ''''
|
||||||
|
%}{% set ns.id = states(e[:-10] ~ ''_id'') %}{% endif %}{% endfor %}{{ ns.id
|
||||||
|
}}{% else %}{{ (spool_id | int(0)) if spool_id is defined else 0 }}{% endif
|
||||||
|
%}'
|
||||||
|
slot_n: '{{ (slot | int(0)) if slot is defined else 0 }}'
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
condition: template
|
||||||
|
value_template: '{{ resolved_id | int(0) > 0 }}'
|
||||||
|
sequence:
|
||||||
|
- action: spoolman.patch_spool
|
||||||
|
data:
|
||||||
|
id: '{{ resolved_id | int(0) }}'
|
||||||
|
remaining_weight: '{{ states(''input_number.spoolman_set_remaining'') |
|
||||||
|
float(0) }}'
|
||||||
|
default:
|
||||||
|
- action: notify.persistent_notification
|
||||||
|
data:
|
||||||
|
title: Spoolman - remaining not set
|
||||||
|
message: '{% if slot_n | int >= 1 %}No Spoolman spool matched CFS slot {{
|
||||||
|
slot_n }} (color {{ states(''sensor.sparkx_i7_cfs_box_1_slot_'' ~ (slot_n
|
||||||
|
| int) ~ ''_color'') }}) - register a spool with that color hex in Spoolman,
|
||||||
|
then try again.{% else %}No spool resolved - pass spool_id or a CFS slot
|
||||||
|
1-4. Nothing was set.{% endif %}'
|
||||||
|
mode: single
|
||||||
|
description: Sets a Spoolman spool remaining weight from the shared helper input_number.spoolman_set_remaining.
|
||||||
|
Pass slot (1-4) to resolve the spool by the CFS slot color hex (no remaining-weight
|
||||||
|
guard, so an exhausted spool can be reset to full), or pass spool_id directly.
|
||||||
|
Notifies via persistent notification when nothing could be resolved.
|
||||||
@@ -4147,3 +4147,5 @@
|
|||||||
{"timestamp": "2026-10-09T00:25:30.760280+00:00", "tool_name": "ha_config_get_dashboard", "parameters": {"url_path": null, "list_only": false, "force_reload": false, "entity_id": null, "card_type": null, "heading": null, "include_config": false, "include_screenshot": false, "view_path": null, "mode": "search", "query": "== color %}"}, "execution_time_ms": 11.409997940063477, "success": true, "error_message": null, "response_size_bytes": 181, "user_context": null}
|
{"timestamp": "2026-10-09T00:25:30.760280+00:00", "tool_name": "ha_config_get_dashboard", "parameters": {"url_path": null, "list_only": false, "force_reload": false, "entity_id": null, "card_type": null, "heading": null, "include_config": false, "include_screenshot": false, "view_path": null, "mode": "search", "query": "== color %}"}, "execution_time_ms": 11.409997940063477, "success": true, "error_message": null, "response_size_bytes": 181, "user_context": null}
|
||||||
{"timestamp": "2026-10-09T00:25:30.941804+00:00", "tool_name": "ha_search", "parameters": {"query": "spoolman_set_spool_remaining", "domain_filter": null, "area_filter": null, "search_types": null, "limit": 10, "offset": 0, "exact_match": true, "include_hidden": true, "include_config": false, "group_by_domain": false, "per_domain_limit": null, "state_filter": null, "result_fields": null, "fields": null, "config_time_budget": null, "ctx": {"_STATE_TTL_SECONDS": 86400}}, "execution_time_ms": 191.1015510559082, "success": true, "error_message": null, "response_size_bytes": 938, "user_context": null}
|
{"timestamp": "2026-10-09T00:25:30.941804+00:00", "tool_name": "ha_search", "parameters": {"query": "spoolman_set_spool_remaining", "domain_filter": null, "area_filter": null, "search_types": null, "limit": 10, "offset": 0, "exact_match": true, "include_hidden": true, "include_config": false, "group_by_domain": false, "per_domain_limit": null, "state_filter": null, "result_fields": null, "fields": null, "config_time_budget": null, "ctx": {"_STATE_TTL_SECONDS": 86400}}, "execution_time_ms": 191.1015510559082, "success": true, "error_message": null, "response_size_bytes": 938, "user_context": null}
|
||||||
{"timestamp": "2026-10-09T00:25:30.942916+00:00", "tool_name": "ha_config_get_script", "parameters": {"script_id": "spoolman_set_spool_remaining"}, "execution_time_ms": 200.36888122558594, "success": true, "error_message": null, "response_size_bytes": 2243, "user_context": null}
|
{"timestamp": "2026-10-09T00:25:30.942916+00:00", "tool_name": "ha_config_get_script", "parameters": {"script_id": "spoolman_set_spool_remaining"}, "execution_time_ms": 200.36888122558594, "success": true, "error_message": null, "response_size_bytes": 2243, "user_context": null}
|
||||||
|
{"timestamp": "2026-10-09T00:26:17.997062+00:00", "tool_name": "ha_config_get_dashboard", "parameters": {"url_path": "sparkx-i7", "list_only": false, "force_reload": false, "entity_id": "sensor.sparkx_i7_active_filament_slot", "card_type": null, "heading": null, "include_config": false, "include_screenshot": false, "view_path": null, "mode": null, "query": null}, "execution_time_ms": 18.42188835144043, "success": true, "error_message": null, "response_size_bytes": 1379, "user_context": null}
|
||||||
|
{"timestamp": "2026-10-09T00:26:18.432267+00:00", "tool_name": "ha_config_set_script", "parameters": {"script_id": "spoolman_set_spool_remaining", "config": null, "python_transform": "config['sequence'][0]['variables']['resolved_id'] = \"{% set n = (slot | int(0)) if slot is defined else 0 %}{% if n >= 1 %}{% set color = states('sensor.sparkx_i7_cfs_box_1_slot_' ~ (n | int) ~ '_color') | replace('#', '') | lower %}{% set ns = namespace(id='') %}{% for e in integration_entities('spoolman') %}{% if e.endswith('_color_hex') and (states(e) | replace('#', '') | lower) == color and (state_attr(e[:-10], 'location') | default('', true) | lower) == 'cfs lite' and ns.id == '' %}{% set ns.id = states(e[:-10] ~ '_id') %}{% endif %}{% endfor %}{{ ns.id }}{% else %}{{ (spool_id | int(0)) if spool_id is defined else 0 }}{% endif %}\"\nconfig['description'] = \"Sets a Spoolman spool remaining weight from the shared helper input_number.spoolman_set_remaining. Pass slot (1-4) to resolve the spool by the CFS slot color hex in the CFS Lite location (no remaining-weight guard, so an exhausted spool can be reset to full), or pass spool_id directly. Notifies via persistent notification when nothing could be resolved.\"\nconfig['sequence'][1]['default'][0]['data']['message'] = \"{% if slot_n | int >= 1 %}No Spoolman spool matched CFS slot {{ slot_n }} (color {{ states('sensor.sparkx_i7_cfs_box_1_slot_' ~ (slot_n | int) ~ '_color') }}) in the CFS Lite location - register a spool with that color hex and location in Spoolman, then try again.{% else %}No spool resolved - pass spool_id or a CFS slot 1-4. Nothing was set.{% endif %}\"", "config_hash": "542a20670ad93849", "take_control_of_blueprint": false, "category": null, "wait": true, "run": null, "variables": null, "MandatoryBPS": false, "BestPracticeKey": null}, "execution_time_ms": 344.653844833374, "success": true, "error_message": null, "response_size_bytes": 6644, "user_context": null}
|
||||||
|
|||||||
+12
-10
@@ -265,10 +265,11 @@ spoolman_set_spool_remaining:
|
|||||||
>= 1 %}{% set color = states(''sensor.sparkx_i7_cfs_box_1_slot_'' ~ (n | int)
|
>= 1 %}{% set color = states(''sensor.sparkx_i7_cfs_box_1_slot_'' ~ (n | int)
|
||||||
~ ''_color'') | replace(''#'', '''') | lower %}{% set ns = namespace(id='''')
|
~ ''_color'') | replace(''#'', '''') | lower %}{% set ns = namespace(id='''')
|
||||||
%}{% for e in integration_entities(''spoolman'') %}{% if e.endswith(''_color_hex'')
|
%}{% for e in integration_entities(''spoolman'') %}{% if e.endswith(''_color_hex'')
|
||||||
and (states(e) | replace(''#'', '''') | lower) == color and ns.id == ''''
|
and (states(e) | replace(''#'', '''') | lower) == color and (state_attr(e[:-10],
|
||||||
%}{% set ns.id = states(e[:-10] ~ ''_id'') %}{% endif %}{% endfor %}{{ ns.id
|
''location'') | default('''', true) | lower) == ''cfs lite'' and ns.id ==
|
||||||
}}{% else %}{{ (spool_id | int(0)) if spool_id is defined else 0 }}{% endif
|
'''' %}{% set ns.id = states(e[:-10] ~ ''_id'') %}{% endif %}{% endfor %}{{
|
||||||
%}'
|
ns.id }}{% else %}{{ (spool_id | int(0)) if spool_id is defined else 0 }}{%
|
||||||
|
endif %}'
|
||||||
slot_n: '{{ (slot | int(0)) if slot is defined else 0 }}'
|
slot_n: '{{ (slot | int(0)) if slot is defined else 0 }}'
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
@@ -286,11 +287,12 @@ spoolman_set_spool_remaining:
|
|||||||
title: Spoolman - remaining not set
|
title: Spoolman - remaining not set
|
||||||
message: '{% if slot_n | int >= 1 %}No Spoolman spool matched CFS slot {{
|
message: '{% if slot_n | int >= 1 %}No Spoolman spool matched CFS slot {{
|
||||||
slot_n }} (color {{ states(''sensor.sparkx_i7_cfs_box_1_slot_'' ~ (slot_n
|
slot_n }} (color {{ states(''sensor.sparkx_i7_cfs_box_1_slot_'' ~ (slot_n
|
||||||
| int) ~ ''_color'') }}) - register a spool with that color hex in Spoolman,
|
| int) ~ ''_color'') }}) in the CFS Lite location - register a spool with
|
||||||
then try again.{% else %}No spool resolved - pass spool_id or a CFS slot
|
that color hex and location in Spoolman, then try again.{% else %}No spool
|
||||||
1-4. Nothing was set.{% endif %}'
|
resolved - pass spool_id or a CFS slot 1-4. Nothing was set.{% endif %}'
|
||||||
mode: single
|
mode: single
|
||||||
description: Sets a Spoolman spool remaining weight from the shared helper input_number.spoolman_set_remaining.
|
description: Sets a Spoolman spool remaining weight from the shared helper input_number.spoolman_set_remaining.
|
||||||
Pass slot (1-4) to resolve the spool by the CFS slot color hex (no remaining-weight
|
Pass slot (1-4) to resolve the spool by the CFS slot color hex in the CFS Lite
|
||||||
guard, so an exhausted spool can be reset to full), or pass spool_id directly.
|
location (no remaining-weight guard, so an exhausted spool can be reset to full),
|
||||||
Notifies via persistent notification when nothing could be resolved.
|
or pass spool_id directly. Notifies via persistent notification when nothing could
|
||||||
|
be resolved.
|
||||||
|
|||||||
Reference in New Issue
Block a user