通过微信小程序体验阿里云IoT物联网平台——设备接入类

微信小程序-MQTT模拟器

 微信小程序码

1. 准备工作

1.1 注册阿里云账号

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

1.2 免费开通IoT物联网套件

产品官网 ​​https://www.aliyun.com/product/iot​

2. 控制台操作步骤

2.1 创建高级版产品

 高级版,JSON格式

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

2.2 产品功能定义

添加产品属性

温度 temperature,湿度 humidity

2.3 注册设备

在产品下注册设备,获得身份三元组

3. 微信小程序操作                  

          

3.1 设备上线

3.2 上报数据

3.3 订阅主题和数据下行

先点击 订阅主题,再去控制台推送消息。

人脸识别彩蛋

附录:物模型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": "属性上报"
    }
  ]
}

物联网平台产品介绍详情:​​https://www.aliyun.com/product/iot/iot_instc_public_cn​

阿里云物联网平台客户交流群

  • 1
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值