In order to ingest data into ZENSIE, a sensor type has to be created. A sensor type contains information such as the metrics and units (e.g. Temperature = oC), data types and expected values. In order to create a new sensor type this endpoint can be used: POST /sensor-type/organization/{organizationId}
If we want to ingest data for counting insects and temperature we can do a POST request to
POST https://api.30mhz.com/api/sensor-type/organization/{organizationId}
The body would look like this:
{ "name": "Insect count and temperature", "description": "Counting insects in a greenhouse", "icon": "<i class=\"material-icons\">favorite</i>", "color": "#71cee9", "decimals": 1 "metrics": ["count","temperature"], "jsonKeys": ["bug", "temp"], "jsonLabels": ["Bug", "Temperature"], "dataTypes": ["long", "double"], "external": true }
name
The name of the sensor type
description
A description of the sensor type
icon
The icon of the sensor (will appear in the sensor list + widgets). To view possible icons, visit https://material.io/tools/icons/
color
Color used for widgets
decimals
The precision of the measurements. If we have 1 decimal, we will ingest values like 10.4 or 8.1.
metrics
Id’s of metrics. Metrics determine what users see in the dashboard when viewing graphs. Temperature metric for example, displays the unit oC or F. To get a list of possible metrics, this endpoint can be used: GET /metric
jsonKeys
Json keys etermine how data will be stored and retrieved.
jsonLabels
Json labels determine what the user sees when selecting the metrics. If we for example have 2 temperature metrics with json keys temp1 and temp2, we can use the json labels to distinguish. E.g. Temperature greenhouse A, Temperature outside.
dataTypes
Data types determine the type of data that will be stored per json key. The possible data types are
["long", "double", "boolean", "string"]
external
Because we are adding external data, this property has to be set to true.
organizationId in the post url
The organization the sensor type will be added to.
Creating import checks
After the sensor type is created we can use this sensor type create import checks. These checks can be used to ingest data.