Azure IoT Central
!!! failure "This feature is not included in precompiled binaries, To use it you must compile your build.
Add the following to user_config_override.h
:
#ifndef USE_MQTT_TLS
#define USE_MQTT_TLS
#endif
#define USE_MQTT_AZURE_IOT
#define USE_MQTT_AZURE_DPS_SCOPEID "YOURSCOPEIDHERE"
#define USE_MQTT_AZURE_DPS_PRESHAREDKEY "YOURPRESHAREDKEYHERE=="
As of Tasmota version 9.2.4, Tasmota now supports TLS 1.2 connections to Azure IoT Hub and IoT Central using time bound token authentication based on a unique key. IoT Central includes Azure Device Provisioning Service which is used for simplified deployment at scale.
Benefits~
Azure IoT Central supports supports bi-directional communication between the could and both IoT Devices and/or Intelligent Edge devices base on Azure IoT Edge and is delivered as a Software as a Service (SaaS). In addition to telemtary and communication, IoT Central if a full solution for quickly managing and deploying IoT solutions at scale.
Authentication~
This version of Tasmota leverages the Preshared Key authentication, which will create a time bound (one hour by default) SHA256 signature based on a unique key. Only this signed text is sent across the network over a TLS 1.2 channel ensuring mutual authentication. Because of this time bound nature, Tasmota must (by default) be configured to synchronize time with public Network Time Protocol Servers. Developer level information provided here discussed here.
Cost~
Azure IoT Central provides a free tier that allows for 2 devices at no charge.
Get Started~
0. Create an IoT Central Application~
Follow the steps here to create an IoT Central Application: https://docs.microsoft.com/en-us/azure/iot-central/core/quick-deploy-iot-central
1. Get the ID Scope~
Select Administration --> Device Connection to note the ID Scope as shown below:
2. Create an Enrollment Group~
Click Create enrollment group
, name the group, and select the Attestation type as Shared access signature (SAS)
. Click Save to and copy the Primary Key, as shown below:
3. Compile your binary including support for Azure IoT Device Provisioning Service (and IoT Central)~
Following the directions here: https://tasmota.github.io/docs/Compile-your-build/. Compile your binary adding the following settings to your my_user_config.h adding your Scope Id and your Primary Key.
Tip
Don't forget your WiFi for complete automation.
#ifndef USE_MQTT_TLS
#define USE_MQTT_TLS
#endif
#define USE_MQTT_AZURE_IOT
#define USE_MQTT_AZURE_DPS_SCOPEID "0ne002AEBBA"
#define USE_MQTT_AZURE_DPS_PRESHAREDKEY "iQ9Qtjfux9wWW0guHi/ChRGQX//LLkZEnyUNIaLD8+imAsKvpZwYYT8M0kFPVxt3KjtRF00KpNi5/ejBt+1YLA=="
4. Flash your device and configure for WiFi~
Tip
If you configured the WiFi in the config file, no WiFi configuration needed.
Flash your device as discussed here and then configure the WiFi as discussed here.
5. Verify your automatic (DPS) configuration~
In the Console of Tasmota, you will see it was registered with Device Provisioning Service (which created the IoT Hub device) and authenticated with a token, connected and it will start sending state:
If you look at the properties, you will see it automatically defined the Host name, port, TLS and MQTT Client (device Id) -- which defaulted to the MAC address:
In the IoT Central Application, you can see the telemtry data: