Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAN handling creates invalid JSON #21

Open
ConorIA opened this issue Apr 10, 2020 · 0 comments
Open

NAN handling creates invalid JSON #21

ConorIA opened this issue Apr 10, 2020 · 0 comments

Comments

@ConorIA
Copy link

ConorIA commented Apr 10, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant