Devices, Variables, and Dots
Last updated
Last updated
The main entities in Ubidots are:
Devices
Variables
Dots
Every time an Ubidots Device receives a sensor value in a variable, a data-point or "dot" is created. Ubidots stores dots that come from your devices inside variables, and these stored dots have corresponding timestamps:
An Ubidots Device is a virtual entity. This means you could map multiple physical devices to a single Ubidots Device, or map many variables from a single physical device to several Ubidots Devices. It is your decision how you want to organize your data in your Ubidots account.
Our recommendation is of course to map 1 Physical Device to 1 Ubidots Device.
Each dot contains these items:
You can find further details below.
A numerical value. Ubidots accepts up to 16 floating-point length numbers.
{"value" : 34.87654974}
A timestamp, as best described here, is a way to track time as a running total of seconds. This count starts at the Unix Epoch on January 1st, 1970 at UTC. Therefore, the unix time stamp is merely the number of seconds between a particular date and the Unix Epoch.
Please keep in mind that Ubidots timestamps are in milliseconds.
But why did we choose to have a timestamp in milliseconds? This is not only a common practice in APIs, it also allows us to support many IoT applications where several datapoints are send in the same second.
"timestamp" : 1537453824000
The above timestamp corresponds to Thursday, September 20, 2018 2:30:24 PM.
PRO-TIP: A useful tool to convert between Unix timestamps and human-readable dates is Epoch Converter.
Numerical values are not the only data type supported; you can also store string or char data types inside what we call context. The context is a key-value object that allows you to store not only numerical but also string values. An example use of the context could be:
"context" : {"status" : "on", "weather" : "sunny"}
A context is commonly used to store the latitude and longitude coordinates of your device for GPS/tracking application use cases. All Ubidots maps uses the lat and lng keys from a dot's context to extract the coordinates of your device, in that way you just need to send a single dot with the coordinates values in the variable context to plot a map instead of sending separately both latitude and longitude in two different variables. Below you can find a typical context with coordinates values:
"context" : {"lat":-6.2, "lng":75.4, "weather" : "sunny"}
Please note that you can mix both string and numerical values in the context. If your application is for geo-localization purposes, make sure that the coordinates are set in decimal degrees.
Item
Description
Mandatory
Size limit
value
A numerical value.
Yes
Up to 16 bit floating-point numbers.
timestamp
Unix Epoch time, in milliseconds. If not specified, then our servers will assign one upon reception.
No
context
An arbitrary collection of key-value pairs. Mostly used to store the latitude and longitude coordinates of GPS devices.
No
1 KB