Fix for NaN values on startup that upset Javascript JSON decoders

This commit is contained in:
Dean Cording 2022-03-02 21:22:01 +10:00
parent 26437e00ea
commit 323fc26754

View file

@ -20,6 +20,7 @@ import signal
import sys
import time
import json
import math
try:
@ -135,6 +136,8 @@ def loop_body(opts, gstate):
if not "dish_{0}".format(category) in data:
data["dish_{0}".format(category)] = {}
# Skip NaN values that occur on startup because they can upset Javascript JSON parsers
if not ((type(val) == float) and math.isnan(val)):
data["dish_{0}".format(category)].update({key: val})