Is it possible to change azure edge module twin desired properties while offline?

Mike Romanowski 26 Reputation points
2022-09-16T13:49:37.593+00:00

We have several custom edge modules written in Python 3.8.

We make use of the IoTHubModuleClient, IoTHubRegistryManager and BlobServiceClient at minimum...

We have a requirement for these modules to continue to function offline (no internet but LAN is available) for up to 10 days.

We have done the configuration of the edgeAgent and edgeHub necessary to enable storage or d2c messages on the host's file system while offline and tested those capabilities.

We have implemented the transparent gateway with downstream IoT Edge and IoT Device's. This all is working as expected

We have also deployed and tested the blob storage at the edge module while offline and that seems to work well.

The only thing that we are having trouble with is setting the module twin's desired properties while offline. We would like to make use of the module twins desired properties to inform a module that a blob has been uploaded that it needs to retrieve and take action upon. Is this possible while offline?

Thank you,
Mike

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
567 questions
{count} vote

Accepted answer
  1. Sander van de Velde | MVP 32,006 Reputation points MVP
    2022-09-18T20:44:44.887+00:00

    Hello @Mike Romanowski ,

    as @QuantumCache mentioned, desired module twin properties can only be altered using a cloud connection by the IoT Hub server interface (eg. the portal, the API, or IoT Edge (layered) deployments).

    The edgeHub module keeps the settings (it acts like an IoT Hub proxy) so modules can ask for the current settings on startup.

    So, if you want to change the behavior of the modules while being air-gapped, I recommend creating some alternative persisted storage still changeable on the local network.

    I imagine a custom module with file storage access or in combination with some local database (eg. Sql Server, MySql, Sqlite).

    You can alter stored settings using eg. a rest endpoint or some other protocol or changes on the filesystem. This is in addition to its own module twin.

    This module has an output so when a setting changes, other modules listening to this output get an update. It also has an input so modules can ask for the current values (on startup) or using Direct Methods.

    This new module can actually replace the need for module twins in all other modules...


1 additional answer

Sort by: Most helpful
  1. QuantumCache 20,266 Reputation points
    2022-09-16T17:41:24.393+00:00

    Hello @Mike Romanowski ,

    When I say "offline" I am referring only to the internet being down.

    So basically you want to update the module twin from the cloud when the Internet connectivity is down.

    Regarding the Offline scenario:

    desired props can only be set in IoT Hub. and you need connectivity.
    Only when the device comes online you can do the desired props update.

    A module cannot change its own desired properties and there is no edge API that we are aware of for an external entity to change a desired property on edge directly, only via IoT Hub it is possible.

    The modules will continue running, you just won’t be able to change their configuration via desired properties during this time. You should be able to call a direct method (DM) while offline (from another authenticated device/module connected to edge) to notify the module about the new blob availability…. DMs work offline!!!

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.