Skip to content

Commit 925ddf0

Browse files
author
Dennis Braun
committed
Fix speedtest color: use Fritz!Box connection_info as fallback for booked speed
When booked_download/booked_upload settings are not configured (default 0), fall back to connection_info.max_downstream_kbps/max_upstream_kbps from Fritz!Box. This ensures the speedtest card shows correct colors without requiring manual settings entry.
1 parent 2b0a729 commit 925ddf0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

app/templates/index.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,8 +1010,11 @@
10101010
{# ── Card 4: Speed (Speedtest Tracker) ── #}
10111011
{% if speedtest_configured and speedtest_latest %}
10121012
{# Compute speed health based on booked speed: >=80% good, 50-80% warn, <50% crit #}
1013-
{% if booked_download and booked_download > 0 %}
1014-
{% set dl_ratio = speedtest_latest.download_mbps / booked_download %}
1013+
{# Use booked speed from settings, fall back to Fritz!Box connection_info #}
1014+
{% set eff_booked_dl = booked_download if (booked_download and booked_download > 0) else ((connection_info.max_downstream_kbps // 1000) if connection_info and connection_info.max_downstream_kbps else 0) %}
1015+
{% set eff_booked_ul = booked_upload if (booked_upload and booked_upload > 0) else ((connection_info.max_upstream_kbps // 1000) if connection_info and connection_info.max_upstream_kbps else 0) %}
1016+
{% if eff_booked_dl > 0 %}
1017+
{% set dl_ratio = speedtest_latest.download_mbps / eff_booked_dl %}
10151018
{% if dl_ratio >= 0.8 %}
10161019
{% set speed_health = 'health-good' %}
10171020
{% set dl_val_class = 'val-good' %}
@@ -1026,8 +1029,8 @@
10261029
{% set speed_health = 'health-good' %}
10271030
{% set dl_val_class = 'val-good' %}
10281031
{% endif %}
1029-
{% if booked_upload and booked_upload > 0 %}
1030-
{% set ul_ratio = speedtest_latest.upload_mbps / booked_upload %}
1032+
{% if eff_booked_ul > 0 %}
1033+
{% set ul_ratio = speedtest_latest.upload_mbps / eff_booked_ul %}
10311034
{% if ul_ratio >= 0.8 %}
10321035
{% set ul_val_class = 'val-good' %}
10331036
{% elif ul_ratio >= 0.5 %}

0 commit comments

Comments
 (0)