微信小程序-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
阿里云物联网平台客户交换群