I have ZigBee power outlet with temperature reporting and writing a custom DH for it. I have copy pasted some code from a temperature sensor and this is working fine, but with no decimal. I would like the device to report “25.4C” rather than just “25C”.
Code looks like this:
> def getTemperature(value) {
> log.debug "Temperature raw: $value"
> def celsius = Integer.parseInt(value, 16).shortValue() / 100
>
> if(getTemperatureScale() == "C"){
> return Math.round(celsius)
> } else {
> return Math.round(celsiusToFahrenheit(celsius))
> }
> }
The raw temperature logged looks like this: 2653
How can I correctly return 26.5C?
Kind regards