Fix for NaN values on startup that upset Javascript JSON decoders
This commit is contained in:
parent
26437e00ea
commit
323fc26754
1 changed files with 4 additions and 1 deletions
|
@ -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})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue