question

Newbie-5482 avatar image
0 Votes"
Newbie-5482 asked asergaz edited

Cloud to device message with iot edge device

Hi, I used to use function triggered by iot hub to send cloud to device message. Now, that i decide to use my device as an iot edge device and want to achieve the same goal. As, I read the documentation, i found that there isn't $upstream option as source in declare route for iot edge hub. Is there anyway to send data from iot hub to iot edge device?
Also, if i have like 5 modules in edge device, will they run 1 by 1 or at the same time?
Thanks.

azure-iot-edge
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MatthijsvdVeer avatar image
2 Votes"
MatthijsvdVeer answered SandervandeVelde42 commented

Currently Azure IoT Edge modules do not support C2D messages. It is mentioned in these docs. Instead of C2D messages, you can use a Direct Method to contact a module, the downside is that the device needs to be online for a Direct Method to work.

To answer your second questions, Azure IoT Edge will attempt to run all the modules at the same time. The exception to that rule is that the edgeAgent module will always run first, and the edgeHub module will only run if there are any other modules running.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

t@MatthijsvdVeer thank you for the answer. If i have already deploy my modules to my edge device(raspberry), will it automatically run iot edge runtime and my modules when i boot raspberry on or do i have to do it manually. Am i able to multi-thread in my modules like in normal python scipt?
Thanks

0 Votes 0 ·

If you followed the default installation steps here, the runtime will automatically start up with the OS. The runtime will check what configuration is available for it (from IoT Hub) and attempt to apply it. And yes, you can do multi-threading in a Docker container.


1 Vote 1 ·

@MatthijsvdVeer thank you for the answer. If i have already deploy my modules to my edge device(raspberry), will it automatically run iot edge runtime and my modules when i boot raspberry on or do i have to do it manually. Am i able to multi-thread in my modules like in normal python scipt?

0 Votes 0 ·

Each container is an application that is 'sandboxed'.

It just runs as a normal application so you can run what you like.

The only limitation is that access to external resources (network, diskusage, USB, comports, etc.) is controlled from the outside by Docker (or the 'Create Options' in Azure IoT Edge).

1 Vote 1 ·
SandervandeVelde42 avatar image
1 Vote"
SandervandeVelde42 answered Newbie-5482 commented

As @MatthijsvdVeer mentioned, Direct Methods are a good way for C2D communication.

Another alternative is making use of the Module Twin. You can send values using the desired properties. The device can send the response of the action back to the cloud using the reported properties, also part of the Module Twin.
This works also nice in disconnected scenarios.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SandervandeVelde42 thank you for your answer, i will have a look at it

0 Votes 0 ·