Reputation: 306
I'm trying to notify my devices for changes in their device-twin. After reading almost all of Azure's documentation, I could not find any solution for notifying the device app for a device twin update directly and not by running a service that subscribers an event-hub, and sends the messages it receives to the device. Moreover, the python code supplied here by Azure for sending cloud-to-device messages- crashes. Does anyone have some successful experience with this kind of communication?
Upvotes: 0
Views: 203
Reputation: 16128
Here you go, from the official github repo.
async def twin_patch_listener(device_client):
while True:
patch = await device_client.receive_twin_desired_properties_patch() # blocking call
print("the data in the desired properties patch was: {}".format(patch))
# Schedule task for twin patch
asyncio.create_task(twin_patch_listener(device_client))
Upvotes: 1