[Release] Konke ZigBee Temperature Humidity Sensor Driver

Not sure if @muxa is around any more, but apparently we are supposed to be reporting humidity as an integer in Hubitat, not a decimal. As the system is assuming integer, it will break things like simple automation rules and basic rules if it reports as a decimal.

If you are still updating this driver, may want to make that change when there is time.

See this thread.

I changed my copy of the driver to this to make it "compliant". Basically just added a new int humidityInt, and then used that in the report. Sloppy way to do it, but it worked and I didn't feel like modifying it any more than that.

// Calculate humidity with 0.1 precision
private parseHumidity(valueHex) {
	float humidity = Integer.parseInt(valueHex,16)/100
	displayDebugLog("Raw reported humidity = ${humidity}%")
	humidity = humidityOffset ? (humidity + humidityOffset) : humidity
	humidity = humidity.round(1)
    int humidityInt = Math.round(humidity)
	return [
		name: 'humidity',
		value: humidityInt,
		unit: "%",
		descriptionText: "Humidity is ${humidityInt}%",
	]
}
3 Likes