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

Error when no humidity sensor is connected #3

Open
OLFDB opened this issue Jul 12, 2020 · 0 comments
Open

Error when no humidity sensor is connected #3

OLFDB opened this issue Jul 12, 2020 · 0 comments

Comments

@OLFDB
Copy link

OLFDB commented Jul 12, 2020

When no humidity sensor is connected there is an error

Unable to change state of Readings.humidity: Error: undefined is not a valid state value

Always return a value in decodeHumidity, e.g.

**
* Relative humidity values need to be according to the formula
* (value - 51) / 2.04 and it will result in a value between 0%
* and 100%.
* @param reading the encoded humidity value
*/
public static decodeHumidity(reading: number): number | undefined {
let result = (reading-51) / 2.04;
return ((result>=0) && (result<=100)) ? result : 0;
}

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