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,7 +136,9 @@ def loop_body(opts, gstate):
if not "dish_{0}".format(category) in data:
data["dish_{0}".format(category)] = {}
data["dish_{0}".format(category)].update({key: val})
# 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})
def cb_add_sequence(key, val, category, _):