使用家用閘道器連結QNAP IoT Suite和QVR Pro Bata

Description

Description
作者:Wei-Ting Chen

本專案是使用QNAP官方出的qnap-qiot-sdks套件進行開發,相關文件可見Git連結

1. 使用範例教學(以Node.js+Raspberry的開發方法進行舉例)

進到此資料夾:qnap-qiot-sdks/nodejs/device/raspberrypi/examples/


2. 新增認證擋(以MQTT進行舉例)

這部分要到Iot Suite上面進行註冊申請,將此檔案在res資料夾中新增並檔名為「resourceinfo.json」,此認證檔會長得像這樣:

{
"username": "c8881a66-82cf-4606-b7b7-5f5fb758fc74",
"myqnapcloudHost": "Not Available",
"clientId": "up_1492071161",
"host": [
"192.168.1.17"
],
"password": "r:e956df324ff43d49ff5fcb67714c33c6",
"port": 1883,
"resources": [
{
"description": "超音波所量測的距離",
"datatype": "Int",
"resourceid": "test01",
"topic": "qiot/things/admin/up/test01",
"resourcename": "distance",
"resourcetypename": "Custom Sensor(Int)",
"unit": "bar"
},
{
"description": "感測濕度",
"datatype": "Float",
"resourceid": "hum01",
"topic": "qiot/things/admin/up/hum01",
"resourcename": "humidity",
"resourcetypename": "Humidity",
"unit": "°C"
},
{
"description": "溫度感測",
"datatype": "Float",
"resourceid": "tem01",
"topic": "qiot/things/admin/up/tem01",
"resourcename": "temperature",
"resourcetypename": "Temperature",
"unit": "°C"
},
{
"description": "光敏偵測",
"datatype": "Float",
"resourceid": "light",
"topic": "qiot/things/admin/up/light",
"resourcename": "light",
"resourcetypename": "Light",
"unit": "lux"
},
{
"description": "pm2.5感測",
"datatype": "Float",
"resourceid": "pm01",
"topic": "qiot/things/admin/up/pm01",
"resourcename": "pm2.5",
"resourcetypename": "Humidity",
"unit": "°C"
},
{
"description": "紅外線",
"datatype": "Int",
"resourceid": "inf01",
"topic": "qiot/things/admin/up/inf01",
"resourcename": "Infrared",
"resourcetypename": "Custom Sensor(Int)",
"unit": "bar"
},
{
"description": "聲音",
"datatype": "Int",
"resourceid": "sou01",
"topic": "qiot/things/admin/up/sou01",
"resourcename": "sound",
"resourcetypename": "Sound",
"unit": "°C"
}
]
}

3.新增要上傳的資料(以MQTT作為舉例)

打開mqtt.js第38行,記得ID的部分要和與網上註冊的ID一樣:

connection.publishById("ID", getRandomInt(0, 50));

4. 中間的資料處理部分,只要會一點點的Node-Red,就能進行很進階的開發動作

5. 最後就交給前端了

PS.QVR Pro的部分我就不詳細說明,打開QVR Pro在事件檢視的地方就會有Action URL的方式,可以在這邊很簡單的與Iot Suite連結。

Contact

Contact
  • Category
    NAS, 開發板
  • Tags
    QNAP

Project簡述

Project簡述
  • 簡述
    本專案會分享如何使用QNAP IoT Suite搭配QVR Pro來與家用閘道器進行連結。
  • 作者
    Wei-Ting Chen

您的姓名 〈需填寫〉

您的電子郵件信箱 〈需填寫〉

主旨

您的信件內容