1. 准备工作
1.1 注册阿里云账号
使用个人淘宝账号或手机号,开通阿里云账号,并通过__实名认证(可以用支付宝认证)__
1.2 免费开通IoT物联网套件
产品官网 https://www.aliyun.com/product/iot
1.3 软件环境
JDK安装
编辑器 IDEA
2. 开发步骤
2.1 云端开发
1) 创建高级版产品
2) 功能定义,产品物模型添加属性
添加产品属性定义
属性名 | 标识符 | 数据类型 | 范围 |
---|---|---|---|
温度 | temperature | float | -50~100 |
湿度 | humidity | float | 0~100 |
物模型对应属性上报topic
/sys/替换为productKey/替换为deviceName/thing/event/property/post
物模型对应的属性上报payload
{
id: 123452452,
params: {
temperature: 26.2,
humidity: 60.4
},
method: "thing.event.property.post"
}
3) 设备管理>注册设备,获得身份三元组
2.2 设备端开发
我们以java程序来模拟设备,建立连接,上报数据。