Hello guys,
First of all thanks for this whole suite of software, it’s amazing.
Here is my setup :
Client MQTT → Broker Mosquitto ← Telegraf → InfluxDB 2 ← Grafana
Telegraf version : 1.37.2
InfluxDB version : v2.8.0
Here is my telegraf.conf content :
[agent]
debug = true
hostname = "telegraf"
[[inputs.mqtt_consumer]]
name_override = "mqtt_binary_switch"
servers = ["tcp://mosquitto:1883"]
topics = [
"monitoring/+/binary_sensor/+/state",
"monitoring/+/switch/+/state"
]
data_format = "value"
data_type = "string"
[[inputs.mqtt_consumer.topic_parsing]]
topic = "monitoring/+/+/+/+"
tags = "_/device/_/field/_"
[[processors.enum]]
namepass = ["mqtt_binary_switch"]
[[processors.enum.mapping]]
fields = [ "value" ]
[processors.enum.mapping.value_mappings]
ON = 1
OFF = 0
"on" = 1
"off" = 0
true = 1
false = 0
[[aggregators.final]]
namepass = ["mqtt_binary_switch"]
period = "3600s"
drop_original = false
keep_original_field_names = true
output_strategy = "periodic"
My problem : I’m using ESP32 on ESPHome to send periodic data via the MQTT component to a MQTT Broker. Binary sensors (those configured up there) are updated whenever they change. Most of them don’t change regularly (heatpump presets for example).
Let’s say one of those switch went from OFF to ON 10 hours ago, if I only display the last 6 hours I won’t see any value, because of Telegraf pulled the retained values when logging to the broker, but since it didn’t change since, it won’t display any data.
I fell upon the final aggregator, and while it has some downsides, I thought it could help sending the last data to InfluxDB to fill the gap for shorter display time range.
Logs show that the data is sent :
2026-03-24T05:59:26Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2026-03-24T05:59:36Z D! [outputs.influxdb_v2] Wrote batch of 77 metrics in 8.672816ms
2026-03-24T05:59:36Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2026-03-24T05:59:46Z D! [outputs.influxdb_v2] Wrote batch of 109 metrics in 8.175897ms
2026-03-24T05:59:46Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2026-03-24T05:59:56Z D! [outputs.influxdb_v2] Wrote batch of 82 metrics in 8.852907ms
2026-03-24T05:59:56Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2026-03-24T06:00:00Z D! [aggregators.final] Updated aggregation range [2026-03-24 06:00:00 +0000 UTC, 2026-03-24 07:00:00 +0000 UTC]
2026-03-24T06:00:06Z D! [outputs.influxdb_v2] Wrote batch of 131 metrics in 105.086984ms
2026-03-24T06:00:06Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2026-03-24T06:00:16Z D! [outputs.influxdb_v2] Wrote batch of 104 metrics in 52.062887ms
Yet, when I display a time range that does not include telegraf first connection to the broker (red points frames should return data) :
Any help would be much appreciated.

