registerMeasure #
Add properties definition to the measures
field of the devices
collection.
registerMeasure (measureName: string, mappings: JSONObject, options: JSONObject);
Arguments | Type | Description |
---|---|---|
measureName | string | Name of the measure you are willing to add to the measures field |
mappings | JSONObject | Mappings definiton of the custom measure property |
options | JSONObject | Additional options |
options #
Properties | Type | Description |
---|---|---|
group | string | Name of the group for which the mappings should apply. If unspecified, mappings will apply to every group who does not have specific definition |
Usage #
import { DeviceManagerPlugin } from 'kuzzle-plugin-device-manager';
const deviceManagerPlugin = new DeviceManagerPlugin();
deviceManagerPlugin.devices.registerMeasure(
'temperature',
{
dynamic: 'false',
properties: {
fahrenheit: { type: 'float' },
celsius: { type: 'float' }
}
},
{ group: 'water_management' });
deviceManagerPlugin.devices.registerMeasure(
'humidity',
{
dynamic: 'false',
properties: {
percentage: {
type: 'keyword',
fields: {
text: { type: 'text' } }
}
}
},
{ group: 'air_quality' });
Edit this page on Github(opens new window)