MQTT Sensor Json misses values

I have the problem that my temperature sensor (tasmota running on it) is sending multiple values and some time HA misses one of them.

The JSON that I send looks like the following

{"StatusSNS":{"Time":"2017-08-20T08:24:06", "DHT22":{"Temperature":16.6, "Humidity":99.9}, "TempUnit":"C"}, "Vcc":3.066, "Bootcount":1}

I configured 3 sensors to catch temperature, humidity and VCC.

Config:

- platform: mqtt
  name: dht_221_esp_garden_temperature
  state_topic: "/home/garden/temperature_dht22_1/stat/STATUS10"
  unit_of_measurement: "C"
  value_template: '{{ value_json.StatusSNS.DHT22.Temperature }}'
- platform: mqtt
  name: dht_221_esp_garden_humidity
  state_topic: "/home/garden/temperature_dht22_1/stat/STATUS10"
  unit_of_measurement: "%"
  value_template: '{{ value_json.StatusSNS.DHT22.Humidity }}'
- platform: mqtt
  name: dht_221_esp_garden_voltage
  state_topic: "/home/garden/temperature_dht22_1/stat/STATUS10"
  unit_of_measurement: "%"
  value_template: '{{ ((float(value_json.Vcc)/3.3)*100)|round(1) }}'

And the result currently loooks like that:
Temperature:
image

Humidity:
image

VCC:
image

According to the logs the messages were delivered (as expected) every 30 minutes. Problem is that HA seems to regularly miss some values. Is there any known problem with the mqtt sensor or do I need to change anything in my config in order to improve the reliability of HA.

You may be seeing that if consecutive readings are the same, by default HA does not record the second one.

To fix this add

   force_update: true

to each sensor, which records every value.

Thank you - that seems to have fixed the issue.

1 Like