Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/27872d6b4749171ff6f2aac865d84afc to your computer and use it in GitHub Desktop.
Save elbruno/27872d6b4749171ff6f2aac865d84afc to your computer and use it in GitHub Desktop.
updateDigitalTwinPropertiesinAzIoTEdgeModule.py
def update_device_state(results, source, doorState, doorStateDesc):
global module_client
try:
# update twin properties
reported_patch = {"doorState": doorState}
asyncio.run(module_client.patch_twin_reported_properties(reported_patch))
reported_patch = {"doorStateDesc": doorStateDesc}
asyncio.run(module_client.patch_twin_reported_properties(reported_patch))
reported_patch = {"doorStateSource": source}
asyncio.run(module_client.patch_twin_reported_properties(reported_patch))
except Exception as e:
AzureIoTLogger.Log ( "update_device_state - Unexpected error %s " % e )
raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment