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 %}