Use this topic to publish data to more than one variable of a device with a global timestamp.
You can send several values with the same timestamp. This helps reduce data upload costs and create scripts with lower ROM memory usage. Use the global timestamp as follows:
Topic:
/v2.0/devices/<device_label>| Field | Value | Required |
|---|---|---|
| Host | industrial.api.ubidots.com | Yes |
| Port | 1883/8883 (Non-TLS/TLS) | Yes |
| Username | Your Ubidots Token | Yes |
| Password | Any character or leave blank | No |
| Quality of Service | 0 or 1 | No |
Payload structure:
{
"temperature": 10,
"humidity": 90,
"pressure": 78,
"timestamp": 1634311791000
}{
"temperature": {
"value": 10,
"timestamp": 1634378596000,
"context": {
"status": "cold"
}
},
"humidity": {
"value": 90,
"context": {
"status": "High humidity"
}
},
"pressure": {
"value": 78,
"context": {
"status": "Normal"
}
},
"timestamp": 1634311791000
}
timestamphierarchyIf a timestamp is provided within a Dot, it overrides the global timestamp and uses the provided timestamp instead. For example, the
temperaturevariable receives a value of10with the timestamp1634378596000instead of the global timestamp1634311791000.
Example
The Bash examples in this section use the Eclipse Mosquitto library. To test them, install it by following the official instructions.
Send data to multiple Variables with a global timestamp
Update multiple variables with a global timestamp that applies to all values.
$ mosquitto_pub \
-h 'industrial.api.ubidots.com' \
-t '/v2.0/devices/weather-station' \
-u 'BBFF-Rfcgaxns6HlVb155WA0RhSY85xNDmB' \
-p 1883 \
-q 1 \
-m '{
"temperature": 10,
"humidity": 90,
"pressure": 78,
"timestamp": 1634311791000
}'Send data to multiple Variables with a global timestamp
Update multiple variables with a global timestamp that applies to all Dots.
$ mosquitto_pub \
-h 'industrial.api.ubidots.com' \
-t '/v2.0/devices/weather-station' \
-u 'BBFF-Rfcgaxns6HlVb155WA0RhSY85xNDmB' \
-p 1883 \
-q 1 \
-m '{
"temperature": {
"value": 10,
"timestamp": 1634378596000,
"context": {
"status": "cold"
}
},
"humidity": {
"value": 90,
"context": {
"status": "High humidity"
}
},
"pressure": {
"value": 78,
"context": {
"status": "Normal"
}
},
"timestamp": 1634311791000
}'
