Exclude retired batteries from dashboard warnings

This commit is contained in:
2026-04-14 19:40:11 -05:00
parent 5d8fb5aa68
commit e4130bb329
3 changed files with 43 additions and 3 deletions
+2 -2
View File
@@ -27,7 +27,7 @@
<div class="text-muted">Retired</div>
</div>
{% 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 %}
<a href="#needs-attention"
onclick="var d=document.getElementById('needs-attention');d.open=true;"
@@ -248,7 +248,7 @@
<td data-label="Bat %" class="col-ha-pct" style="display:none;"
data-sort-col="ha-pct" data-sort="{{ b.battery_percentage if b.battery_percentage is not none else '' }}">
{% if b.battery_percentage is not none %}
{% if b.battery_percentage < 20 %}
{% if b.battery_percentage < 20 and b.status != 'retired' %}
<span class="badge badge-warning" title="Low — consider replacing">⚠ {{ b.battery_percentage }}%</span>
{% else %}{{ b.battery_percentage }}%{% endif %}
{% else %}—{% endif %}