close

Lesson 3 Connect your device to QIoT Suite Lite using MQTTS


In Lesson 2 , we complete deploy sample code to your device .In this lesson, you will learn how yo use sample code to connect to QIoT Suite Lite

And there are two parts:

A: Run Sample Code

B:Another protocol

Part A :Run Sample Code



  • Open Terminal application (e.g., PuTTY) on your PC.Connect to your device by SSH and enter the folder where put sample code (e.g., /home/root/bundle).
    arduino



  • Install sample code dependency,enter command as following

    root@arduino:~# cd {folder where you put sample code}
    root@arduino:~/home/root/bundle# pip install paho-mqtt


  • Run sample code

    root@arduino:~/home/root/bundle# pyton mqtt.py


  • device will send message to topic "temp" or that you defined ,as below image.
    arduino_run_python



Part B :Another protocol



  • Click "Connection a device" button

  • You can choose another protocol you would like to use


12_another_protocol

  • SSH to your device , and input command as following.

    root@arduino:~/home/root/bundle# cd /home/{{user}}/bundle

    // mqtt(dont' need certificate,just put JSON file to "res" folder):
    root@arduino:~/home/root/bundle# pip install paho-mqtt
    root@arduino:~/home/root/bundle# python mqtt.py

    // http
    root@arduino:~/home/root/bundle# pip install requests
    root@arduino:~/home/root/bundle# python http.py

    // https
    root@arduino:~/home/root/bundle# pip install requests
    root@arduino:~/home/root/bundle# python https.py

    // coap
    root@arduino:~/home/root/bundle# pip install coapthon
    root@arduino:~/home/root/bundle# python coap.py


  • In next Lesson ,we will integrate Power BI to visualize senser data . Lesson 4 Integrate Power BI


Please visit QNAP github for QIoT Suite Lite sample code


"QNAP-Github"

arrow
arrow
    全站熱搜

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