MQTT sensor value when network disconnected

I made three of BruhAutomation’s MQTT Multi Sensors (link) and have them reporting to a Mosquitto MQTT server which feeds into Home Assistant. They work great except for when they become disconnected from MQTT because of a network issue or because I moved one around.

When they are disconnected from MQTT, the value reported in Home Assistant seems to go to -17.8 deg. C.or 0 deg. F (the sensor is natively reporting in Farenheit). I’m not sure if this is a Home Assistant thing or an MQTT thing but I would like to stop it from happening if possible. I would like the temperature line to be discontinous rather than bottom out to 0 deg. F anytime I disconnect it or there’s a network issue… Can anyone tell me how I can achieve this?


Thanks in advance for any assistance.

As you point out, there are two possibilities, either an MQTT message is being sent with a value of 0 or HA is making one up.

To see if an MQTT message is being sent, you need to snoop the MQTT messages with a tool such as mosquitto_sub to look at all the messages being sent

$ mosquitto_sub -v -t "#"

You may need to add user, password and hostname parameters to this, depending on your set up. If you find a message being sent at some point, you will have to investigate the code on the sensor to see when and why it does this.

If you find there is no message being sent, then you can adjust the logger settings in the HA configuration.yaml to see what is happening internally with HA to create the entry.