Device Emulator Functions
This article explains how to use built-in functions in the Device Emulator payloads, shows JSON and CSV examples, and lists the available emulator functions and their behavior.
Functions are helper variables you can add to your payload when using the Device Emulator. Each function serves a specific purpose. To insert a function into your payload, click the Functions button and select the desired function.
You can use functions in both JSON and Raw (CSV) payload types.
Examples
JSON example using a function:
[
{
"variable": "temperature",
"unit": "F",
"value": $random$
}
]
CSV example using a function:
variable,value,time,serie
temperature,$random$,2019-09-19,1568913302243
List of functions
- $random$: This function will be replaced by a random number that ranges from 0 to 100 whenever you send your payload.
- $busRoute$: This function will be replaced by a sequential bus route through Chicago. The location will change to a new one every time you send your payload. You should only use this function in the
locationfield of a JSON payload.
- $sequentialHex$: This function will be replaced by a hexadecimal value that is increased by 1 every time you send your payload. If you are using this function in a JSON payload, wrap it around quotes (
"$sequentialHex$").
- $date$: This function will be replaced by the current date in the format
YYYY-MM-DD. If you are using this function in a JSON payload, wrap it around quotes ("$date$").
:::tip
If you are unsure of how to use functions, look for samples in the editor.
:::