@@ -98,7 +98,8 @@ Customizable variables can be created with the following properties:
9898| name| Name of the property. Defines what will be replaced in the template telemetry $.Name|
9999| random| Make the value random, limited by min and max|
100100| step| If the value is not random, will be incremented each time by the value of step|
101- | min| For random values defines it's minimum. Otherwise, will be the starting value|
101+ | randomDouble| Make the value random and double, limited by min and max|
102+ | min| For random (integer or double) values defines it's minimum. Otherwise, will be the starting value|
102103| max| The maximum value generated|
103104| values| Defines an array of possible values. Example [ "on", "off"] |
104105| customlengthstring| Creates a random string of n bytes. Provide n as parameter|
@@ -110,42 +111,42 @@ Customizable variables can be created with the following properties:
110111Template:
111112
112113``` json
113- { "deviceId" : " $.DeviceId" , "temp " : $.Temp, "Ticks": $.Ticks, "Counter": $.Counter, "time": "$.Time" }
114+ { "deviceId" : " $.DeviceId" , "rand_int " : $.Temp, "rand_double": $.DoubleValue , "Ticks": $.Ticks, "Counter": $.Counter, "time": "$.Time" }
114115```
115116
116117Variables:
117118
118119``` json
119- [{"name" : " Temp" , "random" : true , "max" : 25 , "min" : 23 }, {"name" :" Counter" , "min" :100 , "max" :102 }]
120+ [{"name" : " Temp" , "random" : true , "max" : 25 , "min" : 23 }, {"name" :" Counter" , "min" :100 , "max" :102 }, { "name" : " DoubleValue " , "randomDouble" : true , "min" : 0.22 , "max" : 1.25 } ]
120121```
121122
122123Output:
123124
124125``` json
125- { "deviceId" : " sim000001" , "temp " : 23 , "Ticks" : 637097550115091350 , "Counter" : 100 , "time" : " 2019-11-19T10:10:11.5091350Z" }
126- { "deviceId" : " sim000001" , "temp " : 23 , "Ticks" : 637097550115952079 , "Counter" : 101 , "time" : " 2019-11-19T10:10:11.5952079Z" }
127- { "deviceId" : " sim000001" , "temp " : 24 , "Ticks" : 637097550116627320 , "Counter" : 102 , "time" : " 2019-11-19T10:10:11.6627320Z" }
128- { "deviceId" : " sim000001" , "temp " : 24 , "Ticks" : 637097550117027320 , "Counter" : 100 , "time" : " 2019-11-19T10:10:11.7027320Z" }
126+ { "deviceId" : " sim000001" , "rand_int " : 23 , "rand_double" : 0.207759137669466 , "Ticks" : 637097550115091350 , "Counter" : 100 , "time" : " 2019-11-19T10:10:11.5091350Z" }
127+ { "deviceId" : " sim000001" , "rand_int " : 23 , "rand_double" : 1.207232427664231 , "Ticks" : 637097550115952079 , "Counter" : 101 , "time" : " 2019-11-19T10:10:11.5952079Z" }
128+ { "deviceId" : " sim000001" , "rand_int " : 24 , "rand_double" : 0.992871827638167 , "Ticks" : 637097550116627320 , "Counter" : 102 , "time" : " 2019-11-19T10:10:11.6627320Z" }
129+ { "deviceId" : " sim000001" , "rand_int " : 24 , "rand_double" : 0.779288272162327 , "Ticks" : 637097550117027320 , "Counter" : 100 , "time" : " 2019-11-19T10:10:11.7027320Z" }
129130```
130131
131132Running with Docker:
132133
133134``` powershell
134- docker run -it -e "IotHubConnectionString=HostName=your-iothub-name.azure-devices.net;SharedAccessKeyName=device;SharedAccessKey=your-iothub-key" -e Template="{ \"deviceId\": \"$.DeviceId\", \"temp \": $.Temp, \"Ticks\": $.Ticks, \"Counter\": $.Counter, \"time\": \"$.Time\" }" -e Variables="[{name: \"Temp\", \"random\": true, \"max\": 25, \"min\": 23}, {\"name\":\"Counter\", \"min\":100, \"max\":102} ]" mcr.microsoft.com/oss/azure-samples/azureiot-telemetrysimulator
135+ docker run -it -e "IotHubConnectionString=HostName=your-iothub-name.azure-devices.net;SharedAccessKeyName=device;SharedAccessKey=your-iothub-key" -e Template="{ \"deviceId\": \"$.DeviceId\", \"rand_int \": $.Temp, \"rand_double\": $.DoubleValue , \"Ticks\": $.Ticks, \"Counter\": $.Counter, \"time\": \"$.Time\" }" -e Variables="[{name: \"Temp\", \"random\": true, \"max\": 25, \"min\": 23}, {\"name\":\"Counter\", \"min\":100, \"max\":102} ]" mcr.microsoft.com/oss/azure-samples/azureiot-telemetrysimulator
135136```
136137
137138calling from PowerShell:
138139
139140``` powershell
140- docker run -it -e "IotHubConnectionString=HostName=your-iothub-name.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=your-iothub-key" -e Template="{ \"""deviceId\""": \"""$.DeviceId\""", \"""temp \""": $.Temp, \"""Ticks\""": $.Ticks, \"""Counter\""": $.Counter, \"""time\""": \"""$.Time\""", \"""engine\""": \"""$.Engine\""" }" -e Variables="[{name: \"""Temp\""", \"""random\""": true, \"""max\""": 25, \"""min\""": 23}, {\"""name\""":\"""Counter\""", \"""min\""":100, \"""max\""":102}, {name:\"""Engine\""", values: [\"""on\""", \"""off\"""]}]" -e DeviceCount=1 -e MessageCount=3 mcr.microsoft.com/oss/azure-samples/azureiot-telemetrysimulator
141+ docker run -it -e "IotHubConnectionString=HostName=your-iothub-name.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=your-iothub-key" -e Template="{ \"""deviceId\""": \"""$.DeviceId\""", \"""rand_int \""": $.Temp, \"""rand_double\""": $.RandomDouble , \"""Ticks\""": $.Ticks, \"""Counter\""": $.Counter, \"""time\""": \"""$.Time\""", \"""engine\""": \"""$.Engine\""" }" -e Variables="[{name: \"""Temp\""", \"""random\""": true, \"""max\""": 25, \"""min\""": 23}, {\"""name\""":\"""Counter\""", \"""min\""":100, \"""max\""":102}, {name:\"""Engine\""", values: [\"""on\""", \"""off\"""]}]" -e DeviceCount=1 -e MessageCount=3 mcr.microsoft.com/oss/azure-samples/azureiot-telemetrysimulator
141142```
142143
143144#### Example 2: Adding the engine status ("on" or "off") to the telemetry
144145
145146Template:
146147
147148``` json
148- { "deviceId" : " $.DeviceId" , "temp " : $.Temp, "Ticks": $.Ticks, "Counter": $.Counter, "time": "$.Time", "engine": "$.Engine" }
149+ { "deviceId" : " $.DeviceId" , "rand_int " : $.Temp, "Ticks": $.Ticks, "Counter": $.Counter, "time": "$.Time", "engine": "$.Engine" }
149150```
150151
151152Variables:
@@ -157,14 +158,14 @@ Variables:
157158Output:
158159
159160``` json
160- { "deviceId" : " sim000001" , "temp " : 23 , "Ticks" : 637097644549666920 , "Counter" : 100 , "time" : " 2019-11-19T12:47:34.9666920Z" , "engine" : " off" }
161- { "deviceId" : " sim000001" , "temp " : 24 , "Ticks" : 637097644550326096 , "Counter" : 101 , "time" : " 2019-11-19T12:47:35.0326096Z" , "engine" : " on" }
161+ { "deviceId" : " sim000001" , "rand_int " : 23 , "Ticks" : 637097644549666920 , "Counter" : 100 , "time" : " 2019-11-19T12:47:34.9666920Z" , "engine" : " off" }
162+ { "deviceId" : " sim000001" , "rand_int " : 24 , "Ticks" : 637097644550326096 , "Counter" : 101 , "time" : " 2019-11-19T12:47:35.0326096Z" , "engine" : " on" }
162163```
163164
164165Running with Docker:
165166
166167``` bash
167- docker run -it -e " IotHubConnectionString=HostName=your-iothub-name.azure-devices.net;SharedAccessKeyName=device;SharedAccessKey=your-iothub-key" -e Template=" { \" deviceId\" : \" $.DeviceId\" , \" temp \" : $.Temp, \" Ticks\" : $.Ticks, \" Counter\" : $.Counter, \" time\" : \" $.Time\" , \" engine\" : \" $.Engine\" }" -e Variables=" [{name: \" Temp\" , \" random\" : true, \" max\" : 25, \" min\" : 23}, {\" name\" :\" Counter\" , \" min\" :100}, {name:\" Engine\" , values: [\" on\" , \" off\" ]}]" mcr.microsoft.com/oss/azure-samples/azureiot-telemetrysimulator
168+ docker run -it -e " IotHubConnectionString=HostName=your-iothub-name.azure-devices.net;SharedAccessKeyName=device;SharedAccessKey=your-iothub-key" -e Template=" { \" deviceId\" : \" $.DeviceId\" , \" rand_int \" : $.Temp, \" Ticks\" : $.Ticks, \" Counter\" : $.Counter, \" time\" : \" $.Time\" , \" engine\" : \" $.Engine\" }" -e Variables=" [{name: \" Temp\" , \" random\" : true, \" max\" : 25, \" min\" : 23}, {\" name\" :\" Counter\" , \" min\" :100}, {name:\" Engine\" , values: [\" on\" , \" off\" ]}]" mcr.microsoft.com/oss/azure-samples/azureiot-telemetrysimulator
168169```
169170
170171#### Example 3: Using a configuration file to customize simulation
0 commit comments