forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device.yml
139 lines (139 loc) · 4.51 KB
/
device.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建物联网产品与设备,定义设备类型、名称、操作权限及自定义话题类别,输出设备与产品详情。
en: Create IoT products and devices by defining device types, names, operation permissions,
and custom topic categories; output detailed information of devices and products.
Parameters:
NodeType:
Type: Number
Description: |-
The node type of the product. Values:
0: Device. A device cannot be mounted with sub-devices. It can connect to IoT Platform
either directly or as a sub-device of a gateway.
1: Gateway. A gateway can be mounted with sub-devices. It can manage sub-devices, maintain
the topological relationships with sub-devices, and synchronize the topological relationships
to IoT Platform.
Default: 0
ProductName:
Type: String
Description: |-
The name of the product. A product name can be 4 to 30 characters in length and can
contain Chinese characters, English letters, digits, and underscores (_).
Note A product name must be unique in an account.
Default: mytest
DeviceName:
Type: String
Description: |-
The name of the device that you want to register. The device name must consist of
4 to 32 characters, including English letters, digits, and special characters, for
example, hyphens (-), underscores (_), at signs (@), periods (.) , and colons (:).
DeviceName is used with ProductKey to identify a specified device.
Note If you do not specify this parameter, the system will generate a name for the device.
Default: mytest
Operation:
Type: String
Description: |-
Operation permissions of devices on the topic category. Value options:
SUB: Subscribe. Devices can subscribe to the topics of this category.
PUB: Publish. Devices can publish messages using the topics of this category.
ALL: Subscribe and publish. Devices can subscribe to and publish messages to the topics of this category.
Default: SUB
AllowedValues:
- ALL
- PUB
- SUB
TopicShortName:
Type: String
Description: |-
The custom category hierarchy in the topic category. By default, a topic category contains two system defined category hierarchies: productKey and ${deviceName}. Forward slashes (/) are used to delimit the topic hierarchies. The format of a topic category is productKey/${deviceName}/topicShortName.
Note The name of each category hierarchy can contain English letters, digits, and underscores (_), and cannot be empty.
Default: mytest
Desc:
Type: String
Description: The description of the topic category. You can enter a description
with up to 100 characters.
Default: null
MaxLength: 100
IotInstanceId:
Type: String
Description: Instance ID you purchased. Public instances do not need pass this
property.
Default: null
Resources:
Product:
Type: ALIYUN::IOT::Product
Properties:
NodeType:
Ref: NodeType
ProductName:
Ref: ProductName
Device:
Type: ALIYUN::IOT::Device
Properties:
DeviceName:
Ref: DeviceName
ProductKey:
Fn::GetAtt:
- Product
- ProductKey
ProductTopic:
Type: ALIYUN::IOT::ProductTopic
Properties:
Desc:
Ref: Desc
IotInstanceId:
Ref: IotInstanceId
TopicShortName:
Fn::Sub: ${Product.ProductKey}/${DeviceName}/${TopicShortName}
Operation:
Ref: Operation
ProductKey:
Fn::GetAtt:
- Product
- ProductKey
DependsOn: Product
Outputs:
DeviceName:
Description: Device name.
Value:
Fn::GetAtt:
- Device
- DeviceName
DeviceSecret:
Description: Device key.
Value:
Fn::GetAtt:
- Device
- DeviceSecret
ProductName:
Description: Product name.
Value:
Fn::GetAtt:
- Device
- ProductName
IotId:
Description: |-
Things internet device ID issued for the device, as the unique identifier of the device.
Description Keep, do not leak.
Value:
Fn::GetAtt:
- Device
- IotId
ProductKey:
Description: The globally unique identifier of the product issued by IoT Platform.
Value:
Fn::GetAtt:
- Product
- ProductKey
IotInstanceId:
Description: IOT instance ID.
Value:
Fn::GetAtt:
- Product
- IotInstanceId
TopicId:
Description: Topic ID
Value:
Fn::GetAtt:
- ProductTopic
- TopicId