{# plugins/ups/templates/ups/rows.html #} {# ── On-battery alert banner ──────────────────────────────────────────────── #} {% if latest and latest.on_battery %}
⚠ On Battery Power {% if on_battery_since %} — {{ ((latest.scraped_at - on_battery_since).total_seconds() / 60) | int }}m elapsed {% endif %} {% if shutdown_triggered %} Shutdown sequence triggered {% elif latest.low_battery %} Low battery — shutdown imminent {% endif %}
{% endif %} {% if not latest %}

No UPS data yet. Check nut_host, nut_port, and ups_name in plugin settings.

{% else %}
{# ── Current status card ──────────────────────────────────────────────── #}
Status {% if latest.manufacturer or latest.model %} {{ latest.manufacturer or "" }} {{ latest.model or "" }} {% endif %}
{# Status pill #}
{% if latest.on_battery %}On Battery{% else %}Online{% endif %} {% if latest.low_battery %} Low Battery {% endif %} {{ latest.raw_status }}
{# Battery charge bar #} {% if latest.battery_charge_pct is not none %}
Battery {{ "%.0f"|format(latest.battery_charge_pct) }}%
= 80 %}var(--green) {% elif latest.battery_charge_pct >= 40 %}var(--yellow) {% else %}var(--red){% endif %};transition:width 0.3s;">
{% endif %} {# Key metrics #}
{% if latest.battery_runtime_secs is not none %}
Runtime
{% set mins = latest.battery_runtime_secs // 60 %} {% if mins >= 60 %}{{ mins // 60 }}h {{ mins % 60 }}m {% else %}{{ mins }}m{% endif %}
{% endif %} {% if latest.load_pct is not none %}
Load
{{ "%.0f"|format(latest.load_pct) }}%
{% endif %} {% if latest.input_voltage is not none %}
Input V
{{ "%.1f"|format(latest.input_voltage) }}V
{% endif %} {% if latest.output_voltage is not none %}
Output V
{{ "%.1f"|format(latest.output_voltage) }}V
{% endif %} {% if latest.battery_voltage is not none %}
Batt V
{{ "%.1f"|format(latest.battery_voltage) }}V
{% endif %} {% if latest.temperature is not none %}
Temp
{{ "%.1f"|format(latest.temperature) }}°C
{% endif %}
Last updated {{ latest.scraped_at.strftime("%H:%M:%S") }} UTC
{# ── Trend charts ─────────────────────────────────────────────────────── #} {% if history %}
Trends {{ range_key }}
Battery % {% if latest.battery_charge_pct is not none %}{{ "%.0f"|format(latest.battery_charge_pct) }}%{% endif %}
{{ sparkline_charge | safe }}
Load % {% if latest.load_pct is not none %}{{ "%.0f"|format(latest.load_pct) }}%{% endif %}
{{ sparkline_load | safe }}
Input Voltage {% if latest.input_voltage is not none %}{{ "%.1f"|format(latest.input_voltage) }}V{% endif %}
{{ sparkline_voltage | safe }}
{% endif %} {# ── Battery event log ────────────────────────────────────────────────── #} {% if battery_events %}
Battery Events {{ range_key }}
{% for ev in battery_events %} {% endfor %}
{{ ev.scraped_at.strftime("%m-%d %H:%M") }} {{ ev.raw_status }} {% if ev.battery_charge_pct is not none %}{{ "%.0f"|format(ev.battery_charge_pct) }}%{% endif %}
{% endif %}
{% endif %}