From e757e617b1ac447b93b5db0d747d5403a5558220 Mon Sep 17 00:00:00 2001 From: Home Assistant Version Control Date: Sat, 8 Aug 2026 13:42:18 +0000 Subject: [PATCH] configuration.yaml --- configuration.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configuration.yaml b/configuration.yaml index b45bef8..f43a723 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -221,9 +221,9 @@ template: unit_of_measurement: "mm" icon: mdi:spool state: >- - {% set jobs = state_attr('sensor.octoprint_filament_used_total', 'filamentModels') | default([]) %} - {% set last = jobs[0] if jobs else {} %} - {{ last.get('total', {}).get('usedLength', 0) | float | round(2) if last else 0 }} + {% set fm = state_attr('sensor.octoprint_filament_used_total', 'filamentModels') %} + {% set total = fm.get('total', {}) if fm else {} %} + {{ total.get('usedLength', 0) | float | round(2) }} # Legacy and Integration Sensor Section sensor: @@ -273,7 +273,7 @@ rest: | sum | round(2) }} - json_attributes_path: "$.allPrintJobs" + json_attributes_path: "$.allPrintJobs[0]" json_attributes: - "fileName" - "filamentModels"