From e4130bb329dd79df9b62cf727081f965fb74e580 Mon Sep 17 00:00:00 2001 From: Darek Date: Tue, 14 Apr 2026 19:40:11 -0500 Subject: [PATCH] Exclude retired batteries from dashboard warnings --- app.py | 2 +- templates/dashboard.html | 4 ++-- tests/test_ha_integration.py | 40 ++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 3c6246c..9f13ee1 100644 --- a/app.py +++ b/app.py @@ -95,7 +95,7 @@ def create_app(config_object="config"): and b.tested_capacity_mah < 0.8 * b.capacity_mah ], "low_pct": [ - b for b in batteries + b for b in active if b.battery_percentage is not None and b.battery_percentage < 20 ] if ha_client.enabled else [], } diff --git a/templates/dashboard.html b/templates/dashboard.html index f909a8d..17631eb 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -27,7 +27,7 @@
Retired
{% if ha_enabled %} - {% set low_pct = batteries | selectattr('battery_percentage', 'ne', none) | selectattr('battery_percentage', 'lt', 20) | list %} + {% set low_pct = batteries | rejectattr('status', 'equalto', 'retired') | selectattr('battery_percentage', 'ne', none) | selectattr('battery_percentage', 'lt', 20) | list %} {% if low_pct %}