Vicotee Cloud Data-Forwarding JSON Format

Introduction

Vicotee Cloud collects following data from the sensors:

  • Device UUID (STRING), device unique ID.
  • Datetime UTC, (STRING : yyyy-MM-dd T HH:mm:ss.SSSSSSSXXX), when the data was collected. If sensor doesn't send timestamp, we will use server time.
  • Measurement type (STRING), example: TEMPERATURE
  • Measurement values (Array of FLOAT), example: [21.6]
  • Measurement unit (STRING), unit of the measurement (if any). Example for temperature, the unit can ‘C’ or ‘F’

The collected data can be pushed to 3rd party services, one measurement per push. i.e. a sensor has two measurements, the cloud will perform two pushes. Bulk push of multiple measurements is possible, read here for more info.

JSON Format

data-forwarding-web-interface
Web Interface for setting Data-Forwarding

The Vicotee Cloud is flexible when it comes to attribute's name for the JSON object. The Cloud Web Interface allows you to define your JSON, for instance; you can name your device’s UUID in the object as “deviceUuid”

{  
    "deviceUuid" : "{uuid}"  
}

Or you can name is as “myDevice”

{  
    "myDevice" : "{uuid}"  
}

When it comes to attribute’s value, the data types are fixed:

  • Device UUID : String
  • Datetime: String
  • Measurement type: String
  • Measurement values: Float or Array of floats to support measurement with multiple values.
  • Measurement unit: String

With these simple rules in mind, you can from Web Interface setup your JSON in the way you want. This is an example of such JSON:

{  
    "deviceId" : "{uuid}",  
    "time" : "{time}",  
    "sensor" : "{key}",  
    "values" : [{val}],  /* Note the brackets for array */
    "unit" : "{unit}"  
}

Once JSON is defined, the full JSON object which server will push may look like this:

{  
    "deviceId" : "003c37a0455d9f66",  
    "time" : "2019-04-05T01:12:34.0000000Z",  
    "sensor" : "AUDIO_MAX_MIN",  
    "values" : [192.0, 53.4],  
    "unit" : "mV"  
}

 

NOTE: The 'values' attribute has brackets surrounding {val}. If you omit these brackets and measurements with multiple values will be sent one by one. Example (using the same dataset as example above):

{  
    "deviceId" : "{uuid}",  
    "time" : "{time}",  
    "sensor" : "{key}",  
    "values" : {val}, 
    "unit" : "{unit}"  
}

The server will push two message:

{  
    "deviceId" : "003c37a0455d9f66",  
    "time" : "2019-04-05T01:12:34.0000000Z",  
    "sensor" : "AUDIO_MAX_MIN",  
    "values" : 192.0,  
    "unit" : "mV"  
}

and

{  
    "deviceId" : "003c37a0455d9f66",  
    "time" : "2019-04-05T01:12:34.0000000Z",  
    "sensor" : "AUDIO_MAX_MIN",  
    "values" : 53.4,  
    "unit" : "mV"  
}

The best practice is to use array for values even your measurements only have one value.