您需要在创建 Sensor 对象时发布 DataType。如果您想稍后更改,请使用“无”。Swagger 文档显示您可以展开并查看必填字段的“模型”。
如果 DataType 不在 api/v1/system/types 中,您需要启用它或创建一个新的 DataType。使用所需信息为类型创建一个新的 DataType POST。最小值是 TypeName 和 SpaceID 来整理下面的类型。我的典型模式是创建一个根空间并将任何自定义孪生对象(如类型)附加到该空间。
我相信这些也是区分大小写的名称。
https://{servicename}.{region}.azuresmartspaces.net/management/swagger/ui/index#/Types
编辑:
检查您的本体:
https://{servicename}.{region}.azuresmartspaces.net/management/api/v1.0/ontologies
按 ID 和 POST 选择这些以将它们设置为 true 以获取所有可用的内置类型:
[
{
"id": 1,
"name": "Required",
"loaded": true
},
{
"id": 2,
"name": "Default",
"loaded": true
},
{
"id": 3,
"name": "BACnet",
"loaded": true
},
{
"id": 4,
"name": "Advanced",
"loaded": true
}
]
然后您可以查询所有给定的类型:
https://{servicename}.{region}.azuresmartspaces.net/management/api/v1.0/types?includes=Description,FullPath,Ontologies,Space
你应该收到类似的东西:
[
{
"id": 1,
"category": "DeviceSubtype",
"name": "None",
"disabled": false,
"logicalOrder": 0,
"fullName": "None",
"spacePaths": [
"/system"
],
"ontologies": [
{
"id": 1,
"name": "Required",
"loaded": true
}
]
},
{
"id": 2,
"category": "DeviceType",
"name": "None",
"disabled": false,
"logicalOrder": 0,
"fullName": "None",
"spacePaths": [
"/system"
],
"ontologies": [
{
"id": 1,
"name": "Required",
"loaded": true
}
]
},
{
"id": 3,
"category": "DeviceBlobSubtype",
"name": "None",
"disabled": false,
"logicalOrder": 0,
"fullName": "None",
"spacePaths": [
"/system"
],
"ontologies": [
{
"id": 1,
"name": "Required",
"loaded": true
}
]
},
...Objects,
]