Skip to content

Latest commit

 

History

History
197 lines (183 loc) · 6.05 KB

CONFIGURATIONS.md

File metadata and controls

197 lines (183 loc) · 6.05 KB

Configuration Files

Each application module designed to work with configuration files for easier manipulation to server-side changes. A configuration file is named as config.json and stores necessary connection parameters which are designed for you to easily connect to the applications.

In this file, you can find example configuration files for each application module and their mandatory and optional parameters. This file must be placed on the root directory of PicoLTE module.

Table of Contents

  1. Amazon Web Services IoT Core
  2. Microsoft Azure IoT Hub
  3. Slack
  4. Telegram
  5. ThingSpeak™
  6. Native HTTPS
  7. Native MQTTS
  8. Configuration Files for Your Own Application Module

Applications

In this section, we're going to give you better understanding about how to create a config.json file for specific application modules.

Amazon Web Services IoT Core Configurations

You can select MQTTS or HTTPS protocol and delete the other attribute.

{
    "aws": {
        "mqtts": {
            "host": "[YOUR_AWSIOT_ENDPOINT]",
            "port": "[YOUR_AWSIOT_MQTT_PORT]",
            "pub_topic": "[YOUR_MQTT_TOPIC]",
            "sub_topics": [
                "[YOUR_MQTT_TOPIC/1]",
                "[YOUR_MQTT_TOPIC/2]"
            ]
        },

        "https": {
            "endpoint": "[YOUR_AWS_IOT_ENDPOINT]",
            "topic": "[YOUR_DEVICE_TOPIC]"
        }
    }
}

Microsoft Azure IoT Hub Configurations

Within this level of configurations, you can use Azure IoT Hub directly.

{
    "azure": {
        "hub_name": "[YOUR_IOT_HUB_NAME]",
        "device_id": "[YOUR_DEVICE_ID]"
    }
}

For more detailed configuration, you may want to use extra MQTTS parameters. Each attribute in MQTTS is optional.

{
    "azure": {
        "hub_name": "[YOUR_IOT_HUB_NAME]",
        "device_id": "[YOUR_DEVICE_ID]",
        "mqtts": {
            "host":"[YOUR_MQTT_HOST]",
            "port":"[YOUR_MQTT_PORT]",
            "pub_topic":"[YOUR_MQTT_PUB_TOPIC]",
            "sub_topics":[
                ["[YOUR_MQTT_TOPIC/1]",[QOS]],
                ["[YOUR_MQTT_TOPIC/2]",[QOS]]
            ],
            "username":"[YOUR_MQTT_USERNAME]",
            "password":"[YOUR_MQTT_PASSWORD]"
        }
    }
}

Slack Configurations

To connect Slack, only need is a WebHook URL, there is no more detailed attributes.

{
    "slack":{
        "webhook_url": "[INCOMING_WEBHOOK_URL]"
    }
}

Telegram Configurations

Within this level of configurations, you can use Telegram directly.

{
    "telegram": {
        "token": "[YOUR_BOT_TOKEN_ID]",
        "chat_id": "[YOUR_GROUP_CHAT_ID]"
    }
}

In case of future server URL changes in Telegram side, you may want to add server attribute as shown below.

{
    "telegram": {
        "server": "[TELEGRAM_BOT_API_ENDPOINT]",
        "token": "[YOUR_BOT_TOKEN_ID]",
        "chat_id": "[YOUR_GROUP_CHAT_ID]"
    }
}

ThingSpeak Configurations

Within this level of configurations, you can use ThingSpeak directly. Subscription and publish operations are made directly to all channel fields.

{
    "thingspeak": {
        "channel_id": "[YOUR_CHANNEL_ID]",
        "mqtts": {
            "client_id": "[DEVICE_MQTT_CLIENT_ID]",
            "username": "[DEVICE_MQTT_USERNAME]",
            "password": "[DEVICE_MQTT_PASSWORD]"
        }
    }
}

For better control on which fields to subscribe or publish, you may want to add extra attributes. Also, please note that host and port address can be change by its own attributes.

{
    "thingspeak": {
        "channel_id": "[YOUR_CHANNEL_ID]",
        "mqtts": {
            "host": "[THINGSPEAK_HOST_ADDRESS]",
            "port": "[THINGSPEAK_PORT_ADDRESS]",
            "client_id": "[DEVICE_MQTT_CLIENT_ID]",
            "username": "[DEVICE_MQTT_USERNAME]",
            "password": "[DEVICE_MQTT_PASSWORD]",
            "sub_topics": [
                ["[YOUR_MQTT_TOPIC]", [QOS]]
            ],
            "pub_topic": "[YOUR_MQTT_TOPIC]"
        }
    }
}

Modules

Some use-cases can be implemented by using modules when there is no spesific application for that use-case. In this situtations, the developers can built their own solutions with using HTTPS and MQTTS modules.

HTTPS Configurations

{
    "https": {
        "server": "[HTTP_SERVER]",
        "username": "[YOUR_HTTP_USERNAME]",
        "password": "[YOUR_HTTP_PASSWORD]"
    }
}

MQTTS Configurations

{
    "mqtts": {
        "host": "[YOUR_MQTT_HOST]",
        "port": "[YOUR_MQTT_PORT]",
        "pub_topic": "[YOUR_MQTT_PUB_TOPIC]",
        "sub_topics": [
            ["[YOUR_MQTT_TOPIC/1]",[QOS]],
            ["[YOUR_MQTT_TOPIC/2]",[QOS]]
        ],
        "username": "[YOUR_MQTT_USERNAME]",
        "password": "[YOUR_MQTT_PASSWORD]"
}

Configuration Files for Your Own Application Module

The most important feature that we've developed in PicoLTE SDK is the ability to create new applications for your specific services. Please refer to CONTRIBUTING.md guidelines. You need to follow standarts that we used to create an application configuration parameters.

This is the general structure of a config.json file:

{
   "your_own_app": {
       [application_specific_attributes],
       // If the connection made with MQTTS:
       "mqtts": {
           "host": "",
           "port": "",
           "pub_topic": "",
           "sub_topics": [
               ["", [QOS]],
               ["", [QOS]]
           ],
           "username": "",
           "password": ""
       },
       // If the connection made with HTTPS:
       "https": {
           "server": "",
           "username": "",
           "password": ""
       }
   }
}

In case of redundant parameter in MQTTS or HTTPS, you can remove it from the structure.