{# plugins/unifi/templates/unifi/rows.html #}
{% from "_macros.html" import stat_tile, status_badge, status_dot %}
{# ── WAN health ───────────────────────────────────────────────────────────── #}
{% if latest_wan %}
{{ stat_tile("WAN", "Up" if latest_wan.is_up else "Down", state="up" if latest_wan.is_up else "down",
hint=latest_wan.wan_ip) }}
{% if latest_wan.latency_ms is not none %}
{{ stat_tile("Latency", "%.0f ms"|format(latest_wan.latency_ms), state=status_class(latest_wan.latency_ms, 'latency'),
hint=sparkline_latency|safe) }}
{% endif %}
{% if latest_wan.rx_bytes_rate is not none %}
{{ stat_tile("Download", latest_wan.rx_bytes_rate|rate, hint=sparkline_rx|safe) }}
{{ stat_tile("Upload", latest_wan.tx_bytes_rate|rate, hint=sparkline_tx|safe) }}
{% endif %}
{% if latest_wan.uptime_seconds is not none %}{{ stat_tile("WAN uptime", latest_wan.uptime_seconds|duration) }}{% endif %}
{% endif %}
{# ── Content columns ──────────────────────────────────────────────────────── #}
{# Client summary card #}
{% if latest_clients %}
Clients
{{ sparkline_clients | safe }}
{{ latest_clients.total_clients }}
total
{{ latest_clients.wireless_clients }}↗ wireless
{{ latest_clients.wired_clients }}↔ wired
{% if latest_clients.guest_clients %} {{ latest_clients.guest_clients }} guest{% endif %}
{% endif %}
{# Infrastructure devices card #}
{% if devices %}
Infrastructure devices
{% for d in devices %}
|
{% set dot, label = device_state(d.state) %}{{ status_dot(dot, label) }}
{{ d.name or d.mac }}
|
{{ d.model or d.device_type or "" }} |
{{ d.ip or "" }} |
{% if d.state == 1 and d.uptime_seconds %}
|
up {{ d.uptime_seconds|duration }}
|
{% elif d.state != 1 %}
|
{{ label }}
|
{% endif %}
{% endfor %}
{% endif %}
{# Top talkers card #}
{% if top_clients %}
Top talkers
{% for c in top_clients %}
|
{{ c.hostname }}
{% if c.type == "wireless" and c.signal %}
{{ c.signal }}dBm
{% endif %}
|
{% set rx = c.rx_rate %}{% set tx = c.tx_rate %}
↓
{{ rx|rate }}
↑
{{ tx|rate }}
|
{% endfor %}
{% endif %}
{# WLAN SSIDs card #}
{% if wlan_latest %}
Wireless networks
| SSID |
Clients |
Score |
{% for w in wlan_latest %}
| {{ w.ssid }} |
{{ w.num_sta }} |
{% if w.satisfaction is not none %}{{ w.satisfaction }}%{% else %}—{% endif %}
|
{% endfor %}
{% endif %}
{# Speedtest card #}
{% if speedtest %}
Last speed test
{% if speedtest.download_mbps is not none %}
↓ DL
{{ "%.1f"|format(speedtest.download_mbps) }}
Mbps
{% endif %}
{% if speedtest.upload_mbps is not none %}
↑ UL
{{ "%.1f"|format(speedtest.upload_mbps) }}
Mbps
{% endif %}
{% if speedtest.latency_ms is not none %}
Latency
{{ "%.0f"|format(speedtest.latency_ms) }}ms
{% endif %}
{% if speedtest.server_name %}
via {{ speedtest.server_name }}
{% endif %}
{{ speedtest.run_at|ago }}
{% endif %}
{% if not latest_wan and not devices %}
No UniFi data yet. Check your host, username, and password in the plugin config.
{% endif %}