Access to the MQTT broker
Home › Forums › Conduit: mLinux Model › Access to the MQTT broker
Tagged: conduit mqtt paho
- This topic has 7 replies, 4 voices, and was last updated 6 years, 5 months ago by chris parrish.
-
AuthorPosts
-
May 18, 2016 at 3:01 pm #12570DaveParticipant
We have an existing application (written in C++) that we deploy on our own proprietary device, which is used in the Oil & Gas industry to monitor and control remote assets. With a few modification, we have been able to deploy and run our application on your Conduit Gateway. However, to take full advantage of the Conduit, we will need to add additional functionality to our application. Specifically, we would like our application to receive and send data to your mDot modules. From my initial research, I think the easiest way to do this, would be to have our application send message to, and recieve message from your mDot modules through the Conduit’s MQTT broker. Is that reasonable? If so, do you have an API that can be used to send and receive message from your MQTT broker? If not, do you have another suggestions?
Thanks.
May 18, 2016 at 3:31 pm #12582Bryan TranModeratorHi Dave,
There are many ways to do this:
a. I created a couple of examples that echo the data received back to the end node both in C++ and python. They are on github.com account.
Python:
https://github.com/trong63/python_mqtt_sample
C++:
https://github.com/trong63/mqtt_sample
b. http://www.multitech.net/developer/?s=lora-sample
Thanks,
BT
May 25, 2016 at 3:35 pm #12733DaveParticipantThat helped. Thanks!
Is there a way to connect to the Conduit’s MQTT server using an external tool? I’ve been trying to use some of my own tools and also Paho Client but I keep getting “Connection refused”.
Dave.
May 25, 2016 at 3:41 pm #12734Bryan TranModeratorHi Dave,
Conduit:
——–Note: Assuming the Conduit IP address is at: 192.168.2.1
Assuming the remote PC IP address is at: 192.168.2.21. ssh into the Conduit and go to /etc/mosquitto and modify the mosquitto.conf with the following:
#bind_address 127.0.0.1 <–Put a hash sign infront of this line to commented it out.
2. Save and exit.
3. Then type: /etc/init.d/mosquitto restart <–Restart the moquitto
Remote PC:
———-1. Install the mosquitto software – http://mosquitto.org/download/
2. mosquitto_sub -t lora/+/+ -v -h 192.168.2.1
Then on the mDot – Send some data – You should see it shows up on your remote PC.
Thanks,
BT
May 25, 2016 at 3:49 pm #12735DaveParticipantAwesome! Thanks for the quick reply!!
May 27, 2016 at 12:02 pm #12774DaveParticipantThings have moved along quite well. I’ve got my app receiving msgs from an mdot, running in demo mode, via the mqtt broker but I’m just a little confused about the messages I’m seeing.
When I send a message from the mdot, I get two messages showing up on the broker: one on the ‘lora/<devid>/packet_recv’ topic and another on the ‘lora/<devid>/up’ topic. It looks like the data I’m interested in is the message coming from the ‘../up’ topic. Decoding the ‘data’ element of the json, seems to give me the data values shown on my mdot’s display. Is this correct? If so, what is the purpose of message that shows up on the ‘../packet_recv’ topic?
Also, the mdot I have is publishing a pressure value, which, according to your web site is the pressure scaled as ‘0.25 kPa (Signed MSB)’. However, when I look at the data value I’m getting from the message, i.e.:
“data”: “DgAAEAgFbxgFAAALAZA=”
it translates to byte array ‘0e 00 00 10 08 05 6f 18 05 00 00 0b 01 90’. I’m assuming the pressure reading are the bytes: ’08 05 6f 18′ (0x08 = pressure type, 0x056f18 = value). When I convert this to an integer value, I get 356120. Multiplying this by 0.25, I get 89030. However, this looks like Pa, not kPA, since the value shown on my mdot’s display is 89.03 kPa. Is this correct? Or am I completely off base?
Thanks,
Dave.June 12, 2016 at 2:13 pm #13010Ashu JoshiParticipantDave – take a look at this question: http://www.multitech.net/developer/forums/topic/encryption/
The data is encoded in Base 64.
June 7, 2018 at 5:03 pm #23759chris parrishParticipantThanks; just what I needed. Running Paho on Python.
-
AuthorPosts
- You must be logged in to reply to this topic.