This repo contains an Azure IoT Edge solution that will deploy the below modules to an IOT Edge device
A walkthrough series on how this was setup is available here:
https://dev.to/chris_mckelt/azure-iot-edge-who-is-cooler-dotnet-node-or-python-369m
https://github.com/chrismckelt/edgy/wiki
This solution demonstrates an air-conditioning monitoring system where 3 room sensors are publishing their temperature over time. When a room gets too hot the air conditioner for that room is turned on. Once the room is cooled it is turned off.
Three ‘data generator’ modules publish a message with the following properties.
- Timestamp
- Temperature – room temp in Celsius
- IsAirConditionerOn – true/false
- TagKey – room name (in this case dotnet, node, python)
Three ‘data recorder’ modules subscribe to the published temperature messages and save the data in a time series database.
A custom module will listen to all temperature messages and analyse when a room is too hot. Sending a message to turn the rooms air conditioner on.
- show local debug/development options & remote/real deployment
- how to create and configure an Azure IOT Hub environment in Azure using Azure CLI scripts
- coding custom modules in .Net, Python, NodeJS (sorry Java)
- using existing Azure IoT Edge marketplace modules
- using non-edge marketplace modules (docker images) to save data with Timescale
- connecting a data flow engine ( Apache Nifi) to the Edge MQTT Broker
- viewing the data through a Grafana dashboard.
In order to develop solutions for the edge:
- Read Developing custom modules
- Setup your machine using the Azure IoT EdgeHub Dev Tool
- I recommend installing these VS code extensions
- I recommend using Portainer for docker management both locally & on the deployed edge solution
Portainer running on http://localhost:9000/
Scripts found here will create out the below environment in a given resource group.
The code contains the docker build files , code & scripts to create the following modules
Folder / File | Description |
---|---|
config | automatically generate files from the deployment.templates.json (debug or prod) that are used to deploy the solution |
modules | custom code, docker images for your IOT Edge solution |
scripts | code to create the environment, build the code/docker images and deploy the solution |
tools | certificate generator and other tools for solution support |
.env | holds environment variables that populate the generated config files from the templates |
deployment.debug.template.json | creates a file in the /config folder called 'deployment.debug.json' that populates environment variables, used for local development |
deployment.prod.template.json | creates a file in the /config folder called 'deployment.prod.json' that populates environment variables, used for production like deployment |
The solution used 3 devices which will be setup in a future post.
A simulated local environment using the Azure IoT Edge Hub Development simulator to run against the IOT Hub. When developing for the edge it is recommended not to install the real ‘IOT edge runtime’ on your machine but instead use the simulator.
https://docs.microsoft.com/bs-latn-ba/Azure/iot-edge/how-to-install-iot-edge-linux
Linux Ubuntu hosted on Azure in our resource group created using this script
This uses the pre-existing Linux Ubuntu image from the Azure Marketplace with the runtime installed.
Once up and running VS Code will show the devices below.