[ST Edge] Relative humidity default handler precision problem

Hello everyone,

I’m new on this forum but I’ve been developing on SmartThings platform for some time.

I have a problem (or rather enhancement suggestion) with default relative humidity handler. The default implementation (the one being injected by defaults.register_for_default_handlers) cuts the precision of the humidity value. It is not a case for temperature. I analyzed the default handler code and it seems to be intentional. The rounded humidity is presented in the app with one decimal place but always ‘0’ (e.g. 42.0% instead of 42.1%).

The default handler method for humidity looks like this:

function relative_humidity_measurement_defaults.humidity_attr_handler(driver, device, value, zb_rx)
  device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, capabilities.relativeHumidityMeasurement.humidity(utils.round(value.value / 100.0)))

while the temperature measurement does not round the value:

function temperature_measurement_defaults.temp_attr_handler(driver, device, value, zb_rx)
  local raw_temp = value.value
  local celc_temp = raw_temp / 100.0
  local temp_scale = "C"
  -- All events from drivers should be in celsius and without offset manipulation
  device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, capabilities.temperatureMeasurement.temperature({value = celc_temp, unit = temp_scale }))

I have tested my own implementation of the humidity_attr_handler without rounding the value and the app presents the correct value.

Would it be possible for dev team to remove the “utils.round()” for humidity default handler so we can use the default implementation whenever possible?
Zeigbe Class Library defines the humidity precision as 0.01% and SmartThings app as well as some temperature/humidity sensors support 0.1% with no problem.
Removing the rounding would make it possible to use default handler instead of writing our own handlers only to support such sensors.

Welcome to the SmartThings Community, @hmorsti!
I will share your comments with the engineering team and let you know their feedback.
Thank you for your input in regard to helping us improve the development tools.

Hello @nayelyz,

Thank you for sharing my suggestion. I’m looking forward to hear the results!