When the AM2315 returns bad values, these are currently set to NAN. The JSON returned from the REST API contains these values as nan, which is invalid because strings must be enclosed in quotes. Reading the JSON in R or Home Assistant fails with errors.
On my local compile, I've opted to replace the NANs with -999 and the JSON is parsed coreectly.
Another option would be to return null in place of the nan as null is valid JSON. I'm not sure whether this change should happen when the values are read or when the values are inserted into the JSON return.
When the AM2315 returns bad values, these are currently set to
NAN
. The JSON returned from the REST API contains these values asnan
, which is invalid because strings must be enclosed in quotes. Reading the JSON in R or Home Assistant fails with errors.On my local compile, I've opted to replace the NANs with -999 and the JSON is parsed coreectly.
Another option would be to return
null
in place of thenan
asnull
is valid JSON. I'm not sure whether this change should happen when the values are read or when the values are inserted into the JSON return.