Home Assistant missing some MQTT messages

Hi all,

I have the following setup reporting temperature/humidity every 10 minutes:

Screen Shot 2020-05-13 at 6.37.37 PM

With full details on the sensor hardware/software over here.

In configuration I have:

sensor attic office:
  - platform: mqtt
    state_topic: "attic/office/temperature"
    name: "Attic Office Temperature"
    unit_of_measurement: "°C"
  - platform: mqtt
    state_topic: "attic/office/humidity"
    name: "Attic Office Humidity"
    unit_of_measurement: "%"

influxdb:

I am running mosquitto and influxdb locally with no changes to their default configuration. MQTT broker is configured through the UI.

After some deep debugging of the hardware and software I have confirmed that the ESP8266 device never misses a reading, and neither does the MQTT broker.

Therefore, I am seeing dropped messages between the MQTT broker and Hass.io:

Screen Shot 2020-05-13 at 6.31.17 PM

I have confirmed this by:

  1. Subscribing to the MQTT server and successfully receiving the message
  2. Not seeing the message in InfluxDB
  3. Not seeing the message in Lovelace UI

Here is an example:

image

Shows a missing reading around 11:18

Manually subscribing to the MQTT broker shows the missing reading at 11:17:

2020-05-13T10:58:53+0100 attic/office/temperature 18.60
2020-05-13T11:08:24+0100 attic/office/temperature 18.50
2020-05-13T11:17:57+0100 attic/office/temperature 18.50
2020-05-13T11:27:29+0100 attic/office/temperature 18.30

Lovelace UI shows:

Screen Shot 2020-05-13 at 6.26.40 PM

with the next reading skipping the 11:17 message:

Screen Shot 2020-05-13 at 6.26.43 PM

So something is going wrong within Hass.io to not record that message internally or to the influxdb.

As I’m new to Hass.io does anyone have any tips on how I can go about debugging this? I’m happy to noodle through code but wanted to know if anyone else has had this issue or what could cause this?

I’m running mosquitto, influxdb and hassio on an Intel NUC with plenty of capacity, so it shouldn’t be resource constrained. I can’t find any errors in .homeassistant/homeassistant.log

Thanks,

A

Here’s my guess:

At 11:18 the value was 18.5 which is the same value as the previous one (at 11:08) so there’s no state-change involved. The subscribed entity (Attic Office Temperature) simply maintains its existing value at 11:18.

1 Like

@123 I think you have it. I’ve checked historically and this seems to match up. Turns out Hass.io was the smart one not me! I couldn’t see this functionality in the documentation - maybe I missed it - but might be worth adding in case others see it.

This is great actually as it motivates me to update my sensor code to only push a reading when it changes, saving on battery life.

Thanks for sharp eyes!

1 Like

Hello,
I am facing the same issue. On Node-Red, I am waiting a state change from my motion sensors. It works great, but if my sensors trigger multiple time an “on” occupancy event on MQTT, only there first one is transmit to other node, followings “on” event are filtered.
If there is an “Off” envent, then a new “on” even, the “on” event is well transmitted, but other are filtered.
I already uncheck this checkbox on node red: “Ignore state change event when: Current State Equals Previous State”, but there is no changes, it seems that Home Assistant is already “filtered” duplicated event.

What the trick to transmit every event to node-red, without any filter from home assistant ?

It’s not a “filter”. If the received value is the same as the current value, there’s no state-change. ‘on’ to ‘on’ isn’t a change of state. All of this was explained in the Solution post.

Yes, I get it. I would like to know if there is a way to get through this thing. I would like every MQTT message
I would like all mqtt messages to be forwarded to Node-Red. Preferably through the Home-Assistant integration, because the naming of the entities is very convenient.

Home Assistant’s MQTT integration behaves like its other integrations (consecutive identical values don’t cause a state-change).

The only way to receive every published MQTT payload, even if it’s identical to the previous one, is with an MQTT Trigger in an automation. However, that only for receiving the payload and it’s left up to you to decide what to do with it. Effectively, an MQTT Trigger is sort of like an “mqtt in” node in Node-Red.

Can you not subscribe directly to the topic from node-red?