How to get supported measurements of a device in Cumulocity?

五迷三道 提交于 2019-12-13 06:36:11

问题


When using a simulated device you can get its supported measurements (i.e. fragmentTypes) from the "c8y_SupportedMeasurements" field which for example for a temperature sensor looks as follows:

c8y_SupportedMeasurements: [ "c8y_TemperatureMeasurement" ]

When using a real device this field is not available. I can see the possible fragmentTypes when fetching the fetching the measurements for that particular device

/measurement/measurements?source=id

which gives me a list of measurements for the following fragmentTypes:

  • Humidity sensor

  • Temperature sensor

  • Battery

What is the correct way to fetch the supported fragmentTypes for a device in a similar way as it can be done with the simulators and the "c8y_SupportedMeasurements"-field?


回答1:


The c8y_SupportedMeasurements is an automatically generated fragement by Cumulocity. It updates when the device sends a measurement with a new fragment in it.

You can query supported measurements directly for a device like this (it will return only the c8y_SupportedMeasurements instead of the whole device object):

/inventory/managedObjects/{{deviceId}}/supportedMeasurements

This call will also trigger the initial calculation of supportedMeasurements based on the historic data of the device if the fragement did not exist at that point.



来源:https://stackoverflow.com/questions/37830322/how-to-get-supported-measurements-of-a-device-in-cumulocity

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!