使用IoT REST网关发送具有多个度量的功能

2020-09-22 17:12发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,

我目前在使用IoT网关发送具有多个测量值的功能时遇到了一些麻烦。 我要发送的消息有效负载由4种功能组成。 我在这里粘贴其中一个作为示例:

 {" id":" 7b5b1199-de44-4ec1-b3ab-3d72aa7a1bc2","名称":" device_data"," alternateId":" HR003","属性":[{"名称":"电源",  " dataType":" integer"," formatter":{" dataType":" integer"," scale":0," shift":0," swap":false}},{" name":" serial",  " dataType":" string"},{" name":" battery"," dataType":" integer"," formatter":{" dataType":" integer"," scale":0," shift":0  ," swap":false}},{" name":" fw_version"," dataType":" string"},{" name":" hw_version"," dataType":" string"},{" name":  " location"," dataType":" string"}]} 

我想通过REST发送这样的有效负载:

" device_data":{" power":9," serial":" DHCZ2020B"," battery":90," fw_version":" 19.0.2"," hw_version":" 6.3"," location": "罗马"}

为此,我添加了以下架构文件:

{" type":" object"," parserData":{" format":" JSON"," resource":" REST_body"," messageType":" default"," messageTypeFinder":{" format": " JSON_POINTER"," jsonPointer":"/img/messageType"}}," actions":[]," properties":{" deviceAlternateId":{" type":" string"," mapTo":" device_alternate_id"}," device_data":{" type":" object"," mapTo":" value"," properties":{" *":{" mapKeyTo":" property_name"," mapTo":" value"}},"操作 ":[{" type":" ADD"," mapTo":" capability_alternate_id"," value":" HR003"},{" type":" ADD"," mapTo":" sensor_type_alternate_id"," value": 987321},{" type":" ADD"," mapTo":" sensor_alternate_id"," value":" HRsensor001"}]}}}

我已在网关中激活调试日志,但没有收到任何错误。 但是,数据无法在物联网中可视化。 您能帮我弄清楚我的错误吗?

谢谢

Federico

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


大家好,

我目前在使用IoT网关发送具有多个测量值的功能时遇到了一些麻烦。 我要发送的消息有效负载由4种功能组成。 我在这里粘贴其中一个作为示例:

 {" id":" 7b5b1199-de44-4ec1-b3ab-3d72aa7a1bc2","名称":" device_data"," alternateId":" HR003","属性":[{"名称":"电源",  " dataType":" integer"," formatter":{" dataType":" integer"," scale":0," shift":0," swap":false}},{" name":" serial",  " dataType":" string"},{" name":" battery"," dataType":" integer"," formatter":{" dataType":" integer"," scale":0," shift":0  ," swap":false}},{" name":" fw_version"," dataType":" string"},{" name":" hw_version"," dataType":" string"},{" name":  " location"," dataType":" string"}]} 

我想通过REST发送这样的有效负载:

" device_data":{" power":9," serial":" DHCZ2020B"," battery":90," fw_version":" 19.0.2"," hw_version":" 6.3"," location": "罗马"}

为此,我添加了以下架构文件:

{" type":" object"," parserData":{" format":" JSON"," resource":" REST_body"," messageType":" default"," messageTypeFinder":{" format": " JSON_POINTER"," jsonPointer":"/img/messageType"}}," actions":[]," properties":{" deviceAlternateId":{" type":" string"," mapTo":" device_alternate_id"}," device_data":{" type":" object"," mapTo":" value"," properties":{" *":{" mapKeyTo":" property_name"," mapTo":" value"}},"操作 ":[{" type":" ADD"," mapTo":" capability_alternate_id"," value":" HR003"},{" type":" ADD"," mapTo":" sensor_type_alternate_id"," value": 987321},{" type":" ADD"," mapTo":" sensor_alternate_id"," value":" HRsensor001"}]}}}

我已在网关中激活调试日志,但没有收到任何错误。 但是,数据无法在物联网中可视化。 您能帮我弄清楚我的错误吗?

谢谢

Federico

付费偷看设置
发送
2条回答
SAP小黑
1楼-- · 2020-09-22 17:32

你好费德里科,

您是否已经尝试过查看在线文档[1]? 在那里描述了不同的用例(格式)。

此致

安东

[1] https://help。 .com/viewer/5c0383349e014278a0ebb9cfbd8d1958/Cloud/zh-CN/cd075597dcfa48e1918bb1dea0b478ba.html#loiocd075597dcfa48e1918bb1dea0b478ba

CPLASF-自律
2楼-- · 2020-09-22 17:24

嘿安东,

感谢您的回答。 不幸的是,我以前引用的文档似乎不再存在,例如关于架构文件的配置。 在我看来,建议的发送度量的方式与我的用例不太匹配,因为我不想发送"度量"键,但是在上述情况下,名称为" device_data"。/p>

使用类似的配置,我已发送了单个度量,例如:

{

" user_uuid":123123

}

通过以下方式映射到架构文件中:

" user_uuid":{" type":" integer"," mapTo":" value"," actions":[{" type":" ADD"," mapTo":" capability_alternate_id"," value": " HR001"},{" type":" ADD"," mapTo":" sensor_type_alternate_id"," value":987321},{" type":" ADD"," mapTo":" sensor_alternate_id"," value": " HRsensor001"}]}

当然,我想保持这样的消息格式。 只有我不知道问题在模式中的什么位置,因为如上所述,文档似乎不再可用。

谢谢

Federico

一周热门 更多>