Skip to content

NAN handling creates invalid JSON #21

@ConorIA

Description

@ConorIA

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions