.storage/lovelace.sparkx_i7, zigbee2mqtt/state.json

This commit is contained in:
Home Assistant Version Control
2026-10-09 22:32:22 +00:00
parent 42ffea1c09
commit 0ccc4317bf
2 changed files with 23 additions and 11 deletions
+12
View File
@@ -1407,6 +1407,18 @@
},
"spool_actions": {},
"spool_location": "CFS Lite"
},
{
"type": "custom:auto-entities",
"card": {
"type": "grid",
"columns": 2,
"square": false
},
"card_param": "cards",
"filter": {
"template": "{% set ns = namespace(cards=[]) %} {% for s in states.sensor | selectattr('entity_id', 'match', '^sensor\\.spoolman_spool_') %}\n {% if s.attributes.location is defined and s.attributes.location | lower == 'cfs lite' %}\n {% set hex = s.attributes.filament_color_hex | default('44739e') %}\n {% set hex_clean = hex if hex.startswith('#') else '#' ~ hex %}\n {% set vendor = s.attributes.filament_vendor_name | default('') %}\n {% set name = s.attributes.filament_name | default(s.attributes.friendly_name) %}\n {% set material = s.attributes.filament_material | default('') %}\n {% set remaining = (s.attributes.remaining_weight | default(0) | float) | round(0) %}\n {% set total = (s.attributes.initial_weight | default(1000) | float) | round(0) %}\n {% set used_pct = (s.attributes.used_percentage | default(0) | float) | round(1) %}\n {% set remain_pct = (100 - used_pct) | round(0) %}\n\n {% set card = {\n \"type\": \"custom:button-card\",\n \"entity\": s.entity_id,\n \"layout\": \"icon_name_state2nd\",\n \"show_name\": true,\n \"show_state\": false,\n \"show_icon\": true,\n \"show_label\": true,\n \"icon\": \"mdi:printer-3d-nozzle\",\n \"name\": vendor ~ \" \" ~ name,\n \"label\": material ~ \" • \" ~ remaining ~ \"g / \" ~ total ~ \"g (\" ~ remain_pct ~ \"%)\",\n \"styles\": {\n \"card\": [\n {\"padding\": \"12px\"},\n {\"background-color\": \"var(--card-background-color)\"},\n {\"border-radius\": \"12px\"}\n ],\n \"icon\": [\n {\"color\": hex_clean},\n {\"width\": \"32px\"},\n {\"height\": \"32px\"}\n ],\n \"name\": [\n {\"font-weight\": \"600\"},\n {\"font-size\": \"14px\"},\n {\"justify-self\": \"start\"},\n {\"text-align\": \"left\"}\n ],\n \"label\": [\n {\"font-size\": \"12px\"},\n {\"color\": \"var(--secondary-text-color)\"},\n {\"justify-self\": \"start\"},\n {\"text-align\": \"left\"},\n {\"margin-top\": \"4px\"}\n ]\n },\n \"tap_action\": {\n \"action\": \"more-info\"\n }\n } %}\n {% set ns.cards = ns.cards + [card] %}\n {% endif %}\n{% endfor %} {{ ns.cards }}"
}
}
]
}