Mqtt sensor and influx DB storage

I have several MQTT sensors configured in my HASS install. I also have HASS configured to store their values in an InfluxDB. I do this so I can show data in Grafana. One of my sensors is a temp sensor that reports every 1 minute. I know it’s behaving properly as I have a stand alone MQTT probe that records all messages and I see entries for it being broadcast every minute.

The problem is when I query the InfluxDB for that sensor name, I don’t get entries every minute. The entries are seemingly at random intervals. I have other sensors that are more consistently stored every minute, but not always. Pretty much every sensor results in gaps of some sorts in the Grafana line charts and a manual InfluxDB query. The periods of gaps in the data don’t align for all sensors and the HASS logfile shows no InfluxDB access errors, so I know that’s not the issue.

Does anyone else see these issues? I’m not sure where to go to debug next.

The first thing to do is to use the command line tool to see if the data is stored in the database and therefore its a Grafana problem, or if the problem is getting the data into the database.

Home Assistant only pushes state *changes" to influxdb, that might be it. So only when the numeric state of a sensor changes, it will land in the DB.

1 Like

Home Assistant only pushes state * changes " to influxdb, that might be it. So only when the numeric state of a sensor changes, it will land in the DB.

Is there a way to change that behavior?

Background: I have a solar/battery operated sensor. In another application I read the last value from InfluxDB and use the timestamp to determine whether the sensor is still alive or not (sensor update interval is 5min, lates entry older than 20min == sensor dead). It would be nice to at least push a value into the DB every 15min.

MQTT sensors have the force_update parameter that does this. I’m not sure about other components.

1 Like