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: