MQTT Item Syntax for VTQ Timestamp
- Last UpdatedOct 09, 2017
- 1 minute read
Each payload in MQTT has an associated time value, that shows the time of occurrence of an event. For an accurate timestamp value of a data field, the MQTT data source concatenates the data field and the timestamp field using the &T& string.
If a value item is X and the time item is Y, the item X&T&Y allows the value X to be timestamped with the value of Y. The resulting item is read-only.
Prerequisites to use &T& string to timestamp the date field:
-
A time field must be available in the data record
-
The time field can be either:
-
Unix timestamp (example: 1507103430 = Wednesday October 4 2017 07:50:30 UTC)
-
ISO 8601 timestamp string in UTC format
-
Example 1: 2017-10-04T07:50:30Z = Wednesday October 4 2017 07:50:30 UTC)
-
Example 2 (when time is in ms): 2017-10-04T07:50:30.134Z = Wednesday October 4 2017 07:50:30.134 UTC).
The ISO 8601 timestamp string ends with Z.
-
-
Example:
Data field: obj.temp_c
Timestamp field: obj.time (obtained from the field $op$ww.get.obj.time)
The syntax for VTQ time stamp using the &T& token:
obj.temp_c&T&obj.time
If the timestamp field is in the same object as the data field, the VTQ timestamp is obtained using the syntax:
obj.temp_c&T&.time