How to connect to QIoT Suite using MQTT over WebSockets?

In this tutorial, you will learn how to connect to QIoT Suite using MQTT over Websocket.

 

Refer to the following tutorial to learn how to connect different development boards to QIoT Suite: https://www.qnap.com/go/how-to/tutorial/qiot-suite-lite

Refer to the following link to learn how to establish IoT Application and Things: https://www.qnap.com/go/how-to/tutorial/article/how-to-show-dht11-data-on-qiot-dashboard

You can also consult the QNAP GitHub at https://github.com/qnap-dev/qnap-qiot-sdks

 

In this tutorial, you will learn how to connect to QIoT Suite using MQTT over Websocket.

Open IoT Applications to get MQTT settings

Open your IoT Applications and go to your Things.

Click the "Connect a Device" button.

Choose "MQTT" and click "Next".

 

Click "Download JSON file". The name of the file will be "resourceinfo.json".

 

* More information about "resourceinfo.json"

 

The following is an example code from resourceinfo.json:

{
    "username": "e425a3bf2f1a40ff80",
    "myqnapcloudHost": "Not Available",
    "clientId": "rpi2_1567396619",
    "host": [
        "172.17.30.44"
    ],
    "password": "r:7bbdefb8ba84ebeaba",
    "port": 21883,
    "resources": [{
        "description": "",
        "datatype": "Float",
        "resourceid": "temp",
        "topic": "qiot/things/admin/rpi2/temp",
        "resourcename": "temp",
        "resourcetypename": "Temperature",
        "unit": "°C"
    }]
}

 

Reference:

host” : The NAS IP

myqnapcloudHost”: If you connect the myqnapcloud DDNS services on your NAS and it will provide an Internet hostname that can connect to QIoT Suite. If your encounter issues with ports, then refer the following article: https://qiot.qnap.com/blog/en/2017/09/21/solve-problem-using-different-port-qiot-suite-lite-v1-0-41/

 

port”: Please skip this port number in config and use http(WebSocket) or https(WebSocket Secure) port number, follow this ->

clientId”: Devices identifiers.

username”: The MQTT username.

password” : The MQTT password.

resources”: Information of resources, including the following:

description: QIoT resource description.

datatype: QIoT resource data types.

resourceid: QIoT resource identifiers.

topic: The MQTT topic to publish and subscribe.

resourcename: QIoT resource names

resourcetypename: QIoT resource type names.

unit : QIoT resource units.

Type of Connection:

Connection”:

Username: <username>

Password: <password>

Client ID: <clientId>

 

"Publish":

Topic: <topic>

Payload: {“value”: <data>}

 

"Receive":

Topic: <topic>

arrow
arrow

    tttt 發表在 痞客邦 留言(0) 人氣()