HA rounds sensor's data revcieved via MQQT

Hi. It appears that HA rounds readings for all sensors shared via MQQT. For example, here are MQQT data sent to HA:


However, in HA the sensor reading is shown as rounded to the nearest whole. Is there a way to configure how HA ingest MQQT readings? Thank you.
image

It may appear that way, but it doesn’t.

It all depends on how you have configured the MQTT Sensor that is receiving the MQTT payload (note: it’s called MQTT, not MQQT).

Have you manually configured the MQTT Sensor or are you using MQTT Discovery?

I was using MQTT discovery

Did you define the parameters being used for MQTT Discovery or are you using some sort of integration that employs it?

If you defined them, post them. If you are using an integration, let us know which one.

NOTE
Either way, the rounding of the value is likely to be due to the inclusion of the round function within value_template.

No, I didn’t define anything. I have Mosquito up on HA and MQTT service on HE which shares devices. It started to work automatically.

I assume “HE” is Hubitat Elevation.

That means whatever software you are using on HE, to expose devices to Home Assistant via MQTT Discovery, is responsible for rounding the values (via how it defined the sensor’s configuration).

FWIW, I have numerous devices modeled as MQTT Sensors and their values are received, via MQTT Discovery, unadulterated by rounding or anything else (they aren’t coming from Hubitat).

See that first topic in your screenshot, the one that starts with the word homeassistant? Post its payload. That payload contains the sensor’s configuration.

name: Temperature Sensor - Garage_temperature
availability_topic: homie/hubitat/$state
payload_available: ready
payload_not_available: init
unique_id: Hubitat-MQTT:_temperature-sensor---garage-temperature
device_class: temperature
state_topic: homie/hubitat/temperature-sensor---garage/measure-temperature
unit_of_measurement: °C
value_template: '{{ value | round(0) }}'
device:
  identifiers: HE_184
  name: Temperature Sensor - Garage
  sw_version: pre 21 beta 3e
  model: hubitat
  manufacturer: Hubitat
platform: mqtt

hmm. it says round(0). but where is this configured?

There’s your answer as I had predicted. value_template contains a round(0). The developer of the application decided that the temperature value should be rounded. :man_shrugging:

You can either ask the developer to change that, or overwrite the topic’s payload, or manually configure an MQTT Sensor. The last two suggestions are impractical if you have many sensors.

Got it. You rock. Thank you very much.

Just a small addition. Indeed, the developer of HE app put round(0) right into the app code. Not sure why. But it was very easy to fix). Thank you again.

1 Like

Glad to hear that it helped to solve the problem.

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information refer to guideline 21 in the FAQ.