fix value display node

This commit is contained in:
2026-03-29 12:13:08 -07:00
parent 80b74dfdfd
commit e3c381ee07
9 changed files with 207 additions and 31 deletions

View File

@@ -31,6 +31,7 @@ from __future__ import annotations
import asyncio
import json
import logging
import math
import sys
from collections import defaultdict
from copy import deepcopy
@@ -205,6 +206,10 @@ def create_app(
value = payload
unit = ""
# JSON cannot encode non-finite floats; convert to string representations.
if isinstance(value, float) and not math.isfinite(value):
value = "" if value > 0 else ("-∞" if math.isinf(value) else "NaN")
data = {"node_id": node_id, "value": value}
if isinstance(unit, str) and unit.strip():
data["unit"] = unit.strip()