Like most websites, 30MHz uses cookies to remember you so that we can deliver an optimised browsing experience. Select ‘Accept all’ if you’re okay with accepting cookies from UserEngage (webchat and lead generation), Hotjar (website improvement) and LinkedIn (tailored ads). When you select ‘Accept only necessary’, we will place cookies that let you use our website properly by remembering your preferences and for anonymous statistics. For more information, please see our cookie policy and privacy notice.

Accept all
Accept only necessary

How to explore your data in ZENSIE


At the explore view, you can visualize your data by creating graphs and selecting different time periods and intervals.

Visualizing sensor data

To visualize your data in a graph, select one or more sensor checks from the drop down menu:

If you want to add more sensor data to the graph, click at the “+ ADD SENSOR” button:

 

Selecting time periods and intervals for your graphs

By default the graph shows data from the last 24 hours with an interval of every 5 minutes. You can:

  1. Change the time period. 
  2. Change the time intervals.
  3. Select to see averages, or min/max values

 

 

How to export data from ZENSIE


At the export page, you can export the raw data of your organization.

Select the month, the year, and the location from which you wish to export the data and click START EXPORT.

Once your data are ready to be downloaded, you will receive an email.

 

How to get your data using the ZENSIE API


30MHz provides a REST API to access the data collected by ZENSIE via web checks and sensors.

To use it, you will need to create an API key. You can do this by going to the sidebar, click on Account Settings, and select the tab Developer.

Click on the “Request new API key” button.

A dialog will appear showing the API key, which you can copy and use to connect to the API.

API Documentation

The API documentation can be found at https://api.30mhz.com/api/swagger. There are two(2) ways to try the API; using postman, or through the command line.

Example using postman

In this example, we will show you how to use postman to get all the checks of your organization.

Go to swagger documentation and find the description of the endpoint that returns all checks of a given organization https://api.30mhz.com/api/swagger#!/check/getOrganizationChecks.

Note the URL you need to make the call, and the required fields. In this example the required field is the organization id.

To find your organization id, go to ZENSIE dashboard, Account Settings, at the Organization tab

Alternatively, you can find your organization id from the url at the ZENSIE page: 

Download a free version of postman here. Open the application and fill in the required fields:

GET https://api.30mhz.com/api/check/organization/{{organization id}}

Headers
Authorization: {{your API key}}
Content-Type: application/json

The reply is a JSON object and it should look like this:

Example using the command line

Here we will show you how to get all checks from your organization using the command line:

  1. Open a command line interface (eg. Terminal for Mac, Command Prompt for Windows).
  2. The CURL command that you need for getting all checks of the organization is:
curl -XGET -H 'Content-Type: application/json' -H 'Authorization: your API key' https://api.30mhz.com/api/check/organization/example_id

If you want to save the output of the command in a file you can add at the end of the command >>output.txt like this:

curl -XGET -H 'Content-Type: application/json' -H 'Authorization: your API key' https://api.30mhz.com/api/check/organization/example_id >>output.txt

The data stored in the output.txt file are in a json format. If you are not familiar with it and you want to see the data in a table format, you can use an online JSON to CSV converter (for example here).

Just copy the data from the output.txt file and paste them into the indicated field at the converter page. The result should look like this:

How to retrieve sensor data using the API


A very common use case when using our API is to get the values of specific sensors. Often we need the current value of a sensor. Other times we need the historical values over a period of time.

To retrieve data for a given sensor, we first need to find the id of this sensor. One way to do this is to go to the sensor in the ZENSIE dashboard (Sensors > click on the sensor you are interested in) and look at its URL in the browser:

Sensor URL example

Another option would be to get all the sensors from an organization using an API call (see this page for an example).

For doing any API call, it’s necessary to generate and use an API key. This can be generated once and used always after that (Go to Account Settings > Developer).

Here are a couple of examples to request data from a temperature/humidity sensor with the unique id “39555cf5-3081-400c-96cf-ff8d9cdea173”. We are using the following API endpoint:

We need to make a GET request, passing the sensor id, and date/time interval. For example, in this case we request the average values per day from the 1st to the 4rd of November of 2017:

curl -XGET \
    -H "Content-type: application/json" \
    -H 'Authorization: <API key>' \
    "https://api.30mhz.com/api/stats/check/39555cf5-3081-400c-96cf-ff8d9cdea173/from/2017-11-01T00:00:00Z/until/2017-11-04T00:00:00Z?statisticType=averages&intervalSize=1d"

 

This could return for example:

dsf

{ 
  "1509494400000": 
    { "sht25.temp": 18.601995752298404, 
      "sht25.humidity": 59.27995778537517 
    }, 

    "1509580800000": 
      { "sht25.temp": 18.30961109134886, 
      "sht25.humidity": 58.49782640139262 
      }, 

    "1509667200000": 
      { "sht25.temp": 17.93818057510588, 
        "sht25.humidity": 58.11836816999647 
      }
}

This shows the average temperature and humidity for each day, the key in each case being the timestamp.

We could also request the minimum or maximum values for a period by using statisticType=mins or statisticTypes=maxs respectively.

We could change the intervalSize and request it per hour, with intervalSize=1h, or per minute (1m), 5 minutes (5m), 5 days (5d), monthly (M), etc.

Similarly, if we would want the current value for a sensor, we could use the following API endpoint:

And we could call it for the sensor of the example in this way:

curl -XGET \
    -H "Content-type: application/json" \
    -H 'Authorization: <API key>' "https://api.30mhz.com/api/stats/check/56aac51f-5966-47da-8824-eaf36c8e4737"

We would get something similar to this:

{ "checkId": "56aac51f-5966-47da-8824-eaf36c8e4737", 
  "timestamp": "2017-11-21T13:10:45Z", 
  "lastRecordedStats": 
      { "sht25.temp": "16.79", 
        "sht25.humidity": "62.93" 
      }, 
  "json": null, 
  "code": null, 
  "message": null, 
  "matchCondition": null
}

where the current values are returned in lastRecordedStats property.

All the API endpoints to get data for a sensor or a set of sensors can be found in the Swagger documentation.

Ingest api: adding external sensor data to ZENSIE


Creating import checks
The first step is creating import checks. An import check contains all the data of a sensor and creates an endpoint to which values can be sent. Import checks can be created by navigating to the checks view. At the bottom right, the plus button can be clicked to add a new sensor. We then can click on the external sensor option

We fill in the name, select the sensor type and click create.

Sensor types
Sensor types contain the definition of how data is formatted and should be displayed. A sensor type contains information such as the metric + unit (e.g. Temperature = ºC), data types and expected json values. Feel free to contact us if a new sensor type should be added.

Sending data to an import check
The last step is sending data to the api. After saving the check, we see the settings page. Here the endpoint is shown with an example call.

We can do a post to

https://api.30mhz.com/api/ingest/organization/www.30mhz.com

 

With these values (values change based on import check and sensor type):

[ 
  { 
  "checkId": "import_check_id", 
  "timestamp": "A valid ISO 8601 DateTime format value with an explicitly set timezone value (e.g. 2017-01-17T19:23:02Z, 2017-01-17T19:23:02+06:45).", 
  "data": 
    {
      "temp": "double", 
      "hum": "double" 
    }, 
  "status": "ok || fail", 
  "error": "custom error text message" 
  } 
]

 

Notice that we are sending the values inside an array. We can send multiple sensor values (multiple import checks) in one call:

[{import_check_1...},{import_check_2...},{etc...}]

 

API Keys
Make sure you add your api keys to the Authorization header: find out how to generate and use api keys.