How do I can connect MQTT BROKER with NODE RED and show the device data in web browser

So I hope to be clear to you.
And I’m sorry to be boring.
So I need to show the information from temperature sensor or humidity sensor in a web page.
I’m not adding a mqtt client, I just want to show the info to node-red and that’s it.

Yes, you are. is an mqtt client and you are using to publish plain messages.

I showed you earlier how to get it done when simulating a lorawan package (and in the general case of a real lorawan device). But it seems that’s not what you want, you only care about sending a plain message to an mqtt broker and then subscribing to it from node-red. Correct me if I’m wrong, at least that’s what I get from your new attempt. That’s trivial and any mqtt client will work, but if that’s really what you want then it has nothing to do with lorawan or loraserver and thus doesn’t belong here.

Yes you’re correct, but that repository that I showed you has what I want which is the publising message to node.
So do you think that’s not correct?

That repo is an mqtt client, and so is, the one used in loraserver and my package. As so, it allows to publish messages to an mqtt broker (not to a device, not to node red, not to anything like that; other clients, such as node-red, may subscribe to topics at the same broker), which of course the other does too, e.g.:

if token := client.Publish(topic, 0, false, bytes); token.Wait() && token.Error() != nil {
		return token.Error()

To be honest, at this point I really don’t know what you want to achieve and so can’t answer that.

My idea is about everytime I send a package to my LoRa server the payloud sends data like temperature and humidity and I want to convert to decimal the temperature and humidity(I made this already) and shows in a web page and I think node red can helps me, I tested and works nice, but I want to send the package to lora which contains the same payloud that I publish in node red, to user/client see the information about my temperature for example?
This is for testing for in future build this with sensors and etc… Do you see my point?

In your repo, or your package as you can named what you want, if in you code I can add the topic it can connects to my node red and publish the playloud

The thing is you are pretty confused about mqtt and loraserver or you aren’t explaining it very well.

There’s no connecting a topic to node-red, that make no sense for mqtt. Node-red may subscribe to mqtt topics from a broker, and others may publish to those topics. Mqtt works by having a broker which handles clients that publish and subscribe to topics. There’s no direct “connection” between clients.

What my repo/package does is it publishes messages to topics as if they were sent from lora-gateway-bridge. Those get picked up by loraserver (which is subscribed to those topics), who process them and later lora-app-server publishes the decoded data on some mqtt topics (as described here). So if you want to get a device’s data at node-red, you need to subscribe to application/[applicationID]/device/[devEUI]/rx (with applicationID and devEUI changed to the real ones), not to some other topic that you invented at some program.

On the other hand, if all you want is to send some data by yourself, not using loraserver, then go ahead: have a client publish to whatever topic you want and subscribe to that exact same topic at node-red. That’s perfectly valid, but it has nothing to do with lora, lorawan or loraserver. Actually, node-red has nothing to do with them either, is just a tool to connect things and in this case to render your data.

It works :wink:

1 Like

Im trying to do the same but I’m new to chirpstack and I dont understand this very well.
What I dont undertand is where and how I have to create the topic. Do I have to create them via command or just put the line “application/[applicationID]/device/[devEUI]” in my chirpstack-gateway-bridge.toml?

Thank you so much in advice.

Seems like a straigth forward question :wink:
I have the same one!
So… I have a temperature sensor on a lora node. I get the data on and I can use a payload formater like this on the TTN network… Yeah I see my data, it’s temp+humidity

function Decoder(bytes, port) {
var humidity = (bytes[0] << 8) | bytes[1];
var temperature = (bytes[2] <<8) | bytes[3];

return {
humidity: humidity/100,
tempertaure: temperature/100

So I setup node-red and mqtt and I can pull the data to node red… I use topic #
Obviously topic # means it’s going to give me a whole lot of junk.

So I have made these sensors before, just local, wifi, direct to the mqtt and no ttn in between. Then I made nice graphs so I could keep track of whats going on. I understand how that works.

Now I want to send it over the TTN network… and still be able to dcode it on the other side…

@dicarva How did you set up MQTT please? I’ve been having a problem with this for a few days, I’m getting errors that I don’t understand where they’re coming from. I still can’t connect the MQTT to my server :frowning:
The captures below show what I did and the error I got. Your help please, I am really stuck

cap2 (1)

Hi, I have a slightly different problem, as I cannot parse the temperature. Via MQTT, I receive the JSON NodeRED object which includes:

“object”: {
“temperatureSensor”: {
“1”: 22.2
“humiditySensor”: {
“2”: 50


How can I decode the temperature value? I cannot find a way to properly parse (or ignore) the “1”.

Thank you!

It is a key in the object, e.g. object.temperatureSensor.1.