From 3129bf22d66c00f1486f371491e97e3ca47d49b3 Mon Sep 17 00:00:00 2001 From: quimnut Date: Sun, 15 Sep 2024 07:51:26 +1000 Subject: [PATCH 1/2] check for number before rounding on temps --- templates/static/node.html.j2 | 6 +++++- templates/static/telemetry.html.j2 | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/templates/static/node.html.j2 b/templates/static/node.html.j2 index 0343f10..38e426b 100644 --- a/templates/static/node.html.j2 +++ b/templates/static/node.html.j2 @@ -40,7 +40,11 @@ {% if node.telemetry.temperature %} Temperature - {{ node.telemetry.temperature | round(1) }}°C + {% if node.telemetry.temperature is number %} + {{ node.telemetry.temperature | round(1) }}°C + {% else %} + {{ node.telemetry.temperature }} + {% endif %} {% endif %} {% if node.telemetry.humidity %} diff --git a/templates/static/telemetry.html.j2 b/templates/static/telemetry.html.j2 index 81f5b40..30ddde3 100644 --- a/templates/static/telemetry.html.j2 +++ b/templates/static/telemetry.html.j2 @@ -170,7 +170,11 @@ {% if item.payload.temperature is defined %} - {{ item.payload.temperature | round(2) }} °C + {% if node.telemetry.temperature is number %} + {{ node.telemetry.temperature | round(2) }}°C + {% else %} + {{ node.telemetry.temperature }} + {% endif %} {% endif %} From 97394401b500945ddbbb8e7f480cfffca963807e Mon Sep 17 00:00:00 2001 From: quimnut Date: Tue, 17 Sep 2024 06:00:51 +1000 Subject: [PATCH 2/2] use correct var --- templates/static/telemetry.html.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/static/telemetry.html.j2 b/templates/static/telemetry.html.j2 index 30ddde3..8eeb303 100644 --- a/templates/static/telemetry.html.j2 +++ b/templates/static/telemetry.html.j2 @@ -170,10 +170,10 @@ {% if item.payload.temperature is defined %} - {% if node.telemetry.temperature is number %} - {{ node.telemetry.temperature | round(2) }}°C + {% if item.payload.temperature is number %} + {{ item.payload.temperature | round(2) }}°C {% else %} - {{ node.telemetry.temperature }} + {{ item.payload.temperature }} {% endif %} {% endif %}