I have installed the MQTT Grafana plugin and created a data source which connects to a local installation of a Mosquitto broker, which itself gets its data from a telegraf client.
This currently works fine. However, I am having trouble with the initial graph value.
I have set up a simple bar gauge which always displays the latest value. The sensor I am using only sends it’s data depending on how different the current measurement is from it’s predecessor. So sometimes it sends a value every second and other times every 10 to 20 seconds.
This means that if the sending frequency is currently rather low, a newly connected grafana client only sees “No data” for quite some time.
To solve this issue I first wanted to use the retained message MQTT feature, which always sends the last value upon a new client connection to the client. But since Grafana keeps a mqtt connection alive for longer/multiple grafana clients, this does not work.
My second idea was to use multiple queries since the sensor data is also saved in InfluxDB. Then I would use a transformation to somehow only get the latest value. However, this also does not work because the panel basically crashes, probably because it is a live panel and it tries to run the InfluxDB query to often.
I don’t want to update the whole dashboard every second, because some bigger queries take more than 3 seconds to load.
Does anybody have an idea for solving that issue. Is there maybe something like a Grafana MQTT buffer?
Thanks in advance!
Initial view: (up to 20s on first page load)
View with data: