Add optional Home Assistant integration for battery percentage tracking

This commit is contained in:
2026-04-13 20:10:23 -05:00
parent 9d2b1d0d51
commit 8c06478bca
13 changed files with 607 additions and 5 deletions
+19
View File
@@ -67,6 +67,18 @@
{{ meta_row("Charge Cycles", battery.charge_cycles) }}
{{ meta_row("Purchase Date", battery.purchase_date) }}
{{ meta_row("Storage", battery.storage_location) }}
{% if battery.battery_percentage is not none %}
<tr>
<td style="padding:0.3rem 1rem 0.3rem 0;font-weight:600;color:#64748b;border:none;">Battery %</td>
<td style="border:none;">
{% if battery.battery_percentage < 20 %}
<span class="badge badge-warning">⚠ {{ battery.battery_percentage }}% — consider replacing</span>
{% else %}
{{ battery.battery_percentage }}%
{% endif %}
</td>
</tr>
{% endif %}
{% if battery.notes %}
<tr>
<td style="padding:0.3rem 1rem 0.3rem 0;font-weight:600;color:#64748b;border:none;">Notes</td>
@@ -261,6 +273,13 @@
value="{{ battery.purchase_date or '' }}">
</div>
<div class="form-group">
<label for="battery_percentage">Battery % (optional)</label>
<input type="number" id="battery_percentage" name="battery_percentage" min="0" max="100"
value="{{ battery.battery_percentage if battery.battery_percentage is not none else '' }}"
placeholder="e.g. 85">
</div>
</div>
<div class="form-group">