Add hardware mock sensors - DCAM, SPOD, RainWise weather, invalid#144
Add hardware mock sensors - DCAM, SPOD, RainWise weather, invalid#144yanichka99 wants to merge 4 commits intoAzure-Samples:mainfrom
Conversation
RLeclair
left a comment
There was a problem hiding this comment.
LGTM, left a few comments! Thanks for putting this together!
| @@ -0,0 +1,20 @@ | |||
| # Use Alpine Python runtime | |||
| FROM python:3.13.6-alpine3.21 | |||
There was a problem hiding this comment.
I’m not very familiar with Python Docker images, but for Rust we typically use Microsoft’s base images (Azure Linux). I noticed some other Dockerfiles in the repo use the slim version of the Python base image, though from my research that seems heavier. I’m not sure if that applies here, so feel free to ignore
| @@ -0,0 +1,30 @@ | |||
| { | |||
There was a problem hiding this comment.
I don't have the context but what does it mean to be missing a key field?
| Before deploying, ensure you have: | ||
| - [Docker](https://docs.docker.com/get-docker/) | ||
| - [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) | ||
| - [Azure Container Registry](https://learn.microsoft.com/en-us/azure/container-registry/) (ACR) access |
There was a problem hiding this comment.
Are there any specific steps for getting access? Or is this referring to creating a ACR instance?
There was a problem hiding this comment.
This will also apply for the root readme!
| After retrieving the endpoint from the Azure CLI command, set an environment variable for the sensor to use in your API call: | ||
|
|
||
| ``` | ||
| export DCAM_SENSOR_ENDPOINT="http://dcam-mock-iot.eastus2.azurecontainer.io:8080" |
There was a problem hiding this comment.
Should this have the fill-in labels like above?
| export DCAM_SENSOR_ENDPOINT="http://dcam-mock-iot.eastus2.azurecontainer.io:8080" | |
| export DCAM_SENSOR_ENDPOINT="http://<your-dns-label>.<region>.azurecontainer.io:8080" |
| --registry-username $SP_APP_ID \ | ||
| --registry-password=$SP_SECRET \ | ||
| --ip-address Public \ | ||
| --dns-name-label "dcam-mock-iot" \ |
There was a problem hiding this comment.
Should this DNS label also be fill in?
|
|
||
| response = jsonify(data) | ||
|
|
||
| # check if in the parameters come uuid, if yes, put the whole response in a html body |
| 'batt': (0, 100), # volt | ||
| 'chrg': (0, 100), # mA | ||
| 'run': (0, 100), # mA | ||
| 'tsen1': (0, 100), |
There was a problem hiding this comment.
Do these (here and below) require any unit comments?
| logging.basicConfig(level=logging.INFO) | ||
|
|
||
| # Define ranges for each measurement and field - this will be for fields in the metric system in the 'metric' array | ||
| # TO:DO: update all measurement types under device_data with realistic ranges, rest of fields are generated between 0-100 |
| After deployment, you can get the endpoint for each sensor using: | ||
|
|
||
| ```bash | ||
| az container show -g $RESOURCE_GROUP -n weather-mock-sensor --query ipAddress.fqdn -o tsv |
There was a problem hiding this comment.
Should this be:
| az container show -g $RESOURCE_GROUP -n weather-mock-sensor --query ipAddress.fqdn -o tsv | |
| az container show -g $RESOURCE_GROUP -n <weather mock sensor image name> --query ipAddress.fqdn -o tsv |
Same for the other two?
| - **Weather Mock Sensor**: Simulates weather data (temperature, humidity, wind speed, atmospheric pressure) and is designed to emulate a RainWise weather station. | ||
| - **SPOD Mock Sensor**: Simulates SPOD sensor readings, specifically for SENSIT SPOD air quality sensors. | ||
| - **Invalid Mock Sensor**: Produces malformed data for error handling testing. | ||
| - **DCAM Mock Device**: Simulates camera data and confidence readings using Server-Sent Events (SSE) ([documentation here](./dcam-mock-sensor-sse/dcam-mock-sensor.md)). |
There was a problem hiding this comment.
Is there a reason why the DCAM readme is in another readme?
Purpose
This PR introduces a new hardware-mock-sensors folder to the repository, providing containerized mock sensors for integration and testing with Azure IoT Operations. These sensors simulate real-world industrial hardware, including:
Each sensor exposes HTTP endpoints for polling or event streaming (DCAM uses SSE) and is deployable to Azure Container Instances or other cloud/container environments. The folder includes:
A version of these mock sensors were used in the development of the Facilities of the Future engagement (https://dev.azure.com/IndustrySolutions/IS%20Engagements/_workitems/edit/65082/), supporting in validating data flows without requiring physical devices.
co-authored with @mahomedalid and @renato-marciano
Does this introduce a breaking change?
Pull Request Type
How to Test
hardware-mock-sensorsto build, deploy, and test each mock device.What to Check
Other Information
hardware-mock-sensors.