MQTT Integration to send events to remote MQTT Server


Maybe a simple question. I’m using a MQTT instanz with running INfluxDB and Grafana to show some measurements from some ESP32 and Raspis via WLAN… No i would like to see the events comming via LoRa on the same machine transmitted via MQTT.

Can i simple change the mqtt config inside " chirpstack-application-server.toml" to direct to my Grafana-MQTT instanz.? Without breaking everthing in chirpstack, because i’ve read that chirpstack is using MQTT for internal connections…

Thanks in advance…


depends what you are “redirecting”. Please refer to the architecture.
The application-server already supports an Influxdb integration, I think the new version even supports v2.
I dont know how your Grafana+MQTT Combo looks like, and if it’s decoding the payload for you and if it can work with application-server Up-Events.

If you are thinking of redirecting/forwarding the gateway traffic there, I’m sorry to disappoint you, but that will not work. You need something like a network-server/app-server or something holding the keys for the communication with the node.

Technically you are correct with “they are coming over LoRa”, but the messages and everything else follows the LoraWAN spec. Which is more like a “protocol” on top of LoRa. So what you are looking for is to integrate after all the LoRaWAN stuff has happen, which is when the app-server publishes to an mqtt broker/integration. That can be a totally different broker as the one used for the gateway-bridge/network-server. It’s just another integration the app-server provides. The communication between app-server and network-server is over gRPC.

My MQTT+Influx+Grafana System is completely independent from the system. It is running on it’s own virt. machine.
The Chirpstack machine is another virt. machine and on the “builtin” MQTT i can see with a MQTT client the application messages and see my sensor data. But i need that data on the MQTT instance on the “grafana… system.” Thats my question. Can i change the MQTT server address in chirpstack-application-server.toml from localhost to the DNS name of my “grafana” system…And will i receive only the application messages and nothing else from the inner system of ChirpStack…?

Yes you can. You will get all the EVENTS that way. Depending which marshaler you are using, you might need to just parse json and subscribe to the right application topic. You can also send downlinks that way too, and the app-server will schedule them.

1 Like

Very good. Take a look @ my screenshot. The next i’ve to learn, how i can switch contacts via LoRa… Is it that what you mean with downlinks…??

Yes. I’m waiting on Lora Relay 30A Module| Makerfabs for more or less the same use-case.
You can use the mqtt plug-in (websockets) or the http-plug in, you might need to configure CORS on the Chirpstack-side (HTTP) to be able to use a “Button” from the grafana-ui to chirpstack. If it’s over MQTT you just need websockets support from your broker. You then schedule a downlink and with the next uplink (Class A Devices) the device will get your payload and do what you/the sensors is programmed to do.

“Button” on Grafana"
Are you using the latest grafana8? I’ve seen an announcement, but i’m not sure to upgrade to it…

Hello! i would appreciate it if you can help me to direct my chirpstack mqtt to grafana…i’ve been trying to do it for a while and i haven’t succeed yet


I’m getting the data from CS with the Influx integration direct into my influx2db, as you can see here…

i succeed to integrate influxdb. I would like to know how to visualize data in grafana and how did u subscribe mqtt on it? I don’t really understand their relations and link (between CS, influx, grafana…), i appreciate it if you could explain, that would be really helpful!

Grafana gets its data only from out of the influxdb. I’ve 2 Buckets. One for data comming from Chirpstacks LoRaWAN via Integration, and the other is read by Telegraf out of the Chripstack MQTT, that i use for wired MQTT clients. Mostly Raspi and ESP32, connected on WLAN.

The moment i have the data in the Influxdb, i can create with the Influx script editor the query for grafana8…

For example:

from(bucket: “lorawan”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“dev_eui”] == “0018b200000********”)
|> filter(fn: (r) => r["_field"] == “latitude” or r["_field"] == “longitude”)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: “mean”)

Do you have already connected grafana with its own token to Influxdb??

No. I haven’t do it yet. But what i’m trying to do is, to have an environment that send data through MQTT, like the title of the topic right now. to send data via MQTT from chirpstack to influxDB, and visualize data of influxDB on grafana.

Thats exactly my setup… Where to start now…?

Sorry for the late reply, i’ve been caught up with some other work. So, as for me i decided to write a python mqtt client and get the data, parse the data and get those different data (co2, temperature…).

  1. I succeed in writing it to influxdb too, but instead of putting it in different measurements, i put them all in one measurement but in different fields…but in this way, i couldn’t query the data from grafana, couldn’t choose the right field using influxdb version 1.6.4 and language influxQL. i guess with Flux we can? like u did?

  2. So, im creating different measurement for those data. its query-wise i guess.

On my sytem i get for every data one measurement. See screenshot…