Searching...

Matching results

    How to use the MQTT Connector

    Integrate and extend your AirVantage platform

    Here we give you an overview of what you can do with the AirVantage Cloud Connector via a simple use case: Connecting your system to MQTT Broker and getting raw data from your MQTT topic.

    We’ll explain all the technical aspects needed for a robust, secure & reliable interface:

    • principles & best practices
    • configuration & authentication
    • how to get messages

    Principles

    This section explains when and why to use the Cloud connector, what it is and the available options.

    Introduction

    The MQTT Cloud Connector provides:

    • message notifications from AirVantage
    • Routing mechanism
    • Robust messaging for applications
    • High volume messaging
    • Runs on all major operating systems
    • Open source libraries for several common languages (java, c#, python, PHP, …)

    Parameters

    When you connect AirVantage to an MQTT broker, you have to define the type of notifications you want: operations, data, alert or usages.

    Configuration

    This section explains how to configure your client to be robust, reliable and secure. Please read carefully this section in order to supply correct information to enable the end point on the AirVantage side.

    What can I use?

    You can use any MQTT broker like Mosquitto or any broker embedded in a Cloud Platform like cloudMQTT .

    In this tutorial, we will send messages to Mosquitto.

    Prerequisites

    Mosquitto supplies a MQTT broker open to the community but they use it for tests.

    MQTT Broker Configuration

    Supply the following information using the CRM and select Request Support:

    • MQTT without SSL or with SSL
    • Username and password
    • Hostname and port number
    • Topic where to publish messages
    • Kind of messages you want to receive:
      • Alert event: any alert rule triggered will be send
      • Operation: any operation state will be sent (creation, progress, success or failed)
      • Usages: any SIM usage
      • New message sent by the device: any device incoming communication
        • Optionnaly you can supply the data path to whitelist the data (only the values for these data will be sent in the data stream). To get the data path for a data, you can go to the timeline to view the data path in the tooltip like in the screenshot below:

    In this tutorial, we use the following broker information:

    • hostname: test.mosquitto.prg
    • port: 1883 (or 8883)
    • No user or password
    • A topic named analytics)

    Get the messages

    This section explains how to consume the messages from a MQTT Broker using MQTT Lens.

    Step 1. Create a new connection in MQTTLens.

    Step 2. Configure your connection to your MQTT Broker.

    • Fill the hostname and port number.
    • Click on Create

    Step 3. Susbcribe to the topic (analytics in this example)

    Step 4. In AirVantage, push a data, generate an alert (based on the label creation condition) or create an operation according to what kind of message has been activated.

    Step 5. According to the messages the queue has subscribed to, you can:

    • Create a new operation by adding/removing a label on your system
    • Send a data to AirVantage from your device in order to have new messages
    • Create a new alert rule in Configure > Alert rules. You can raise an alert based on a new label added to your system, based on a new data value
    • Open and close a session using your SIM card

    You can see your messages like in the screenshot on the right.

    TOP