How to add a Button to send an MQTT command

Hello all I need some help.

I have created a dashboard that receives data from a sensor. Sends this data via MQTT to a database, which is then read by Grafana.
My question is…
Is it possible to add a button to Grafana. That can send a simple MQTT command to the sensor to either switch an LED on or Reset the device?

Thank you.

It seems there are not a panel with a button…

This could be a great idea to developers, allowing users to interact with the actuators…

This could help you…

But you have to make a request parser and convert it to a MQTT message. It is not difficult, but at the moment this is what’s available at the moment.
I found this awesome panel, but I did not try it.
I think it is what you are looking for:

i am also at the quest to find a button for Grafana, the plugin geeks-r-us/mqtt-panel , it does not connect with the brocker and i dont know where else to look.

Any update? I’m interested in it, too.
I’m using windows 10. Could you please explain how to install this mqtt plugin?

Assuming the Button Panel still works, you could set that up to send a JSON payload carrying the MQTT command to the sensor (which then populates the database, which is then read by Grafana). I think you could set up a simple flow in Node-RED to accomplish this. Check out their forum for ideas.

Thanks, I already know and use node-red. From Grafana side, this Button Panel I see it supports GET and POST HTTP. I would try to install this MQTT panel geeks-r-us/mqtt-panel. But I don’t understand how to do it.
The problem is that I need to run Grafana on a server and then use mqtt since my device LAN is under NAT and not reachable from outside

In case if you are still looking for how to install this MQTT plugin.

This is what I did.

  1. Using ‘wget’ download this ( zip file.

  2. Unzip it.

  3. place it in the designated plugin folder. For linux it is: /var/lib/grafana/plugins/

  4. As it is an unsigned plugin, you have to set the config file to allow it.
    Open the /etc/grafana/grafana.ini file. Then find [plugins]. Under it change as

    allow_loading_unsigned_plugins = geeksrus-mqtt-panel

note: in case if you have multiple unsigned plugins, you have to put them inside double-quote.

allow_loading_unsigned_plugins = “plugins-one, plugins-two”

Restart the grafana. You should see the plugin.

Hope it will work.


Thanks a @ sendaird
that you know, can I use mqtt data on the fly, or I need first to store them in a database?

I haven’t still reached that far yet. Just installed the plugin. I am also new in this area. May need to use WebSocket as someone suggested elsewhere.

From this page it seems that live-data can be visualized in Grafana (version 8) on the fly. But I haven’t tried it. It needs some additional installation which I haven’t done yet.

Could you please share here if you progress in this matter?

Till now I have used MySQL with pseudo data to see how Grafana works basically.


Thanks, I was able to install and place a button on my dashboard, however the parameters are not clear. I was never able to send anything to my MQTT broker on the same network.
And, the design of the button is “limited” to say at least :wink:

I was able to do it the Node-Red-way, however the integration of a action onto a Grafana button is not possible, or did I miss something? I added an iframe containing a node-red-panel. A rather brutal way :wink:

This topic was automatically closed after 365 days. New replies are no longer allowed.