Reputation: 61
I would like to change the frequency of the simulated tempSensor module so that it sends telemetry to the IoT Hub every 60 seconds, not every 5 seconds. I cannot find the code in order to create my own C# module or to modify the one that Azure has as a sample. How do I change the frequency of the telemetry of this simulated temperature sensor module used in the IoT Edge walkthrough?
https://hub.docker.com/r/microsoft/azureiotedge-simulated-temperature-sensor/
I have an Azure Iot Hub with 8000 messages per day and Iot Edge device simulated and a tempSensor and filterModule through Docker setup etc... All is working well.
I could write another C# module similar to the filterModule which would function like a time filter and averages 12 readings together and sends a message every 60 seconds and then the filterModule does it's job after. So the route would go from tempSensor to timeFilter to filterModule. Along this line of thinking.
SIMULATED TEMPERATURE SENSOR in Docker
https://azure.microsoft.com/en-us/resources/samples/?service=iot-hub&sort=0&term=simulated
Where do I find the code for that example? I looked here:
https://github.com/Azure-Samples
I am trying to learn how the simulated temperature sensor module works in the code in order to build off that to create my own IoT modules.
I found something close but am not sure how to go between this code and the modules used in IoT Edge.
https://learn.microsoft.com/en-us/dotnet/api/overview/azure/iot?view=azure-dotnet
I don't see API reference here:
https://learn.microsoft.com/en-us/azure/iot-edge/
Here are some other places I looked:
https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-edge
https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-toolkit
Upvotes: 2
Views: 1412
Reputation: 106
The source code is not currently open source.
Currently (April 2018) the code is open-sourced under the MIT licence and can be found on GitHub here:link
To solve your immediate need, there is an undocumented setting for adjusting the delay. All the available settings for the Simulated Temperature sensor module (and default values):
"MessageDelay": "00:00:05",
"machineTempMin": 21,
"machineTempMax": 100,
"machinePressureMin": 1,
"machinePressureMax": 10,
"ambientTemp": 21,
"ambientHumidity": 25
This may be set as environment variables in the "createOptions" section, like this:
"tempSensor": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "microsoft/azureiotedge-simulated-temperature-sensor:1.0-preview",
"createOptions": "{\"Env\":[\"MessageDelay=00:01:00\"]}"
}
}
Upvotes: 2