如何在Cumulocity中获得设备的受支持的测量值? [英] How to get supported measurements of a device in Cumulocity?

查看:117
本文介绍了如何在Cumulocity中获得设备的受支持的测量值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用模拟设备时,您可以从"c8y_SupportedMeasurements"字段中获得其支持的测量值(例如,fragmentTypes),例如,温度传感器的外观如下:

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" ]

c8y_SupportedMeasurements: [ "c8y_TemperatureMeasurement" ]

使用真实设备时,此字段不可用.在获取特定设备的测量值时,我可以看到可能的fragmentTypes

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

/measurement/measurements?source=id

为我提供了以下fragmentTypes的测量列表:

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

  • 湿度传感器

  • Humidity sensor

温度传感器

电池

以类似于模拟器和"c8y_SupportedMeasurements"字段的方式来获取设备支持的fragmentTypes的正确方法是什么?

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?

推荐答案

c8y_SupportedMeasurements是由Cumulocity自动生成的碎片.当设备发送带有新片段的测量值时,它将更新.

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

您可以直接查询支持的测量结果,例如这样的设备(它将仅返回c8y_SupportedMeasurements而不是整个设备对象):

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

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

如果此时不存在碎片,则此调用还将触发基于设备的历史数据的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.

这篇关于如何在Cumulocity中获得设备的受支持的测量值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆