Access to the MQTT broker

Home Forums Conduit: mLinux Model Access to the MQTT broker

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #12570
    Dave
    Participant

    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.

    #12582
    Bryan Tran
    Moderator

    Hi 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

    #12733
    Dave
    Participant

    That 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.

    #12734
    Bryan Tran
    Moderator

    Hi 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.2

    1. 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

    #12735
    Dave
    Participant

    Awesome! Thanks for the quick reply!!

    #12774
    Dave
    Participant

    Things 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.

    #13010
    Ashu Joshi
    Participant

    Dave – take a look at this question: http://www.multitech.net/developer/forums/topic/encryption/

    The data is encoded in Base 64.

    #23759
    chris parrish
    Participant

    Thanks; just what I needed. Running Paho on Python.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.