mld18/ioBroker.valloxSerial

Error when no humidity sensor is connected

OLFDB opened this issue · 0 comments

OLFDB commented

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;
}