smartREST 模板:自定义测量作为数据点不可见

smartREST template: custom measurement not visible as Datapoint

我通过 "device management -> smartREST templates" 创建了一个用于测量的 smartREST 模板。我通过 MQTT 发送读数:

s/uc/mytemplateID
777,123,stringValue

邮件到达,因为我可以通过 API:

{  
   "time":"2018-07-03T15:36:13.237+01:00",
   "id":"47638",
   "self":"https://myDomain.mydomain/measurement/measurements/47638",
   "source":{  
      "id":"20018",
      "self":"https://myDomain.mydomain/inventory/managedObjects/20018"
   },
   "type":"myType",
   "myStrValue":"stringValue",
   "myNumberValue":123
}

但我无法将其视为数据点。 我也看不到:"device management -> All devices -> myDevice -> Measurements" 如果原因是传入的消息没有预期的格式,那么问题是,我如何使用 MQTT 以预期的格式发送自定义测量值?

谢谢

为了能够在您的测量中使用 Cumulocity 标准功能,它们必须遵守特定标准。转换您的模板以创建如下测量值:

{ 
   "time":"2018-07-03T15:36:13.237+01:00",
   "id":"47638",
   "self":"https://myDomain.mydomain/measurement/measurements/47638",
   "source":{  
      "id":"20018",
      "self":"https://myDomain.mydomain/inventory/managedObjects/20018"
   },
   "type":"myType",
   "myFragment":{
      "mySeries":{
         "value":123,
         "unit":"aUnit"
      },
      "myOtherSeries":{
         "value":321,
         "unit":"anotherUnit"
      }
   }
}

请注意,测量值始终是数字,在此处使用基于字符串的值可能会再次导致意外行为。

如果您想传达基于字符串的状态变量,发送事件或警报通常是更好的方法。

发送此类测量值的模板配置应如下所示: