通过微信小程序体验阿里云IoT物联网平台

微信小程序-MQTT模拟器

 微信小程序码

通过微信小程序体验阿里云IoT物联网平台

1. 准备工作

1.1 注册阿里云账号

开通阿里云账号,并通过支付宝实名认证 https://www.aliyun.com

1.2 免费开通IoT物联网套件

产品官网 https://www.aliyun.com/product/iot
通过微信小程序体验阿里云IoT物联网平台

2. 控制台操作步骤

2.1 创建高级版产品

 高级版,JSON格式
通过微信小程序体验阿里云IoT物联网平台

点击获取 完整物模型TSL,可以在控制台导入,需要替换productKey

2.2 产品功能定义
添加产品属性
温度 temperature,湿度 humidity
通过微信小程序体验阿里云IoT物联网平台

2.3 注册设备

在产品下注册设备,获得身份三元组
通过微信小程序体验阿里云IoT物联网平台

3. 微信小程序操作                  

          

3.1 设备上线

通过微信小程序体验阿里云IoT物联网平台

3.2 上报数据

通过微信小程序体验阿里云IoT物联网平台

3.3 订阅主题和数据下行

先点击 订阅主题,再去控制台推送消息。
通过微信小程序体验阿里云IoT物联网平台

通过微信小程序体验阿里云IoT物联网平台

通过微信小程序体验阿里云IoT物联网平台

人脸识别彩蛋

通过微信小程序体验阿里云IoT物联网平台

IoT物联网技术

通过微信小程序体验阿里云IoT物联网平台

附录:物模型TSL

{
  "schema": "https://iotx-tsl.oss-ap-southeast-1.aliyuncs.com/schema.json",
  "profile": {
    "productKey": "替换为你的productKey"
  },
  "services": [
    {
      "outputData": [],
      "identifier": "set",
      "inputData": [
        {
          "identifier": "temperature",
          "dataType": {
            "specs": {
              "unit": "°C",
              "min": "0",
              "max": "1000",
              "step": "0.1"
            },
            "type": "float"
          },
          "name": "温度"
        },
        {
          "identifier": "humidity",
          "dataType": {
            "specs": {
              "unit": "%RH",
              "min": "0",
              "max": "100",
              "step": "0.1"
            },
            "type": "float"
          },
          "name": "湿度"
        }
      ],
      "method": "thing.service.property.set",
      "name": "set",
      "required": true,
      "callType": "async",
      "desc": "属性设置"
    },
    {
      "outputData": [
        {
          "identifier": "temperature",
          "dataType": {
            "specs": {
              "unit": "°C",
              "min": "0",
              "max": "1000",
              "step": "0.1"
            },
            "type": "float"
          },
          "name": "温度"
        },
        {
          "identifier": "humidity",
          "dataType": {
            "specs": {
              "unit": "%RH",
              "min": "0",
              "max": "100",
              "step": "0.1"
            },
            "type": "float"
          },
          "name": "湿度"
        }
      ],
      "identifier": "get",
      "inputData": [
        "temperature",
        "humidity"
      ],
      "method": "thing.service.property.get",
      "name": "get",
      "required": true,
      "callType": "async",
      "desc": "属性获取"
    }
  ],
  "properties": [
    {
      "identifier": "temperature",
      "dataType": {
        "specs": {
          "unit": "°C",
          "min": "0",
          "max": "1000",
          "step": "0.1"
        },
        "type": "float"
      },
      "name": "温度",
      "accessMode": "rw",
      "required": false
    },
    {
      "identifier": "humidity",
      "dataType": {
        "specs": {
          "unit": "%RH",
          "min": "0",
          "max": "100",
          "step": "0.1"
        },
        "type": "float"
      },
      "name": "湿度",
      "accessMode": "rw",
      "required": false
    }
  ],
  "events": [
    {
      "outputData": [
        {
          "identifier": "temperature",
          "dataType": {
            "specs": {
              "unit": "°C",
              "min": "0",
              "max": "1000",
              "step": "0.1"
            },
            "type": "float"
          },
          "name": "温度"
        },
        {
          "identifier": "humidity",
          "dataType": {
            "specs": {
              "unit": "%RH",
              "min": "0",
              "max": "100",
              "step": "0.1"
            },
            "type": "float"
          },
          "name": "湿度"
        }
      ],
      "identifier": "post",
      "method": "thing.event.property.post",
      "name": "post",
      "type": "info",
      "required": true,
      "desc": "属性上报"
    }
  ]
}
上一篇:KA,连接池居然这么简单?


下一篇:遇到问题后的本能反应,会决定职场发展的高度?