Create IOT Device Edge Python Sdk - azure-iot-hub

How can create IOT Edge Device?
Actually i use azure sdk service iot and created normal device, but i can't figure out how create iot edge device with azure service client sdk.

It would be similar to how you create a normal device, only difference is that you need to add a capabilities property:
{
deviceId: "EdgeDevice1",
capabilities: {
iotEdge: true
}
}
You could also refer to the code: https://github.com/Microsoft/vscode-azure-iot-toolkit/blob/4bfff9cb24cf5f7b42728640c4ed30bf2cda4253/src/deviceExplorer.ts#L61. It is based on Node Service SDK, but is should be similar to Python Service SDK.

Related

Azure IoT Hub Device Identity requirements

I need to connect some sensors to an Azure IoT Edge Runtime via MQTT.
I read here:How an IoT Edge device can be used as a gateway , that in the "Transparent" Pattern, devices who hold their own IoT Hub device identity can communicate directly with Azure IoT Edge via MQTT.
I am still in the planning phase and don't have the sensors (or Iot Hub devices) at the moment so I couldn't really start testing directly. I wanted to know if all devices/sensors can hold their IoT Hub device identity and if there are any hardware requirements in order to do so?
Thank you very much in advance!
In the transparent gateway case, the requirements for devices / sensors are the same as if the device would connect directly to an IOTHub using its identity. That is, if the device or sensor supports to Azure IOTHub via MQTT, it should work through the transparent gateway. When configuring the device, instead of using a connection string for the Azure IOTHub itself, you'd use a connection string that references the local Edge gateway.
There are 3 basic steps to take in the transparent gateway scenario - the article you linked steps into them, but I'll add in some color for 2 and 3.
Set up the gateway for connectivity from the downstream devices & routing to the upstream IOTHub. This article has good details.
For each device, create an identity in Azure IOTHub, using the device's unique ID (for example, device EUI for a lorawan sensor) as the IOTHub DeviceId, and set up auth per this article. This step is where you determine the Edge gateway connection string.
Connect the downstream device to the gateway device and start sending messages. That's this article. This is obviously dependent on the device itself and the operating code/configs (whether a 3rd party black box type device or something running your own code).

Azure IoT Hub Python SDK on ESP32

Despite not tested or supported as mentioned here, can Azure IoT Python SDK be deployed on ESP32? Or I need to use MQTT Protocol directly to connect with Azure IoT Hub?

Get Azure IOT Hub connection string from UWP app on provisioned device

I have a Raspberry Pi running Windows IOT Core, which has been provisioned to an Azure IOT Hub. I'm writing a UWP app and I want to send messages to the IOT Hub, which I think I need Microsoft.Azure.Devices.Client.DeviceClient to do. DeviceClient needs a connection string, which I can hardcode in the app for testing.
How do I:
Check if the device the app is running on is provisioned to an IOT Hub?
Get the connection string for the IOT Hub?
I can't know this information at compile time, and I don't want to rebuild my application for every device/deployment.
Microsoft.Azure.Devices.Client.DeviceClient is IoT Hub Device SDKs. It is used to send telemetry to your IoT hub, and optionally receive messages, job, method, or twin updates from your IoT hub. But if you want to get the connection string for the IoT Hub and check if the device is provisioned to an IoT Hub, you need to use IoT Hub Service SDKs. It enables you to build backend applications to manage your IoT hub, and optionally send messages, schedule jobs, invoke direct methods, or send desired property updates to your IoT devices or modules. But you also need to set the DeviceId and iot hub connection string in your app.
It is not recommended to generated the connection string in device client end. The sdk supports UWP app to run on Windows IoT Core.
I think you might want to try to check out the UWP Bridge. It is a WinRT library that can be used to connect to the Device Agent and read the connection string from the TPM.
You can build the DMBridgeComponent library from the azure-client-tools repo on GitHub (https://github.com/ms-iot/azure-client-tools) and then reference it from your UWP app.
Then, to read your connection string you just need the following code:
using DMBridgeComponent;
...
var tpm = new TpmBridge();
// Get connection string from TPM
var slotNumberValue = 0;
var connectionString = tpm.GetConnectionString(slotNumberValue, 36000);
Set the slotNumberValue to whatever slot you used when you provisioned your device. It is usually 0 by default.
There is more information here (https://github.com/ms-iot/azure-client-tools/blob/master/docs/device-agent/uwp-bridge.md). That's where I found the sample code.

417 - This device has an empty configuration for the edge agent?

I have created an Azure IoT Edge device by following the steps outlined here:
https://learn.microsoft.com/en-us/azure/iot-edge/quickstart-linux
When I create a deployment and check the IoT Edge device I see the following error message:
417 - This device has an empty configuration for the edge agent. Please set a deployment manifest.
What am I missing?
This happens when you create an Edge device in Azure IoT Hub and then launch the Edge runtime before setting up modules for the device in IoT Hub. Once a deployment has been done and the Edge runtime sees it, this should go away.

How to add a device to MobileFirst Operations Console?

How to add a device to MobileFirst Operations Console ?
I face issue in identifying my device in the MobileFirst Operations Console.
Please let me know how to configure my device to be detected in the console .
The only feature related to "devices" is adding device simulation in the Console's Mobile Browser Simulator as described in the following user documentation topic: http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.dev.doc/wl_studio_tools/topics/ttestwl.html?lang=en
The other feature related to devices is Device profiling, as described in the tutorial Getting Started tutorial: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/hello-world/introduction-to-mobilefirst-platform-operations-console/
Device profiling will be made possible after applications that are installed on simulators or devices are used and connect the MobileFirst Server. You can then create device profiling based on... devices.